@dkshs/pkg-test v1.1.0
dkcutter
A command-line utility that creates projects from templates.
Overview
DKCutter takes a template provided as a directory structure with template-files. Templates can be located on the file system, such as on a VCS (Git) server like GitHub.
It reads a settings file and interactively prompts the user whether or not to change the settings.
It then takes both and generates an output directory structure from them.
Additionally, the model can provide code (Javascript) to be executed before and after generation (pre-generation and post-generation hooks).
Input
This is a directory structure for a simple dkcutter:
dkcutter-something/
├── template/
│ ├── {{projectSlug}}/ <------ Project template
├── hooks/ <------ JavaScript to be executed before and after generation
│ ├── preGenProject.js
│ └── postGenProject.js
├── blah.txt <------ Non-templated files/dirs
│ go outside
│
└── dkcutter.json <------ Prompts & default valuesYou must have:
- A
dkcutter.jsonfile - A
template/{{projectSlug}}/directory, whereprojectSlugis defined in yourdkcutter.json.
Beyond that, you can have whatever files/directories you want.
Output
This is what will be generated locally, in your current directory:
mysomething/ <-------- Value corresponding to what you enter at the
│ projectSlug prompt
│
└── ... <-------- Files corresponding to those in your
dkcutter's `{{ projectSlug }}/` dirGetting Started
For Users
The recommended way to use DKCutter as a command line utility is to execute it with pnpm dlx, npx, yarn dlx or bunx.
Use a GitHub template
pnpm dlx dkcutter https://github.com/dkshs/dkcutter-nextjs.gitUse a local template
pnpm dlx dkcutter ./dkcutter-nextjsDetailed Usage
- Generate projects from local or remote templates.
- Customize projects with
dkcutter.jsonprompts. - Utilize pre- and post-generate hooks.
For Template Creators
- Utilize unlimited directory nesting.
- Employ nunjucks for all templating needs.
- Define template variables easily with
dkcutter.json.