Comparing version 0.0.3 to 1.0.0
#!/usr/bin/env node | ||
var chalk = require('chalk'); | ||
console.log('嗯,启动命令了'); | ||
// style a string | ||
chalk.blue('Hello world!'); | ||
const commander = require('commander'); | ||
const msg = require('../src/utils/msg.js'); | ||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
const version = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf8')).version; | ||
const currentPath = process.cwd(); | ||
// 配置文件 | ||
const GULP_CONFIG = path.join(__dirname, '../src/config/gulpfile.js'); | ||
const SERVER_CONFIG = path.join(__dirname, '../src/config/server.js'); | ||
const WEBPACK_CONFIG = path.join(__dirname, '../src/config/webpack.config.js'); | ||
const PACKAGE_CONFIG = path.join(__dirname, '../src/config/package.json'); | ||
const REAL_GULP_CONFIG = path.join(currentPath, './gulpfile.js'); | ||
const REAL_SERVER_CONFIG = path.join(currentPath, './server.js'); | ||
const REAL_WEBPACK_CONFIG = path.join(currentPath, './webpack.config.js'); | ||
const REAL_PACKAGE_CONFIG = path.join(currentPath, './package.json'); | ||
//文件目录 | ||
const DEFAULT_STATIC = path.join(__dirname, '../src/static'); | ||
const REAL_STATIC = path.join(currentPath, './src'); | ||
commander.version(version) | ||
commander.command('init') | ||
.option('-y --yes') | ||
.description('初始化你的项目,riot-zero将为你准备基本的项目目录和配置文件') | ||
.action(function(params){ | ||
if(!params.yes){ | ||
return msg.error('请添加-y或者--yes参数'); | ||
} | ||
if (!fs.existsSync(REAL_GULP_CONFIG)) { | ||
fs.copySync(GULP_CONFIG, REAL_GULP_CONFIG); | ||
msg.info('gulp配置文件创建成功, 请根据项目情况进行配置'); | ||
} | ||
if (!fs.existsSync(REAL_WEBPACK_CONFIG)) { | ||
fs.copySync(WEBPACK_CONFIG, REAL_WEBPACK_CONFIG); | ||
msg.info('webpack配置文件创建成功, 请根据项目情况进行修改并安装依赖'); | ||
} | ||
if (!fs.existsSync(REAL_SERVER_CONFIG)) { | ||
fs.copySync(SERVER_CONFIG, REAL_SERVER_CONFIG); | ||
msg.info('server配置文件创建成功, 请根据项目情况进行修改并安装依赖'); | ||
} | ||
if (!fs.existsSync(REAL_STATIC)) { | ||
fs.copySync(DEFAULT_STATIC, REAL_STATIC); | ||
msg.info('静态文件目录创建成功'); | ||
} | ||
if (!fs.existsSync(REAL_PACKAGE_CONFIG)) { | ||
fs.copySync(PACKAGE_CONFIG, REAL_PACKAGE_CONFIG); | ||
msg.info('静态文件目录创建成功'); | ||
} | ||
msg.notice('now,你可以运行npm run dev命令,在指定的8007端口查看你的项目。'); | ||
msg.notice('或者,你也可以运行npm run build命令,获取用于线上的代码'); | ||
msg.hehe(); | ||
}) | ||
commander.parse(process.argv); |
{ | ||
"name": "riot-zero", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"bin": { | ||
"qk": "./bin/riot-zero.js" | ||
"zero": "./bin/riot-zero.js" | ||
}, | ||
@@ -18,3 +18,8 @@ "keywords": [], | ||
"chalk": "^1.1.3" | ||
}, | ||
"devDependencies": { | ||
"commander": "^2.10.0", | ||
"fs-extra": "^3.0.1", | ||
"mockjs": "^1.0.1-beta3" | ||
} | ||
} |
@@ -1,1 +0,5 @@ | ||
目前这个包是个空包,请不要下载,后续补充该包 | ||
## 目前这个包是个空包,请不要下载,后续补充该包 | ||
## |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
20578
21
494
2
6
3
3