0.0.4 • Published 8 months ago

ps-gen v0.0.4

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
8 months ago

sample-cli

Personal CLI Template Tool Like @turbo/gen

This code was authored by ChatGPT.

How to use

  1. install package (Dev recommand)
    npm i -D ps-gen
  1. Please add ps-gen to the scripts in package.json as follows:
    "scripts":{
        "gen" : "ps-gen"
    }
  1. Please write the following in <project-root>/cli/template/<template-name>/config.json:

ex. root/cli/template/hooks/config.json

{
    "description": "keeping the naming convention (ex use + PascalCase)", 
    "prompts": [
        {
            "type": "input",
            "name": "name",
            "message": "What is the name of the hook?"
        }
    ],
    "baseUrl": "src/hooks",
    "actions": [
        {
            "type": "add",
            "path": "{{name}}/{{name}}.test.ts",
            "templateFile": "test.hbs"
        },
        {
            "type": "add",
            "path": "{{name}}/index.ts",       
            "templateFile": "export.hbs"
        },
        {
            "type": "add",
            "path": "{{name}}/{{name}}.ts",
            "templateFile": "hook.hbs"
        },
        {
            "type": "append", 
            "path": "index.ts",
            "template": "export { default as {{ name }} } from \"./{{ name }}\""
        }
    ]
}   
  1. In the folder where config.json is located, please create the desired template using the .hbs
0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago