mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-09 05:16:23 +10:00
feat($plugin): Create basic config for vue-cli vuepress plugin
This commit is contained in:
@@ -5,3 +5,4 @@ node_modules
|
||||
TODOs.md
|
||||
packages/@vuepress/shared-utils/lib/
|
||||
types
|
||||
.vscode
|
||||
@@ -0,0 +1 @@
|
||||
# vue-cli-plugin-vuepress
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = async (api, projectOptions) => {
|
||||
api.extendPackage({
|
||||
scripts: {
|
||||
'docs:dev': 'vuepress dev docs',
|
||||
'docs:build': 'vuepress build docs'
|
||||
},
|
||||
devDependencies: {
|
||||
vuepress: '^1.1.0'
|
||||
}
|
||||
})
|
||||
|
||||
api.render('./template', projectOptions)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
# <%= title %>
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
title: '<%= title %>',
|
||||
description: '<%= description %>'
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = () => {}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@vuepress/vue-cli-plugin-vuepress",
|
||||
"version": "1.1.0",
|
||||
"description": "vue-cli plugin for VuePress",
|
||||
"main": "index.js",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/vuejs/vuepress.git",
|
||||
"directory": "packages/@vuepress/vue-cli-plugin-vuepress"
|
||||
},
|
||||
"keywords": [
|
||||
"vuepress",
|
||||
"vue",
|
||||
"vue-cli",
|
||||
"bootstrap"
|
||||
],
|
||||
"author": "Franck Abgrall",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/vuejs/vuepress/issues"
|
||||
},
|
||||
"homepage": "https://github.com/vuejs/vuepress#readme"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
module.exports = [
|
||||
{
|
||||
type: 'input',
|
||||
name: 'title',
|
||||
message: 'Title',
|
||||
validate: input => !!input
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'description',
|
||||
message: 'Description',
|
||||
validate: input => !!input
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,20 @@
|
||||
const onRead = require('./onRead')
|
||||
const onWrite = require('./onWrite')
|
||||
|
||||
const ID = 'org.vuepress.config'
|
||||
|
||||
module.exports = api => {
|
||||
api.describeConfig({
|
||||
id: ID,
|
||||
name: 'VuePress',
|
||||
description: 'VuePress configuration',
|
||||
link: 'https://vuepress.vuejs.org',
|
||||
files: {
|
||||
config: {
|
||||
js: ['docs/.vuepress/config.js']
|
||||
}
|
||||
},
|
||||
onRead,
|
||||
onWrite
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
module.exports = ({ data }) => ({
|
||||
prompts: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'input',
|
||||
message: 'Title',
|
||||
value: data.config.title
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
type: 'input',
|
||||
message: 'Description',
|
||||
value: data.config.description
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
module.exports = async ({ api, prompts }) => {
|
||||
const result = {}
|
||||
for (const prompt of prompts) {
|
||||
result[`${prompt.id}`] = await api.getAnswer(prompt.id)
|
||||
}
|
||||
|
||||
api.setData('config', result)
|
||||
}
|
||||
Reference in New Issue
Block a user