This guide explains how to leverage DKCutter's project generation capabilities directly from your JavaScript or TypeScript code (available in versions 4.1.0 and higher).
The dkcutter
function from the dkcutter
package provides a convenient way to generate projects from DKCutter templates within your code. Here's how to use it:
In these examples:
dkcutter-nextjs/
: This references a template located within a local directory structure.gh:ncontiero/dkcutter-nextjs
: This specifies a template located in a public GitHub repository.You can tailor the project generation process by providing options and extra context to the dkcutter
function:
extraContext
: This object allows you to override default template values with your own configurations.options
: This object lets you pass additional options to the generation process. Refer to the DKCutter CLI documentation for a complete list of available options:The dkcutter
function asynchronously returns the final context used during project generation. This context object contains all the resolved values after processing user prompts, extra context, and template logic.
By incorporating DKCutter into your JavaScript/TypeScript projects, you can automate project creation tasks and streamline your development workflow.