A CLI that generate files for your application
- install globaly with
npm i file-gen-cli@latest -g
- Add a folder to hold your templates and gencli.json files
files templates examples here see bellow for gencli configuration here
- Register your cli config with
file-gen-cli register
- Use your cli with
file-gen-cli myCliName
- List clis with
`file-gen-cli list [tag1] [tag2] ...
- Deduce templates from a folder
file-gen-cli deduce <instanceName> [<prefix> <instanceNamePlural>]
When the register is done, and you use file-gen-cli with you cli name as parameter, it will then generate the files.
File gen cli use an heroku hosted server app to manage the configs, see how it works here https://github.com/guignol1981/file-gen-cli-server
Param | definition | default | required | possible values |
---|---|---|---|---|
cliName | name of your cli | true | a string with no spaces | |
description | desc of your config (for public list) | true | ||
token | a jwt to generate new config | true | contact me to get a token | |
fileNameCase | the case of the files name | kebab | false | kebab, camel, pascal, constant, snake |
folderNameCase | the case of the folders name | kebab | false | kebab, camel, pascal, constant, snake |
entityConfigs | an array of entity configs | true | see Entity config bellow |
Param | definition | default | required | possible values |
---|---|---|---|---|
name | the entity name | true | ||
prefix | the entity prefix that can occur in different files template | false | ||
fileConfigs | an array of file configs | true | ||
singularOnly | if there is only singular name occurence in templates | false | false | |
flat | determine if the cli should create a folder for the instance | false | false |
Param | definition | default | required | possible values |
---|---|---|---|---|
name | the file name (the * symbole is replaced by the entity instance name) |
true | ||
template | the template name for the file (no template will generate an empty file) | false | ||
path | path to create the file relative to the instance path | ./ | false |
keywords (* = supported cases) | replaced with |
---|---|
{{SINGULAR_*}} | instance name with specified case |
{{PLURAL_*}} | instance plural name with specified case |
{{PREFIXED_SINGULAR_*}} | instance prefixed name with specified case |
{{PREFIXED_PLURAL_*}} | instance prefixed plural name with specified case |
CAMEL, CAPITAL, CONSTANT, DOT, HEADER, NO, KEBAB (deprecate, use PARAM) PARAM, PASCAL, PATH, SENTENCE, SNAKE,
- Convert to Typescript
- Feel free to suggest features, submit issues or update the documentation!
- Contribute and add your name here!
- Copyright (c) 2019 Vincent Guillemette (github: guignol1981) Licensed under the MIT license.