@wroud/ts-template is a CLI tool that simplifies the setup of TypeScript projects and tsconfig files. It provides commands to quickly initialize a new TypeScript project or create a base tsconfig configuration with customizable options.
- Quick Setup: Easily create new TypeScript projects or
tsconfigfiles with a single command. - ECMAScript Targeting: Choose from multiple ECMAScript targets (e.g.,
esnext,es2022). - Immutable Mode: Preview changes without modifying files.
- Verbose Mode: Get detailed output for better debugging.
Install via npm:
npm install -D @wroud/ts-templateInstall via yarn:
yarn add -D @wroud/ts-templateLet's say you run the following command inside the directory ~/docs/project/packages/@my-scope/tsconfig:
# Create a new project with a base tsconfig targeting ESNext
ts-template tsconfigThis command will:
- Initialize a project using Yarn (currently, only Yarn is supported as the package manager) with the name
@my-scope/tsconfig. - Create a base
tsconfig.jsonfile in the project.
Now, let's imagine you run the following command inside the directory ~/docs/project/packages/@my-scope/my-package:
# Create a new project that references the tsconfig package from the same scope
ts-template projectThis command will:
- Initialize a new project using Yarn with the name
@my-scope/my-package. - Create a
tsconfig.jsonfile that extends the configuration from@my-scope/tsconfig/tsconfig.json(created in the previous step).
ts-template <command> [options]-
tsconfig [name]: Create a new project with a basetsconfigfile.ts-template tsconfig [name] [options]
-
Positional Arguments:
[name]: Name of the project (defaults to an npm-friendly name based on the current folder).
-
Options:
--immutable, -i: Do not modify files, just print the changes that would be made.--verbose, -v: Print detailed output.--target, -t: Specify the ECMAScript target (choices:esnext,es2022, etc.).
Example:
ts-template tsconfig my-project --target es2022 --verbose
-
-
project [name]: Create a new project that references a basetsconfigpackage.ts-template project [name] [options]
-
Positional Arguments:
[name]: Name of the project (defaults to an npm-friendly name based on the current folder).
-
Options:
--tsconfig, --ts: The name of thetsconfigpackage to link (default:tsconfig).--immutable, -i: Do not modify files, just print the changes that would be made.--verbose, -v: Print detailed output.--target, -t: Specify the ECMAScript target (choices:esnext,es2022, etc.).
Example:
ts-template project my-library --tsconfig tsconfig --target es2022 --immutable
-
--help: Display help for the command.--version: Display the version ofts-template.
For more detailed documentation, visit the documentation site.
All notable changes to this project will be listed in the CHANGELOG file.
This project is licensed under the MIT License. See the LICENSE file for details.