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, Typescript) to be executed before and after generation (pre-generation and post-generation hooks).
This is a directory structure for a simple dkcutter:
dkcutter-something/
├── template/
│ ├── {{dkcutter.projectSlug}}/ <----- Project template
├── hooks/ <----- JavaScript to be executed before and after generation
│ ├── preGenProject.js <----- can also be `.ts`
│ └── postGenProject.js <----- can also be `.ts`
├── blah.txt <----- Non-templated files/dirs go outside
│
└── dkcutter.json <----- Prompts & default values
You must have:
- A
dkcutter.json
file - A
template/{{dkcutter.projectSlug}}/
directory, whereprojectSlug
is defined in yourdkcutter.json
.
Beyond that, you can have whatever files/directories you want.
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 `{{ dkcutter.projectSlug }}/` dir
The recommended way to use DKCutter as a command line utility is to execute it with pnpm dlx
, npx
, yarn dlx
or bunx
.
pnpm dlx dkcutter https://github.com/dkshs/dkcutter-nextjs.git
pnpm dlx dkcutter ./dkcutter-nextjs
- Generate projects from local or remote templates.
- Customize projects with
dkcutter.json
prompts. - Utilize pre- and post-generate hooks.
- Utilize unlimited directory nesting.
- Employ nunjucks for all templating needs.
- Define template variables easily with
dkcutter.json
.
- Cookiecutter - A cross-platform command-line utility that creates projects from project templates, e.g. Python package projects, C projects.
This project is licensed under the MIT License - see the LICENSE file for details