Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vmm/cli

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vmm/cli - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

73

js/vmm.js

@@ -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

2

package.json
{
"name": "@vmm/cli",
"version": "1.0.5",
"version": "1.0.6",
"description": "vmm cli interface",

@@ -5,0 +5,0 @@ "author": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc