How to use the yeoman-environment.createEnv 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 datatypevoid / vulgar-cli / lib / install.js View on Github external
var config = require('../config')(), // TODO: config
      napi = config.napiUrl,
     shell = require('shelljs'),
        fs = require('fs'),
     chalk = require('chalk'),
     utils = require('./utils'),
 mongoCtrl = require('./controllers/mongo'), // TODO: mongoCtrl
     users = require('./controllers/users'), // TODO: user
    series = require('async-series'),
   request = require('request'),
        qs = require('querystring'),
  inquirer = require('inquirer'),
    prompt = require('prompt'),
    yeoman = require('yeoman-environment'),
       env = yeoman.createEnv();

var progress = new utils.Progress();

exports.init = function(options) {

  progress.start();

  series([

    checkPermissions,

    function(done) {

      cloneVulgar(options, done);
    },
github jhipster / generator-jhipster / cli / utils.js View on Github external
const createYeomanEnv = () => {
    const env = yeoman.createEnv();
    /* Register yeoman generators */
    Object.keys(SUB_GENERATORS)
        .filter(command => !SUB_GENERATORS[command].cliOnly)
        .forEach(generator => {
            if (SUB_GENERATORS[generator].blueprint) {
                /* eslint-disable prettier/prettier */
                env.register(require.resolve(`${SUB_GENERATORS[generator].blueprint}/generators/${generator}`), `${CLI_NAME}:${generator}`);
            } else {
                env.register(require.resolve(`../generators/${generator}`), `${CLI_NAME}:${generator}`);
            }
        });
    return env;
};
github yeoman / generator / test / wiring.js View on Github external
it('exposes the wiring interface', function () {
    var Dummy = generators.Base.extend({
      exec: function () {}
    });
    var dummy = new Dummy([], {
      resolved: 'foo',
      namespace: 'bar',
      env: yeoman.createEnv()
    });

    assert.implement(dummy, wiring);
  });
});
github yeoman / generator / test / storage.js View on Github external
beforeEach(function() {
    this.beforeDir = process.cwd();
    this.storePath = path.join(tmpdir, 'new-config.json');
    this.memFs = env.createEnv().sharedFs;
    this.fs = FileEditor.create(this.memFs);
    this.store = new Storage('test', this.fs, this.storePath);
    this.store.set('foo', 'bar');
  });
github fengjundev / DoubanMovie-React-Native / node_modules / react-native / local-cli / init.js View on Github external
function init(projectDir, argsOrName) {
  console.log('Setting up new React Native app in ' + projectDir);
  var env = yeoman.createEnv();
  env.register(require.resolve(path.join(__dirname, 'generator')), 'react:app');
  var args = Array.isArray(argsOrName) ? argsOrName : [argsOrName].concat(process.argv.slice(4));
  var generator = env.create('react:app', {args: args});
  generator.destinationRoot(projectDir);
  generator.run();
}
github dvhb / webpack / bin / webpack.js View on Github external
function commandInit() {
  const env = yeoman.createEnv();
  const dir = path.resolve(__dirname, `../commands/init`);
  const done = (exitCode) => process.exit(exitCode || 0);

  env.register(require.resolve(dir), `dvhb:init`);
  env.run(`dvhb:init`, done);
}
github JulienCabanes / Yeoman-UI / lib / yeoman-ui.js View on Github external
function run(namespace, socket, envOptions, runOptions, cb) {
  var env = yeoman.createEnv([], envOptions, new SocketAdapter(socket));
  env.lookup(function () {
    env.run(namespace, runOptions, cb);
  });
}
github microsoft / react-native-windows / local-cli / upgrade / upgrade.js View on Github external
module.exports = function upgrade(args, config) {
  args = args || process.argv;
  let env = yeoman.createEnv();
  let name = JSON.parse(fs.readFileSync('package.json', 'utf8')).name;
  let generatorPath = path.join(__dirname, '..', 'generator');
  env.register(generatorPath, 'react:app');
  let generatorArgs = ['react:app', name].concat(args);
  return new Promise((resolve) => env.run(generatorArgs, {upgrade: true}, resolve));
};
github react-native-community / cli / generate-android.js View on Github external
module.exports = function(projectDir, name) {
  var oldCwd = process.cwd();
  process.chdir(projectDir);

  var env = yeoman.createEnv();
  var generatorPath = path.join(__dirname, 'generator');
  env.register(generatorPath, 'react:app');
  var args = ['react:app', name].concat(process.argv.slice(4));
  env.run(args, {'skip-ios': true}, function() {
    process.chdir(oldCwd);
  });
};
github GeekyAnts / reazy / src / commands / index.js View on Github external
import yeoman from 'yeoman-environment';
import _ from 'lodash';

const env = yeoman.createEnv();

const reazyGenerators = '../reazy-generator/generators';

env.register(require.resolve(`${reazyGenerators}/mobile-app`), 'reazy:mobile-app');
env.register(require.resolve(`${reazyGenerators}/web-app`), 'reazy:web-app');
env.register(require.resolve(`${reazyGenerators}/plugin`), 'reazy:plugin');
env.register(require.resolve(`${reazyGenerators}/add-plugin`), 'reazy:add-plugin');
env.register(require.resolve(`${reazyGenerators}/remove-plugin`), 'reazy:remove-plugin');

const generatorOptions = {
  disableNotifyUpdate: true
};

function requireFromString(src, filename) {
  var m = new module.constructor();
  m.paths = module.paths;

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