ps-gen

0.0.4 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i ps-gen

Weekly Downloads

0

Version

0.0.4

License

UNLICENSED

Unpacked Size

59 kB

Total Files

15

Last publish

Collaborators

  • doooss