Skip to content

Commit 12ed72e

Browse files
karenielgoto-bus-stop
authored andcommitted
add configuration usage to cli (#437)
* 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 []
1 parent 795e6a6 commit 12ed72e

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

bin.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ var USAGE = `
3636
Compile all files in the project to disk
3737
${clr('$ bankai build index.js', 'cyan')}
3838
39+
For configuration usage, type 'bankai --help config'
40+
3941
Running into trouble? Feel free to file an issue:
4042
${clr('https://github.com/choojs/bankai/issues/new', 'cyan')}
4143
@@ -53,6 +55,49 @@ var NOCOMMAND = `
5355
Run ${clr('bankai --help', 'cyan')} to see all options.
5456
`.replace(/\n$/, '').replace(/^\n/, '')
5557

58+
var CONFIG_USAGE = `
59+
60+
${clr('Configuration', 'bold')}
61+
62+
63+
Bankai is built on top of compilers for scripts, styles and documents.
64+
Each of them can be configured by adding a field to your project's
65+
package.json file.
66+
67+
These three fields are, respectively: ${clr('"browserify"', 'cyan')}, ${clr('"sheetify"', 'cyan')} and
68+
${clr('"documentify"', 'cyan')}. Each one should have a configuration object as it's value.
69+
70+
There is currently one possible configuration field: "transform".
71+
72+
It can be one of either:
73+
74+
1. An array of transform names.
75+
ie: ${clr('[ "vueify" ]', 'cyan')}
76+
2. An array of tuples transform name + configuration object.
77+
ie: ${clr('[[ "vueify", { "sass": { "includePaths": [ "src/assets/css" ] } } ]]', 'cyan')}
78+
79+
80+
Full example:
81+
82+
${clr(`{
83+
"browserify": {
84+
"transform": [
85+
[ "vueify", { "sass": { "includePaths": [ "src/assets/css" ] } } ]
86+
]
87+
},
88+
"sheetify": {
89+
"transform": [
90+
"sheetify-cssnext"
91+
]
92+
},
93+
"documentify": {
94+
"transform": [
95+
[ "posthtmlify", { "use": [ "posthtml-custom-elements" ] } ]
96+
]
97+
}
98+
}`, 'cyan')}
99+
`.replace(/\n$/, '').replace(/^\n/, '')
100+
56101
var argv = minimist(process.argv.slice(2), {
57102
alias: {
58103
help: 'h',
@@ -78,6 +123,7 @@ var argv = minimist(process.argv.slice(2), {
78123
}
79124

80125
if (argv.help) {
126+
if (cmd === 'config') return console.log(CONFIG_USAGE)
81127
console.log(USAGE)
82128
} else if (argv.version) {
83129
console.log(require('./package.json').version)

0 commit comments

Comments
 (0)