README
@fiad/cli
A simple command line interface that helps in scaffolding and configuring operations
COMMANDS LIST
scaffold
Handles recursive files copying from a source directory to a destination one.
npx @fiad/cli scaffold --src src/path --dest dest/path --context your-module
Params:
- src: the source directory to copy files from (required)
- dest: the destination directory to copy files to (optional, uses cwd as default)
- context: a string that defines the operation context in order to produce more specific log messages (optional)
install
Handles dependencies installation from npm repository.
npx @fiad/cli install --manifest path/to/dependencies.json --yarn --context your-module
Params:
- manifest: the manifest filepath (required)
- yarn: if passed, allows installation via yarn
- context: a string that defines the operation context in order to produce more specific log messages (optional)
JSON manifest schema:
{
"dependencies": [
"gsap",
"lodash"
],
"devDependencies": [
"jest",
"webpack"
]
}
config
Handles package.json updates.
npx @fiad/cli config --add build --value "webpack --mode production" --context scripts --force
npx @fiad/cli config --remove build --context scripts
Params:
- --add: the key of property to be added (required*)
- --remove: the key of property to be remove (required*)
- --context: the parent property path (optional with root level as default)
- --value: the value of the property to be added (available and required in combination with --add only)
- --force: if passed, forces property override (available in combination with --add only)
(*) --add and --remove are reciprocally exclusive, so only one of them is required
wizard
A survey provider to collect user preferences (based on inquirer.js).
npx @fiad/cli wizard --config path/to/config.js
Params:
- config: the configuration filepath (required)
Config file schema:
module.exports = {
header: 'Foo', // header text printed as a figlet banner
headerColor: 'blue',
description: 'Welcome folks!', // a simple prefatory description
descriptionColor: 'yellow',
questions: [
// inquirer questions definition here
],
handler: require('path/to/handler.js')
};
For details about questions definition, check the inquirer.prompt method documentation.
Handler file schema:
module.exports = function (answers) {
console.log(answers);
};