-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.js
35 lines (27 loc) · 894 Bytes
/
generator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* lark - generator.js
* Copyright(c) 2014 mdemo(https://github.com/demohi)
* MIT Licensed
*/
'use strict';
var path = require('path');
module.exports = function(command){
/**
* Requiring yeoman may cost several seconds,
* So we'd like to require it when yeoman is indeed needed
* rather than once this module is required
**/
console.log("Starting yeoman generator, please wait...");
var yeoman = require('generator-lark/node_modules/yeoman-generator');
var env = yeoman();
var root = path.dirname(require.resolve('generator-lark/package.json'));
var cwd = process.cwd();
process.chdir(root);
env.lookup();
process.chdir(cwd);
env.on('error', function(err){
console.error(err);
});
env.larkPkg = require('../../package.json'); //向上两层目录去require lark的package.json
env.run(command);
};