npm

dkcutter
TypeScript icon, indicating that this package has built-in type declarations

4.1.4 • Public • Published

dkcutter

A command-line utility that creates projects from templates.

license mit NPM version

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, where projectSlug is defined in your dkcutter.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.

Learn More

For Template Creators

  • Utilize unlimited directory nesting.
  • Employ nunjucks for all templating needs.
  • Define template variables easily with dkcutter.json.

Learn More

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

Readme

Keywords

none

Package Sidebar

Install

npm i dkcutter

Weekly Downloads

59

Version

4.1.4

License

MIT

Unpacked Size

94.3 kB

Total Files

11

Last publish

Collaborators

  • dkshs