0.7.0 • Published 10 months ago

create-ts-init v0.7.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

create-ts-init

npm version NPM npm

create-ts-init is a simple and opinionated boilerplate generator for Node.js-based ESM TypeScript projects. Spend less time configuring new projects with this CLI tool.

Installation / Usage

You can use your favorite package manager to download and run the generator, and your choice will also be respected when the CLI installs dependencies.

npm

npx create-ts-init@latest

pnpm

pnpx create-ts-init@latest

yarn

yarn create ts-init

Arguments

You can supply a project name as a command argument and any additional flags to customize the tool's behavior.

create-ts-init [options] [project-name]
ArgumentDescription
project-nameName of the new project

OptionDescription
-e, --extrasUse default extras
--no-extrasDo not use extras
-u, --updateCheck for and apply dependency updates
--no-updateDo not check for dependency updates
-i, --installInstall dependencies
--no-installDo not install dependencies
-g, --gitInitialize a Git repository
--no-gitDo not initialize a Git repository
-h, --helpDisplay help for the command

Global Install

You can also use any of these to install create-ts-init globally. This links a binary that can be used without redownloading.

You will still be notified of new versions, but you will have to update manually to get the latest features.

Example:

npm install -g create-ts-init

create-ts-init

Sample Output

Example of a new project generated using both eslint-prettier and jest extras:

my-ts-app/
├── src/
│   └── index.ts
├── tests/
│   └── index.test.ts
├── .eslintrc.json
├── .gitignore
├── .prettierignore
├── .prettierrc.json
├── jest.config.js
├── package.json
├── tsconfig.build.json
└── tsconfig.json

Features

Minimal base

create-ts-init is designed to be fully modular. The base template is minimal and contains only what is necessary to compile and run TypeScript code. Additional functionality must be enabled through the prompts, including code style enforcement using ESLint and Prettier.

Additional features can be scaffolded to a new application through use of modules (or extras).

Update checking

When creating a new application, you will be asked if you want to automatically check for package updates. The CLI will then use the npm-check-updates tool to apply the latest versions directly to your new package.json while respecting their original semver rules.

Extra Modules

When generating your application, you will be able to select any of the following extras:

eslint-prettier

Adds configuration for your project to use ESlint and Prettier alongside each other. Scripts are added to package.json to manually check and enforce code style, especially if you don't have the related editor extensions.

ESlint is configured with some sensible defaults including the typescript-eslint parser.

jest

Adds Jest to your project configured with the ts-jest transformer to directly run .ts tests without needing to include them in your builds. Scripts are added to package.json, but it will also work out of the box with npx jest.

By default, tests are configured to run in ./tests/.

Planned features

  • Command arguments/flags
  • Support for more modules

Contributing

Contributions are welcome! If you find a bug or have an idea for a new feature, feel free to open an issue or submit a pull request.

To get started, clone this repository and install dependencies using npm:

git clone https://github.com/nomnivore/create-ts-init.git
cd create-ts-init
npm install

Compile the application into ./dist:

npm run build

You can then run the tool locally using:

npm start

Or install it globally (to use in other directories):

npm install -g .

create-ts-init

License

create-ts-init is licensed under the MIT License.

0.7.0

10 months ago

0.6.0

10 months ago

0.5.0

1 year ago

0.5.1

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago