diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-10-13 23:54:27 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-10-13 23:54:27 +0200 |
commit | 5839d4d8a8360a39e1f62d3fa0a242347180ab1a (patch) | |
tree | 949c513f7797b8750d94760b30aeae49d24477e5 | |
parent | d9c3cb418ac772085fe2cec2769c17ee86bd697c (diff) | |
download | gitbook-5839d4d8a8360a39e1f62d3fa0a242347180ab1a.zip gitbook-5839d4d8a8360a39e1f62d3fa0a242347180ab1a.tar.gz gitbook-5839d4d8a8360a39e1f62d3fa0a242347180ab1a.tar.bz2 |
Improve "gitbook-plugin create" to prompt for title/categories
-rw-r--r-- | packages/gitbook-plugin/src/cli.js | 14 | ||||
-rw-r--r-- | packages/gitbook-plugin/src/create.js | 13 | ||||
-rw-r--r-- | packages/gitbook-plugin/template/.eslintignore | 2 |
3 files changed, 26 insertions, 3 deletions
diff --git a/packages/gitbook-plugin/src/cli.js b/packages/gitbook-plugin/src/cli.js index 33790c2..8349a54 100644 --- a/packages/gitbook-plugin/src/cli.js +++ b/packages/gitbook-plugin/src/cli.js @@ -31,6 +31,10 @@ program .action(function(output, options) { inquirer.prompt([ { + name: 'title', + message: 'title:' + }, + { name: 'name', message: 'name:' }, @@ -41,6 +45,16 @@ program { name: 'github', message: 'github url:' + }, + { + name: 'categories', + message: 'categories:', + type: 'checkbox', + choices: [ + 'analytics', + 'search', + 'content' + ] } ]) .then(answers => { diff --git a/packages/gitbook-plugin/src/create.js b/packages/gitbook-plugin/src/create.js index fa8942f..31edb85 100644 --- a/packages/gitbook-plugin/src/create.js +++ b/packages/gitbook-plugin/src/create.js @@ -7,16 +7,20 @@ const TEMPLATE_DIR = path.resolve(__dirname, '../template'); /** * Create a new plugin * @param {String} outputDir + * @param {String} spec.title * @param {String} spec.name * @param {String} spec.desc + * @param {Array} spec.keywords */ function create(outputDir, spec) { const pkg = { + 'title': `${spec.title}`, 'name': `gitbook-plugin-${spec.name}`, 'description': `${spec.desc}`, + 'version': '0.0.0', 'main': 'index.js', 'browser': './_assets/plugin.js', - 'version': '0.0.0', + 'ebook': './_assets/plugin.js', 'dependencies': { 'gitbook-core': '^' + GITBOOK_VERSION }, @@ -29,10 +33,13 @@ function create(outputDir, spec) { 'gitbook': '>=4.0.0-alpha.0' }, 'scripts': { - 'build-js': 'gitbook-plugin build ./src/index.js ./_assets/plugin.js', - 'prepublish': 'npm run build-js' + 'lint': 'eslint ./', + 'build-website': 'gitbook-plugin build ./src/index.js ./_assets/plugin.js', + 'prepublish': 'npm run build-website', + 'test': 'gitbook-plugin test && npm run lint' }, 'homepage': `${spec.github}`, + 'keywords': spec.categories.map(category => `gitbook:${category}`), 'repository': { 'type': 'git', 'url': `${spec.github}.git` diff --git a/packages/gitbook-plugin/template/.eslintignore b/packages/gitbook-plugin/template/.eslintignore new file mode 100644 index 0000000..1d35cda --- /dev/null +++ b/packages/gitbook-plugin/template/.eslintignore @@ -0,0 +1,2 @@ +# Plugin assets +_assets/plugin.js |