Socket
Socket
Sign inDemoInstall

yu-init

Package Overview
Dependencies
162
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.4 to 1.3.5

webpack-mobile/.babelrc

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
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc