Eli Perelman
8 years ago
4 changed files with 3170 additions and 49 deletions
@ -1,36 +0,0 @@ |
|||
'use strict'; |
|||
|
|||
const yeoman = require('yeoman-environment'); |
|||
const npm = require('npm'); |
|||
const path = require('path'); |
|||
const temp = require('../../src/temp'); |
|||
|
|||
const env = yeoman.createEnv(); |
|||
|
|||
module.exports = (args, done) => { |
|||
// For initializing a project, the preset is not installed in the project.
|
|||
// Rather, we install it ourselves into a temp directory and invoke from there.
|
|||
const tempDir = temp(); |
|||
const packageName = args.packageName; |
|||
|
|||
npm.load({ loglevel: 'silent' }, (err, npm) => { |
|||
if (err) { |
|||
console.error(err); |
|||
return done(1); |
|||
} |
|||
|
|||
const pkg = path.join(tempDir, 'node_modules', packageName.startsWith('@') || !packageName.includes(path.sep) ? |
|||
packageName : |
|||
path.basename(packageName)); |
|||
|
|||
npm.commands.install(tempDir, [packageName], (err) => { |
|||
if (err) { |
|||
console.error(err); |
|||
return done(1); |
|||
} |
|||
|
|||
env.register(pkg, 'neutrino:init'); |
|||
env.run('neutrino:init', done); |
|||
}); |
|||
}); |
|||
}; |
File diff suppressed because it is too large
Loading…
Reference in new issue