Skip to content

Commit

Permalink
add configuration usage to cli (#437)
Browse files Browse the repository at this point in the history
* add configuration usage to cli

- add configuration usage text
- check for 'config' cmd when --help is used and output config usage
  text

* Update bin.js

* drop excess []
  • Loading branch information
kareniel authored and goto-bus-stop committed Mar 7, 2018
1 parent 795e6a6 commit 12ed72e
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ var USAGE = `
Compile all files in the project to disk
${clr('$ bankai build index.js', 'cyan')}
For configuration usage, type 'bankai --help config'
Running into trouble? Feel free to file an issue:
${clr('https://github.com/choojs/bankai/issues/new', 'cyan')}
Expand All @@ -53,6 +55,49 @@ var NOCOMMAND = `
Run ${clr('bankai --help', 'cyan')} to see all options.
`.replace(/\n$/, '').replace(/^\n/, '')

var CONFIG_USAGE = `
${clr('Configuration', 'bold')}
Bankai is built on top of compilers for scripts, styles and documents.
Each of them can be configured by adding a field to your project's
package.json file.
These three fields are, respectively: ${clr('"browserify"', 'cyan')}, ${clr('"sheetify"', 'cyan')} and
${clr('"documentify"', 'cyan')}. Each one should have a configuration object as it's value.
There is currently one possible configuration field: "transform".
It can be one of either:
1. An array of transform names.
ie: ${clr('[ "vueify" ]', 'cyan')}
2. An array of tuples transform name + configuration object.
ie: ${clr('[[ "vueify", { "sass": { "includePaths": [ "src/assets/css" ] } } ]]', 'cyan')}
Full example:
${clr(`{
"browserify": {
"transform": [
[ "vueify", { "sass": { "includePaths": [ "src/assets/css" ] } } ]
]
},
"sheetify": {
"transform": [
"sheetify-cssnext"
]
},
"documentify": {
"transform": [
[ "posthtmlify", { "use": [ "posthtml-custom-elements" ] } ]
]
}
}`, 'cyan')}
`.replace(/\n$/, '').replace(/^\n/, '')

var argv = minimist(process.argv.slice(2), {
alias: {
help: 'h',
Expand All @@ -78,6 +123,7 @@ var argv = minimist(process.argv.slice(2), {
}

if (argv.help) {
if (cmd === 'config') return console.log(CONFIG_USAGE)
console.log(USAGE)
} else if (argv.version) {
console.log(require('./package.json').version)
Expand Down

0 comments on commit 12ed72e

Please sign in to comment.