CLI executable
FND opened this issue · comments
For various reasons, it makes sense for this project to provide its own CLI executable, independent of faucet - most notably due to #11 (comment).
This would also help separating implementation from instances.
Of course naming that command would require finding a permanent name for this project...
I think it makes sense to offer easy faucet integration, but make it optional. By default you don't have a faucet.config.js
, only a insert_name.config.js
. This will in the background use faucet, without the user noticing (generating the faucet config in a similar way to the complate example linked above). In addition, I want to offer users a way to also compile things (like CSS and JS) with faucet. I'm thinking: Maybe they can just write a faucet.config.js
and this package will pick it up and merge it with the config it determined itself. Therefore running the executable of this package will also run your favorite asset pipeline. What do you think?
Yeah, the complate-cli excutable above uses faucet-core's parseCLI
, which already reads faucet.config.js
(non-optional at the moment though). So the executable here might look somewhat like this:
let faucet = require("faucet-pipeline-core");
let parseCLI = require("faucet-pipeline-core/lib/cli");
let { referenceDir, config, options } = parseCLI({ optionalConfig: true });
config.styleguide = [{ … }]; // inject our own configuration
faucet(referenceDir, config, options);
How does it work (let's call the executable styleguide
, and the config styleguide.config.js
for now):
- You run it with
styleguide ./target
. The argument is the directory were the generated files should be written to (it defaults to./dist
). It loads a file calledstyleguide.config.js
that contains the title, description and (human) language of the styleguide. It also contains the page structure, there are two options:- The structure in code (as it is now)
- By scanning a directory (will be implemented in #5)
- Optional: If you want to use other features of faucet-pipeline (like building CSS and JS), then you can also add a
faucet.config.js
. It will be loaded automatically and you don't need to runfaucet
separately. This will be handled in #15
When watching, changing styleguide.config.js should trigger a rebuild without needing to restart the process.
CLI Options:
--watch
,--fingerprint
,--compact
and--sourcemaps
from faucet-pipeline--serve $PORT
and--livereload $PORT
will be implemented in #11
Done 👍