提交 c004fb34 编写于 作者: U ULIVZ

feat: extract @vuepress/cli

上级 f1e6dd4a
__tests__
__mocks__
\ No newline at end of file
# @vuepress/cli
> cli for vuepress
\ No newline at end of file
#!/usr/bin/env node
const chalk = require('chalk')
const semver = require('semver')
const requiredVersion = require('../package.json').engines.node
try {
require.resolve('@vuepress/core')
} catch (err) {
console.log(chalk.red(
`\n[vuepress] @vuepress/cli ` +
`requires @vuepress/core to be installed.\n`
))
process.exit(1)
}
const pkg = require('@vuepress/core/package.json')
const requiredVersion = pkg.engines.node
if (!semver.satisfies(process.version, requiredVersion)) {
console.log(chalk.red(
......@@ -14,12 +24,12 @@ if (!semver.satisfies(process.version, requiredVersion)) {
}
const path = require('path')
const { dev, build, eject } = require('../lib')
const { dev, build, eject } = require('@vuepress/core')
const program = require('commander')
program
.version(require('../package.json').version)
.version(pkg.version)
.usage('<command> [options]')
program
......@@ -94,12 +104,6 @@ enhanceErrorMessages('optionMissingArgument', (option, flag) => {
)
})
program.parse(process.argv)
if (!process.argv.slice(2).length) {
program.outputHelp()
}
function wrapCommand (fn) {
return (...args) => {
return fn(...args).catch(err => {
......@@ -108,3 +112,11 @@ function wrapCommand (fn) {
})
}
}
exports.program = program
exports.bootstrap = function () {
program.parse(process.argv)
if (!process.argv.slice(2).length) {
program.outputHelp()
}
}
{
"name": "@vuepress/cli",
"version": "1.0.0",
"description": "cli for vuepress",
"main": "index.js",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
},
"keywords": [
"documentation",
"vue",
"vuepress",
"generator"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vuepress/issues"
},
"peerDependencies": {
"@vuepress/core": "^1.0.0"
},
"homepage": "https://github.com/vuejs/vuepress/packages/@vuepress/cli#readme"
}
\ No newline at end of file
......@@ -3,9 +3,6 @@
"version": "1.0.0",
"description": "Minimalistic doc generator with Vue component based layout system",
"main": "lib/index.js",
"bin": {
"vuepress": "bin/vuepress.js"
},
"scripts": {
"lint": "eslint --fix --ext .js,.vue bin/ lib/ test/",
"prepublishOnly": "conventional-changelog -p angular -r 2 -i CHANGELOG.md -s",
......
__tests__
__mocks__
\ No newline at end of file
# @vuepress/plugin-docs
> docs plugin for vuepress
\ No newline at end of file
{
"name": "@vuepress/plugin-docs",
"version": "1.0.0",
"description": "docs plugin for vuepress",
"main": "index.js",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
},
"keywords": [
"documentation",
"vue",
"vuepress",
"generator"
],
"author": "Evan You",
"license": "MIT",
"bugs": {
"url": "https://github.com/vuejs/vuepress/issues"
},
"homepage": "https://github.com/vuejs/vuepress/packages/@vuepress/plugin-docs#readme"
}
\ No newline at end of file
const testPlugin = require('@vuepress/plugin-test')
module.exports = {
dest: 'vuepress',
locales: {
......@@ -26,11 +24,6 @@ module.exports = {
['meta', { name: 'msapplication-TileColor', content: '#000000' }]
],
serviceWorker: true,
theme: 'default',
plugins: [
testPlugin,
'translation-ui',
],
themeConfig: {
repo: 'vuejs/vuepress',
editLinks: true,
......
......@@ -22,9 +22,6 @@
},
"homepage": "https://github.com/vuejs/vuepress#readme",
"devDependencies": {
"@vuepress/core": "^1.0.0",
"@vuepress/theme-default": "^1.0.0",
"@vuepress/plugin-test": "^1.0.0",
"@vuepress/plugin-translation-ui": "^1.0.0"
"vuepress": "^1.0.0"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册