我使用commander创建一个小程序来生成一个小应用程序模式。
我使用ncp将我的文件复制到新目录中,该目录运行正常,该程序包仅用于全局安装,没有其他模块依赖于此目录。问题是我最后获得4730下载,但我只下载了2到3次。
var program = require('commander')
, pkg = require('../package.json')
, version = pkg.version
, create_project = require('./create_project')
, create_bundle = require('./create_bundle')
, create_entities = require('./create_entities')
;
// commander
program
.version(version)
.option('-f, --force', 'force on non-empty directory')
program
.command('create:project <name>')
.description('create a new project')
.action(function(name){
create_project.do(name);
})
;
program
.command('create:bundle <name>')
.description('create a new bundle in your project')
.action(function(name){
create_bundle.do(name);
})
;
program
.command('create:database')
.description('create the database --- note : you need first to update your config/db.js file')
.action(function(){
create_entities.database();
})
;
program
.command('entity:update <name>')
.description('update entity <name> ')
.action(function(name){
create_entities.do(name);
})
;
program.parse(process.argv);