Comparing version 1.3.4 to 1.3.5
61
index.js
@@ -8,9 +8,10 @@ #!/usr/bin/env node | ||
program.version('1.3.2'); | ||
program.version('1.3.5'); | ||
program | ||
.arguments('<dir>') | ||
.option('-w --webpack','创建webpack项目') | ||
.arguments('<dir>') | ||
.option('-k --koa','创建koa多进程项目') | ||
.option('-s --server','创建koa单进程项目') | ||
.option('-k --koa','创建koa多进程项目') | ||
.action(callback); | ||
.option('-m --mobile','创建webpack-mobile项目') | ||
.option('-p --pc','创建webpack-pc项目') | ||
.action(callback); | ||
@@ -20,31 +21,33 @@ program.parse(process.argv); | ||
function callback(dir,cmd){ | ||
if(cmd.webpack){ | ||
createDemo(dir,'webpack-demo'); | ||
}else if(cmd.server){ | ||
createDemo(dir,'server-demo'); | ||
}else{ | ||
createDemo(dir,'koa-demo'); | ||
} | ||
if(cmd.koa){ | ||
createDemo(dir,'koa-demo'); | ||
}else if(cmd.server){ | ||
createDemo(dir,'server-demo'); | ||
}else if(cmd.mobile){ | ||
createDemo(dir,'webpack-mobile'); | ||
}else{ | ||
createDemo(dir,'webpack-pc'); | ||
} | ||
} | ||
function createDemo(dir,demoType){ | ||
let root = path.resolve('./',dir); | ||
if(fs.existsSync(root)){ | ||
console.log('目录已存在'); | ||
return; | ||
} | ||
const source = path.resolve(__dirname,demoType); | ||
copyDir(source,root); | ||
let root = path.resolve('./',dir); | ||
if(fs.existsSync(root)){ | ||
console.log('目录已存在'); | ||
return; | ||
} | ||
const source = path.resolve(__dirname,demoType); | ||
copyDir(source,root); | ||
let str = fs.readFileSync( path.resolve(source,'package.json'),'utf8' ); | ||
data = str.replace('test-1',dir); | ||
setTimeout(()=>{ | ||
fs.writeFileSync(path.resolve(root,'package.json'),data); | ||
},100); | ||
let str = fs.readFileSync( path.resolve(source,'package.json'),'utf8' ); | ||
data = str.replace('test-1',dir); | ||
setTimeout(()=>{ | ||
fs.writeFileSync(path.resolve(root,'package.json'),data); | ||
},100); | ||
console.log('\n 已生成项目文件\n'); | ||
console.log(`\n cd ${dir}\n`); | ||
console.log(` 安装npm包:cnpm install\n`); | ||
demoType!='webpack-demo' && console.log(` 安装npm包:cnpm install nodemon -g\n`); | ||
console.log(` 启动项目:cnpm run dev\n`); | ||
console.log('\n 已生成项目文件\n'); | ||
console.log(`\n cd ${dir}\n`); | ||
console.log(` 安装npm包:cnpm install\n`); | ||
/webpack/.test(demoType) && console.log(` 安装npm包:cnpm install nodemon -g\n`); | ||
console.log(` 启动项目:cnpm run dev\n`); | ||
} |
{ | ||
"name": "yu-init", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "", | ||
@@ -18,10 +18,10 @@ "main": "index.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/18022682515/yu-init.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/18022682515/yu-init/issues" | ||
}, | ||
"homepage": "https://github.com/18022682515/yu-init#readme" | ||
} | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/18022682515/yu-init.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/18022682515/yu-init/issues" | ||
}, | ||
"homepage": "https://github.com/18022682515/yu-init#readme" | ||
} |
@@ -19,5 +19,11 @@ # yu-init | ||
### 创建webpack4构建的前端项目(已配置vue,less) | ||
### 创建webpack4构建的移动端项目(已配置vue,less) | ||
``` | ||
yu-init 项目名 -w | ||
``` | ||
yu-init 项目名 -m | ||
``` | ||
### 创建webpack4构建的pc端项目(已配置vue,less) | ||
``` | ||
yu-init 项目名 -p | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59
1113
29
47145
5