@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
tsconfig
files 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 ts-template
Install via yarn:
yarn add -D ts-template
Let'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 tsconfig
This 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.json
file 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 project
This command will:
- Initialize a new project using Yarn with the name
@my-scope/my-package
. - Create a
tsconfig.json
file 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 basetsconfig
file.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 basetsconfig
package.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 thetsconfig
package 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.