Skip to content

Commit 6356e03

Browse files
committed
update: shorter option name
1 parent 8875c1f commit 6356e03

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ docsify init [path] [--local false] [--theme vue] [--plugins false]
6262
- Type: boolean
6363
- Default: `false`
6464
- Description: Copy `docsify` files to the docs path, defaults to `false` using `cdn.jsdelivr.net` as the content delivery network (CDN). To explicitly set this option to `false` use `--no-local`.
65-
- `--previewRelease` option:
65+
- `--rcMode` option:
6666
- Shorthand: `--rc`
6767
- Type: boolean
6868
- Default: `false`

lib/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require('yargs')
3030
requiresArg: false,
3131
type: 'boolean'
3232
},
33-
previewRelease: {
33+
rcMode: {
3434
alias: 'rc',
3535
default: false,
3636
desc: chalk.gray(y18n.__('init.rc')),
@@ -56,7 +56,7 @@ require('yargs')
5656
type: 'boolean'
5757
}
5858
}),
59-
handler: argv => run.init(argv.path, argv.local, argv.previewRelease, argv.theme, argv.plugins)
59+
handler: argv => run.init(argv.path, argv.local, argv.rcMode, argv.theme, argv.plugins)
6060
})
6161
.command({
6262
command: 'serve [path]',

lib/commands/init.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const fs = require('fs')
44
const cp = require('cp-file').sync
55
const chalk = require('chalk')
6-
const {version: cliVerson} = require('../../package.json')
6+
const {version: cliVersion} = require('../../package.json')
77
const logger = require('../util/logger')
88
const {prompt, MultiSelect} = require('enquirer')
99
const {cwd, exists, pkg, pwd, read, resolve} = require('../util')
@@ -19,7 +19,7 @@ const replaceAll = function (file, tpl, replace) {
1919
}
2020

2121
// eslint-disable-next-line
22-
module.exports = async function (path = '', local, previewRelease, theme, plugins) {
22+
module.exports = async function (path = '', local, rcMode, theme, plugins) {
2323
const msg =
2424
'\n' +
2525
chalk.green('Initialization succeeded!') +
@@ -52,11 +52,11 @@ module.exports = async function (path = '', local, previewRelease, theme, plugin
5252
}
5353
}
5454

55-
await createFile(cwdPath, local, previewRelease, theme, plugins)
55+
await createFile(cwdPath, local, rcMode, theme, plugins)
5656
console.log(msg)
5757
}
5858

59-
async function createFile(path, local, previewRelease, theme, plugins) {
59+
async function createFile(path, local, rcMode, theme, plugins) {
6060
const target = file => resolve(path, file)
6161
const readme = exists(cwd('README.md')) || pwd('template/README.md')
6262
let main = pwd('template/index.html')
@@ -101,11 +101,11 @@ async function createFile(path, local, previewRelease, theme, plugins) {
101101
replace(target(filename), 'repo: \'\'', `repo: '${repo}'`)
102102
}
103103

104-
const {major, prerelease = [], version} = semver.parse(cliVerson) || {}
105-
let resourceVersion = prerelease.length ? version : String(major)
104+
let resourceVersion = 'rc'
106105

107-
if (previewRelease) {
108-
resourceVersion = 'rc'
106+
if (!rcMode) {
107+
const {major, prerelease = [], version} = semver.parse(cliVersion) || {}
108+
resourceVersion = prerelease.length ? version : String(major)
109109
}
110110

111111
replaceAll(target(filename), '__docsifyVersion__', `${resourceVersion}`)

0 commit comments

Comments
 (0)