@wgoo/cli
Version:
Wgoo Cli 是一个 React 组件库构建工具,通过 Wgoo Cli 可以快速搭建一套功能完备的 React 组件库。
67 lines (53 loc) • 1.81 kB
JavaScript
const { program } = require('commander');
const packageJson = require('../package.json');
// commands
const { dev } = require('./commands/dev');
const { lint } = require('./commands/lint');
const { test } = require('./commands/jest');
const { clean } = require('./commands/clean');
const { build } = require('./commands/build');
const { release } = require('./commands/release');
const { changelog } = require('./commands/changelog');
const { buildSite } = require('./commands/build-site');
const { commitLint } = require('./commands/commit-lint');
program.version(`@wgoo/cli ${packageJson.version}`);
process.env.WGOO_CLI_VERSION = packageJson.version;
program.command('dev')
.description('Run webpack dev server')
.action(dev);
program.command('lint')
.description('Run eslint and stylelint')
.action(lint);
program.command('test')
.description('Run unit tests through jest')
.option(
'--watch',
'Watch files for changes and rerun tests related to changed files'
)
.option(
'--clearCache',
'Clears the configured Jest cache directory and then exits'
)
.action(test);
program.command('clean')
.description('Clean all dist files')
.action(clean);
program.command('build')
.description('Compile components in production mode')
.option('--watch', 'Watch file change')
.action(build);
program.command('release')
.description('Compile components and release it')
.option('--tag <tag>', 'Release tag')
.action(release);
program.command('build-site')
.description('Compile site in production mode')
.action(buildSite);
program.command('changelog')
.description('Generate changelog')
.action(changelog);
program.command('commit-lint <gitParams>')
.description('Lint commit message')
.action(commitLint);
program.parse();