@tsparticles/cli-create-utils
v4.0.5
Published
tsParticles CLI Utils
Readme
@tsparticles/cli-create-utils
Shared utilities used by @tsparticles/cli-command-create and all modular create-* command packages.
What It Provides
- project scaffold generation (
createProjectTemplate) - interactive prompt helpers (
promptProjectData) - filesystem helpers (
getDestinationDir,getRepositoryUrl, token replacement) - template/package update helpers (
updatePackageFile,copyEmptyTemplateFiles,runInstall,runBuild) - string naming helpers (
capitalize,camelize,dash)
Installation
pnpm add @tsparticles/cli-create-utilsExports
This package re-exports everything from:
src/create-project.tssrc/file-utils.tssrc/prompt-utils.tssrc/string-utils.tssrc/template-utils.ts
Typical Usage
import { Command } from "commander";
import { createProjectTemplate, promptProjectData } from "@tsparticles/cli-create-utils";
const cmd = new Command("shape");
cmd.argument("<destination>");
cmd.action(async destination => {
const data = await promptProjectData({
destination,
nameLabel: "shape",
});
await createProjectTemplate({
description: data.description,
destination: data.destinationPath,
kind: "shape",
name: data.name,
repositoryUrl: data.repositoryUrl,
});
});