Skip to content

Commit 35eb4f2

Browse files
committed
chore: some fixes
1 parent 1021b89 commit 35eb4f2

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

packages/@vuepress/cli/index.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,28 @@ exports.bootstrap = function ({
3535

3636
cli
3737
.version(pkg.version)
38+
.help()
3839

3940
cli
4041
.command('dev [targetDir]', 'start development server')
41-
.option('-p, --port <port>', 'use specified port (default: 8080)')
42-
.option('-h, --host <host>', 'use specified host (default: 0.0.0.0)')
43-
.option('-t, --temp <temp>', 'set the directory of the temporary file')
44-
.option('-c, --cache <cache>', 'set the directory of cache')
42+
.option('-p, --port [port]', 'use specified port (default: 8080)')
43+
.option('-h, --host [host]', 'use specified host (default: 0.0.0.0)')
44+
.option('-t, --temp [temp]', 'set the directory of the temporary file')
45+
.option('-c, --cache [cache]', 'set the directory of cache')
4546
.option('--no-cache', 'clean the cache before build')
4647
.option('--debug', 'start development server in debug mode')
4748
.option('--silent', 'start development server in silent mode')
48-
.action((sourceDir = '.', {
49-
host,
50-
port,
51-
debug,
52-
temp,
53-
cache,
54-
silent
55-
}) => {
49+
.action((sourceDir = '.', options) => {
50+
const {
51+
host,
52+
port,
53+
debug,
54+
temp,
55+
cache,
56+
silent
57+
} = options
5658
logger.setOptions({ logLevel: silent ? 1 : debug ? 4 : 3 })
59+
logger.debug('options', options)
5760
env.setOptions({ isDebug: debug, isTest: process.env.NODE_ENV === 'test' })
5861

5962
wrapCommand(dev)(path.resolve(sourceDir), {
@@ -68,20 +71,22 @@ exports.bootstrap = function ({
6871

6972
cli
7073
.command('build [targetDir]', 'build dir as static site')
71-
.option('-d, --dest <dest>', 'specify build output dir (default: .vuepress/dist)')
72-
.option('-t, --temp <temp>', 'set the directory of the temporary file')
73-
.option('-c, --cache <cache>', 'set the directory of cache')
74+
.option('-d, --dest [dest]', 'specify build output dir (default: .vuepress/dist)')
75+
.option('-t, --temp [temp]', 'set the directory of the temporary file')
76+
.option('-c, --cache [cache]', 'set the directory of cache')
7477
.option('--no-cache', 'clean the cache before build')
7578
.option('--debug', 'build in development mode for debugging')
7679
.option('--silent', 'build static site in silent mode')
77-
.action((sourceDir = '.', {
78-
debug,
79-
dest,
80-
temp,
81-
cache,
82-
silent
83-
}) => {
80+
.action((sourceDir = '.', options) => {
81+
const {
82+
debug,
83+
dest,
84+
temp,
85+
cache,
86+
silent
87+
} = options
8488
logger.setOptions({ logLevel: silent ? 1 : debug ? 4 : 3 })
89+
logger.debug('options', options)
8590
env.setOptions({ isDebug: debug, isTest: process.env.NODE_ENV === 'test' })
8691

8792
wrapCommand(build)(path.resolve(sourceDir), {
@@ -103,7 +108,6 @@ exports.bootstrap = function ({
103108
})
104109

105110
// output help information on unknown commands
106-
// Listen to unknown commands
107111
cli.on('command:*', () => {
108112
console.error('Unknown command: %s', cli.args.join(' '))
109113
console.log()

packages/@vuepress/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"chalk": "^2.3.2",
3232
"semver": "^5.5.0",
33-
"cac": "^6.3.2"
33+
"cac": "^6.3.3"
3434
},
3535
"peerDependencies": {
3636
"@vuepress/core": "^1.0.0-alpha.1"

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,9 +1681,9 @@ byline@^5.0.0:
16811681
version "5.0.0"
16821682
resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1"
16831683

1684-
cac@^6.3.2:
1685-
version "6.3.2"
1686-
resolved "https://registry.yarnpkg.com/cac/-/cac-6.3.2.tgz#7578e161670abac154812860b2951782c32192a7"
1684+
cac@^6.3.3:
1685+
version "6.3.3"
1686+
resolved "https://registry.yarnpkg.com/cac/-/cac-6.3.3.tgz#01e56f50068bd1be326b1612950d77d31112400d"
16871687

16881688
cacache@^10.0.4:
16891689
version "10.0.4"

0 commit comments

Comments
 (0)