How to use the yeoman-environment.namespaceToName function in yeoman-environment

To help you get started, we’ve selected a few yeoman-environment examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yeoman / yo / lib / routes / clear-config.js View on Github external
const generatorList = _.chain(globalConfig.getAll()).map((val, key) => {
    let prettyName = '';
    let sort = 0;

    // Remove version from generator name
    const name = key.split(':')[0];
    const generator = app.generators[name];

    if (generator) {
      ({prettyName} = generator);
      sort = -app.conf.get('generatorRunCount')[namespaceToName(generator.namespace)] || 0;
    } else {
      prettyName = name.replace(/^generator-/, '') + chalk.red(' (not installed anymore)');
      sort = 0;
    }

    return {
      name: prettyName,
      sort,
      value: key
    };
  }).compact().sortBy(generatorName => generatorName.sort).value();
github yeoman / yo / lib / routes / run.js View on Github external
module.exports = (app, name) => {
  const baseName = namespaceToName(name);
  app.insight.track('yoyo', 'run', baseName);

  console.log(
    chalk.yellow('\nMake sure you are in the directory you want to scaffold into.') +
    chalk.dim('\nThis generator can also be run with: ') +
    chalk.blue(`yo ${baseName}\n`)
  );

  // Save the generator run count
  const generatorRunCount = app.conf.get('generatorRunCount');
  generatorRunCount[baseName] = generatorRunCount[baseName] + 1 || 1;
  app.conf.set('generatorRunCount', generatorRunCount);
  app.env.run(name);
};
github yeoman / yo / lib / router.js View on Github external
const resolveGenerators = generator => {
      // Skip sub generators
      if (!/:(app|all)$/.test(generator.namespace)) {
        return;
      }

      const {pkg} = readPkgUp.sync({cwd: path.dirname(generator.resolved)});

      if (!pkg) {
        return;
      }

      pkg.namespace = generator.namespace;
      pkg.appGenerator = true;
      pkg.prettyName = titleize(humanizeString(namespaceToName(generator.namespace)));
      pkg.update = updateNotifier({pkg}).update;

      if (pkg.update && pkg.version !== pkg.update.latest) {
        pkg.updateAvailable = true;
      }

      this.generators[pkg.name] = pkg;
    };
github yeoman / yo / lib / routes / home.js View on Github external
}).compact().sortBy(el => {
    const generatorName = namespaceToName(el.value.generator);
    return -app.conf.get('generatorRunCount')[generatorName] || 0;
  }).value();

yeoman-environment

Handles the lifecyle and bootstrapping of generators in a specific environment

BSD-2-Clause
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis