@jlchain/cli-utils
v1.0.13
Published
打包cli工具用到的基础能力
Downloads
16
Maintainers
Readme
cli-utils
cli most commonly used utils
Features
- master branch check
commander
inhanced packagecross-spawn
inhanced package- intelligent npm version manage
Installation
To install cli-utils, use npm
npm install @jlchain/cli-utils
Usage
Methods
import {
branch,
commanderHelper,
packageJson,
spawn,
} from '@jlchain/cli-utils';
// check branch
const b = branch();
if (b !== 'master') {
if (isMaster) {
console.log('please select master branch');
process.exit(1);
}
commanderHelper.initHelp({
desc: 'you can use command as this:',
options: [
{
flags: 'release',
desc: 'version release',
},
{
flags: 'publish',
desc: 'publish to npm',
},
],
});
// get json data of package.json in current project
const { version } = packageJsonn();
console.log(version);
// execute cli command
spawn('tcm -p src/**/*.less -c -s -w');
spawn.sync('yarn start');
commands
# version release
jlchain-cli-utils release
# version options
patch
minor
major
# publish to npm, by default to use https://registry.npmjs.org/
jlchain-cli-utils publish
# publish to npm, custom to use https://registry.npm.taobao.org/
jlchain-cli-utils publish https://registry.npm.taobao.org/