MCPcopy
hub / github.com/yeoman/yo / updateAvailableGenerators

Method updateAvailableGenerators

lib/router.js:60–90  ·  view source on GitHub ↗

* Update the available generators in the app * TODO: Move this function elsewhere, try to make it stateless.

()

Source from the content-addressed store, hash-verified

58 * TODO: Move this function elsewhere, try to make it stateless.
59 */
60 updateAvailableGenerators() {
61 this.generators = {};
62
63 const resolveGenerators = generator => {
64 // Skip sub generators
65 if (!/:(app|all)$/.test(generator.namespace)) {
66 return;
67 }
68
69 const {packageJson: package_} = readPackageUpSync({cwd: path.dirname(generator.resolved)});
70
71 if (!package_) {
72 return;
73 }
74
75 package_.namespace = generator.namespace;
76 package_.appGenerator = true;
77 package_.prettyName = titleize(humanizeString(namespaceToName(generator.namespace)));
78 package_.update = updateNotifier({pkg: package_}).update;
79
80 if (package_.update && package_.version !== package_.update.latest) {
81 package_.updateAvailable = true;
82 }
83
84 this.generators[package_.name] = package_;
85 };
86
87 for (const generator of Object.values(this.env.getGeneratorsMeta())) {
88 resolveGenerators(generator);
89 }
90 }
91}

Callers 4

runYoFunction · 0.95
installGeneratorFunction · 0.80
updateSuccessFunction · 0.80
router.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected