Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add configuration usage to cli #437

Merged
merged 3 commits into from
Mar 7, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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" ] } } ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think there's one too many pairs of [] here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, I'll just remove them while merging :)

]
},
"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