feat(cli): using postmessage (#8497)

* feat(cli): export action functions

* fix: listenToSyncPath

* fix: config.site.simulatorUrl
This commit is contained in:
neverland
2021-04-10 15:44:55 +08:00
committed by GitHub
parent a066e3a4bb
commit f46f59fce2
6 changed files with 116 additions and 72 deletions
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env node
import { command, parse, version } from 'commander';
import {
dev,
lint,
test,
clean,
build,
release,
changelog,
buildSite,
commitLint,
cliVersion,
} from '.';
version(`@vant/cli ${cliVersion}`);
command('dev').description('Run webpack dev server').action(dev);
command('lint').description('Run eslint and stylelint').action(lint);
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);
command('clean').description('Clean all dist files').action(clean);
command('build')
.description('Compile components in production mode')
.option('--watch', 'Watch file change')
.action(build);
command('release')
.description('Compile components and release it')
.option('--tag <tag>', 'Release tag')
.action(release);
command('build-site')
.description('Compile site in production mode')
.action(buildSite);
command('changelog').description('Generate changelog').action(changelog);
command('commit-lint <gitParams>')
.description('Lint commit message')
.action(commitLint);
parse();
+13 -46
View File
@@ -1,10 +1,5 @@
#!/usr/bin/env node
import { command, parse, version } from 'commander';
// @ts-ignore
import packageJson from '../package.json';
// commands
import { dev } from './commands/dev';
import { lint } from './commands/lint';
import { test } from './commands/jest';
@@ -15,46 +10,18 @@ import { changelog } from './commands/changelog';
import { buildSite } from './commands/build-site';
import { commitLint } from './commands/commit-lint';
version(`@vant/cli ${packageJson.version}`);
export const cliVersion: string = packageJson.version;
process.env.VANT_CLI_VERSION = packageJson.version;
process.env.VANT_CLI_VERSION = cliVersion;
command('dev').description('Run webpack dev server').action(dev);
command('lint').description('Run eslint and stylelint').action(lint);
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);
command('clean').description('Clean all dist files').action(clean);
command('build')
.description('Compile components in production mode')
.option('--watch', 'Watch file change')
.action(build);
command('release')
.description('Compile components and release it')
.option('--tag <tag>', 'Release tag')
.action(release);
command('build-site')
.description('Compile site in production mode')
.action(buildSite);
command('changelog').description('Generate changelog').action(changelog);
command('commit-lint <gitParams>')
.description('Lint commit message')
.action(commitLint);
parse();
export {
dev,
lint,
test,
clean,
build,
release,
changelog,
buildSite,
commitLint,
};