Skip to content

Release v5.0.0-rc.1 #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ava.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export default {
module.exports = {
files: ['e2e/**/*.test.js']
}
8 changes: 2 additions & 6 deletions e2e/cli.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Generated by [AVA](https://avajs.dev).
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start [path] Server for SSR␊
docsify generate [path] Docsify's generators [aliases: g]␊
Global Options␊
Expand All @@ -38,7 +37,6 @@ Generated by [AVA](https://avajs.dev).
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start [path] Server for SSR␊
docsify generate [path] Docsify's generators [aliases: g]␊
Global Options␊
Expand All @@ -61,7 +59,6 @@ Generated by [AVA](https://avajs.dev).
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start [path] Server for SSR␊
docsify generate [path] Docsify's generators [aliases: g]␊
Global Options␊
Expand All @@ -81,7 +78,7 @@ Generated by [AVA](https://avajs.dev).

`␊
docsify-cli version:␊
4.4.4
5.0.0-rc.1
`

## shows version information with --version flag
Expand All @@ -90,7 +87,7 @@ Generated by [AVA](https://avajs.dev).

`␊
docsify-cli version:␊
4.4.4
5.0.0-rc.1
`

## rejects promise due to error on passing in an unknown command
Expand All @@ -102,7 +99,6 @@ Generated by [AVA](https://avajs.dev).
Commands:␊
docsify init [path] Creates new docs [aliases: i]␊
docsify serve [path] Run local server to preview site. [aliases: s]␊
docsify start [path] Server for SSR␊
docsify generate [path] Docsify's generators [aliases: g]␊
Global Options␊
Expand Down
Binary file modified e2e/cli.test.js.snap
Binary file not shown.
29 changes: 1 addition & 28 deletions lib/cli.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
const chalk = require('chalk')
const updateNotifier = require('update-notifier')

const pkg = require('../package.json')
const run = require('../lib')

updateNotifier({pkg: pkg}).notify()

const Locales = require('../tools/locales')
const y18n = new Locales()

Expand Down Expand Up @@ -37,7 +34,7 @@ require('yargs')
alias: 't',
default: 'vue',
desc: chalk.gray(y18n.__('init.theme')),
choices: ['vue', 'buble', 'dark', 'pure'],
choices: ['vue'],
nargs: 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no choice for theme now,is it necessary to still hold it?

requiresArg: true,
type: 'string'
Expand Down Expand Up @@ -93,30 +90,6 @@ require('yargs')
}),
handler: argv => run.serve(argv.path, argv.open, argv.port, argv.P, argv.i)
})
.command({
command: 'start [path]',
desc: chalk.gray(y18n.__('start')),
builder: yargs =>
yargs.options({
config: {
alias: 'c',
default: false,
desc: chalk.gray(y18n.__('start.config')),
nargs: 1,
requiresArg: false,
type: 'string'
},
port: {
alias: 'p',
default: 4000,
desc: chalk.gray(y18n.__('start.port')),
nargs: 1,
requiresArg: true,
type: 'number'
}
}),
handler: argv => run.start(argv.path, argv.config, argv.port)
})
.command({
command: 'generate [path]',
aliases: 'g',
Expand Down
20 changes: 12 additions & 8 deletions lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const logger = require('../util/logger')
const {prompt, MultiSelect} = require('enquirer')
const {cwd, exists, pkg, pwd, read, resolve} = require('../util')
const colors = require('ansi-colors')
const semver = require('semver')

const replace = function (file, tpl, replace) {
fs.writeFileSync(file, read(file).replace(tpl, replace), 'utf-8')
Expand Down Expand Up @@ -62,10 +63,11 @@ async function createFile(path, local, theme, plugins) {
const vendor =
exists(cwd('node_modules/docsify')) || pwd('../node_modules/docsify')

cp(resolve(vendor, 'lib/docsify.min.js'), target('vendor/docsify.js'))
cp(resolve(vendor, 'dist/docsify.min.js'), target('vendor/docsify.js'))
cp(resolve(vendor, 'dist/themes/core.css'), target('vendor/themes/core.css'))
cp(
resolve(vendor, `lib/themes/${theme}.css`),
target(`vendor/themes/${theme}.css`)
resolve(vendor, `dist/themes/addons/${theme}.css`),
target(`vendor/themes/addons/${theme}.css`)
)
}

Expand All @@ -75,8 +77,6 @@ async function createFile(path, local, theme, plugins) {
cp(main, target(filename))
cp(pwd('template/.nojekyll'), target('.nojekyll'))

replace(target(filename), 'vue.css', `${theme}.css`)

if (pkg.name) {
replace(
target(filename),
Expand All @@ -103,14 +103,15 @@ async function createFile(path, local, theme, plugins) {
}

const officialPlugins = [
'front-matter',
'search',
'disqus',
'emoji',
'external-script',
'front-matter',
'ga',
'gitalk',
'gtag',
'matomo',
'search',
'zoom-image'
]

Expand Down Expand Up @@ -146,8 +147,11 @@ async function createFile(path, local, theme, plugins) {

replace(target(filename), ' _plugins_', '_plugin'.repeat(answers.length + 1))

const {prerelease = [], major} = semver.parse(version) || {}
const pluginVersion = prerelease.length ? prerelease[0] : String(major)

answers.forEach(plugin => {
const url = `//cdn.jsdelivr.net/npm/docsify@${version[0]}/lib/plugins/${plugin}.min.js`
const url = `//cdn.jsdelivr.net/npm/docsify@${pluginVersion}/dist/plugins/${plugin}.min.js`
replace(target(filename), '_plugin', ` <script src="${url}"></script>\n`)
})

Expand Down
101 changes: 0 additions & 101 deletions lib/commands/start.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module.exports = {
init: require('./commands/init'),
serve: require('./commands/serve'),
start: require('./commands/start'),
generate: require('./commands/generate')
}
14 changes: 7 additions & 7 deletions lib/template/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@rc/dist/themes/core.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@rc/dist/themes/addons/vue.min.css">
</head>
<body>
<div id="app"></div>
Expand All @@ -16,8 +16,8 @@
repo: ''
}
</script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<!-- Docsify rc -->
<script src="//cdn.jsdelivr.net/npm/docsify@rc"></script>
_plugins_
Copy link
Member

@Koooooo-7 Koooooo-7 Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we make an option -rc for the rc version adoption instead of replace it as rc ?
By default we should always build and fetch the standard version like @4 or @5.
And we don't need remove the -rc option when the v5 released also, cuz it will natural support new rc versions in future.
Alternatively, should we expose another option as -v ? by default fetch the standard version. user can use it like -v 4.1, -v 5, -v rc to replace the resources version of docsify.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, it is only an RC version. It will be switched when the official version of v5 is released.

Take --local as an example. If you use the rc version of docsify-cli, it will also use rc resources.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that. I meant that we don't need a cli for rc only, instead, we need cli to support rc version or switch different version resources.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to submit a PR. Similar to plugin selection, you only need to provide the version selection and replacement content.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add-on this change directly or make another one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out a new branch from the current branch.

Copy link
Member

@Koooooo-7 Koooooo-7 Jul 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to submit a PR. Similar to plugin selection, you only need to provide the version selection and replacement content.

I think I had a mistake there, it seems the cli is designed to version specific which sync to docsify version.
Which means user can not use a v5+ cli to generate v4 resources.
I think it make sense to release the rc to match a specific version...
But if we have the v6 rc, this cli of v5 version seems also work tho.
Shall we specific the resource to https://cdn.jsdelivr.net/npm/[email protected] ?

</body>
</html>
10 changes: 5 additions & 5 deletions lib/template/index.local.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="UTF-8">
<meta charset="utf-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="vendor/themes/vue.css">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<link rel="stylesheet" href="vendor/themes/core.min.css">
<link rel="stylesheet" href="vendor/themes/addons/vue.min.css">
</head>
<body>
<div id="app"></div>
Expand Down
Loading