Comparing version 1.0.5 to 1.0.6
@@ -1,6 +0,73 @@ | ||
import process from 'process'; | ||
#!/usr/bin/env node | ||
console.log(process.argv); | ||
// if(process.argv[2]) | ||
const process = require('process'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const assert = require('assert'); | ||
const execSync = require('child_process').execSync; | ||
const cmd = process.argv[2]; | ||
const vmmPath = path.resolve(path.parse(process.argv[1]).dir, fs.readlinkSync(process.argv[1]), '../..'); | ||
const vmmJson = require(path.join(vmmPath, 'package.json')); | ||
function showHelp() { | ||
console.log(`vmm: Vue MicroService Modules ${vmmJson.version} | ||
Usage: | ||
vmm release | ||
vmm init [project | module] | ||
`); | ||
} | ||
try { | ||
switch (cmd) { | ||
case 'init': | ||
break; | ||
case 'release': | ||
release(); | ||
break; | ||
default: { | ||
showHelp(); | ||
} | ||
} | ||
} catch (e) { | ||
console.log('Error: ', e.message); | ||
} | ||
function _updateJsonVersion(file, ver) { | ||
const json = JSON.parse(fs.readFileSync(file, 'utf8')); | ||
json.version = ver; | ||
fs.writeFileSync(file, JSON.stringify(json, null, 2)); | ||
} | ||
function release() { | ||
// if (!fs.existsSync('./module.json')) return console.log('"module.json" not existed! please in module dir'); | ||
assert(fs.existsSync('./module.json'), 'aa'); | ||
const modJson = JSON.parse(fs.readFileSync('./module.json', 'utf8')); | ||
const vers = modJson.version.split('.'); | ||
const newVer = `${vers[0]}.${vers[1]}.${Number(vers[2]) + 1}`; | ||
// 更新所有项目工程版本,构建新版本 | ||
_updateJsonVersion('./module.json', newVer); | ||
if (modJson.packages.html) { | ||
modJson.packages.html.forEach(name => { | ||
_updateJsonVersion(`./${name}/package.json`, newVer); | ||
console.log(`=== BUILD ${name} ===`); | ||
execSync(`cd ${name} && yarn build`); | ||
}); | ||
} | ||
if (modJson.packages.service) { | ||
modJson.packages.service.forEach(name => { | ||
_updateJsonVersion(`./${name}/package.json`, newVer); | ||
_updateJsonVersion(`./${name}/api/package.json`, newVer); | ||
execSync(`cd ${name}; yarn build`); | ||
}); | ||
} | ||
// 提交 git | ||
execSync(`git commit -a -m "release version:${newVer}"`); | ||
execSync(`git tag ${newVer}`); | ||
execSync(`git push --all --progress`); | ||
execSync(`git push --tags --progress`); | ||
console.log('SUCESSED: release new version: ', newVer); | ||
} | ||
// VMM_PATH=$(dirname $(dirname $0)/$(readlink $0))/.. | ||
@@ -7,0 +74,0 @@ // VMM_PKG=$VMM_PATH/package.json |
{ | ||
"name": "@vmm/cli", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "vmm cli interface", | ||
@@ -5,0 +5,0 @@ "author": { |
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
3278
91
3
1