clico v0.1.1
CLICO
CLI Code Orchestrator - Generate JS source code via CLI with pre-defined code templates
CLICO is a CLI interface to provide users to generate JS code using snippets. This is useful when there is a need for eliminating boilerplate using standardized code format. The preset templates can be defined to accept variables and the consuming user is prompted to provide values for these variables, the template is then compiled and injected in a file selected by the user.
Installation
npm install -g clicoUsage example

The above example demonstrates the usage with the action.jst template file defined as:
// example/templates/action.jst
module.exports = `export const {{=clico.functionName}} = () => ({
type: '{{=clico.actionTypeName}}',
payload: {
/* Add data here */
}
});
`After the user input below is the resulting file:
// generatedFiles/helloWorld.js
export const helloWorld = () => ({
type: 'HELLO_WORLD_SET',
payload: {
/* Add data here */
}
});Setup
To setup CLICO for usage in your project, follow the below steps:
- CLICO will search for templates in
templatesfolder by default, to define a custom template directory add config as below, in thepackage.jsonfile
// package.json
"clico": {
"templateDirectory": "mycustomdirectory"
}- Define template files in your template directory, follow the below as an example:
// example/templates/action.jst
module.exports = `export const {{=clico.functionName}} = () => ({
type: '{{=clico.actionTypeName}}',
payload: {
/* Add data here */
}
});In the above example the variables are defined in expressions like {{=clico.myVariableName}}. CLICO parses all the templates and prompts the user to input the values for each of these variables.
- Once you have the above setup, simply type
clicoin your project in the same directory as yourpackage.jsonfile and follow the prompts.