Create a flow to generate redundant code and save time.
Using a YAML configuration file and template files you are able to create any piece of code. Example
Action configurtion params can access previous variable using #{VAR_NAME_HERE}
You can access the process execution path using : #{__dirname}
Action to ask a question and store its answer inside a variable.
- ask:
for: 'your phrase/question ?'
variable: 'YOUR_VAR_NAME'
default_value: null
Action to perform file/folder creation.
- create:
type: 'folder'
outputPath: '#{OUTPUT_PATH}'
foldername: '#{COMPONENT_NAME}'
recursive: false
Template params is optional. If no template file is provided the output file will be empty.
Template file example:
here is my template file #{ACCESS_MY_NAME_VAR_HERE}
const #{COMPONENT_NAME} = () => {}
function <#{FUNCTION_TYPES}>(#{FUNCTION_ARG_1}, #{FUNCTION_ARG_2}) {
//
}
even simple text works #{MY_VAR}
- create:
type: 'file'
template: '#{__dirname}/component/barrel.tpl'
outputPath: '#{OUTPUT_PATH}/#{COMPONENT_NAME}'
filename: 'index.ts'
Action to perform a search on disk and assign the result in a variable.
- search:
for: 'your phrase/question here'
type: 'folder' # currently the only type supported (later: file)
variable: 'FOLDER_FOUND'
root: '#{__dirname}' # current process execution path
template:
# actions here
- ask:
# config var here
- search:
# config var here
- create:
# config var here