dkcutter
v4.1.4
Published
A command-line utility that creates projects from templates.
Downloads
615
Readme
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, Typescript) 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/
│ ├── {{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.
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 `{{ dkcutter.projectSlug }}/` dir
Getting 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.git
Use a local template
pnpm dlx dkcutter ./dkcutter-nextjs
Detailed Usage
- Generate projects from local or remote templates.
- Customize projects with
dkcutter.json
prompts. - 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
.
References and inspirations
- Cookiecutter - A cross-platform command-line utility that creates projects from project templates, e.g. Python package projects, C projects.
License
This project is licensed under the MIT License - see the LICENSE file for details