@wroud/ts-template

0.5.1 • Public • Published

ts-template

NPM version

@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.

Features

  • 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.

Installation

Install via npm:

npm install -D ts-template

Install via yarn:

yarn add -D ts-template

Example

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:

  1. Initialize a project using Yarn (currently, only Yarn is supported as the package manager) with the name @my-scope/tsconfig.
  2. 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:

  1. Initialize a new project using Yarn with the name @my-scope/my-package.
  2. Create a tsconfig.json file that extends the configuration from @my-scope/tsconfig/tsconfig.json (created in the previous step).

Usage

ts-template <command> [options]

Commands

  • tsconfig [name]: Create a new project with a base tsconfig 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 base tsconfig 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 the tsconfig 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

Global Options

  • --help: Display help for the command.
  • --version: Display the version of ts-template.

Documentation

For more detailed documentation, visit the documentation site.

Changelog

All notable changes to this project will be listed in the CHANGELOG file.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i @wroud/ts-template

Homepage

wroud.dev/

Weekly Downloads

3

Version

0.5.1

License

MIT

Unpacked Size

27.5 kB

Total Files

33

Last publish

Collaborators

  • wroud