npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

create-ts-node

v1.7.1

Published

Create a new Node.js project that uses Typescript, ESLint and Prettier

Downloads

67

Readme

create-ts-node

npm version CI status

Create a new Node.js application using this template. The template includes TypeScript for type-safety, esbuild for fast builds, ESLint and typescript-eslint for linting and Prettier for code formatting. Tests written with Node.js test runner are also included. Everything is configured to work together out of the box and using modern conventions.

EcmaScript modules are used instead of CommonJS to align with the future of JavaScript and Node.js. This allows to natively use import and export statements and top-level await.

This is a good starting point for all Node.js TypeScript applications. For libraries some adjustments might be needed after creating the project.

Create a new project

Create a new project by running any of the following commands.

# Using npm
npm init ts-node@latest new-app

# Using npx
npx create-ts-node@latest new-app

# Using yarn
yarn create ts-node new-app

# Using pnpm
pnpm create ts-node new-app

The command will create a new project in the new-app directory with the template files. After the project is created, you can navigate to the project directory and start developing.

You can also leave out the project name or specify . to create the project in the current directory. For safety creation is not allowed in an existing directory unless it is empty.

Scoped project names are supported, for example @my-scope/new-app. The directory name will be the same as the project name without the scope.

You can see the available options by running npx create-ts-node --help.

Usage: create-ts-node [options] [project-name]

Create a new TypeScript Node.js project.

Positionals:
  project-name  The name of the created project and its directory
                Can be a scoped package name (e.g. "@scope/project-name")
                (default: the current directory)

Options:
  --package-manager <name>  Force the specified package manager
  -h, --help                Display this help message
  -v, --version             Display the version number

Compatability and supported Node.js versions

Windows, Linux and macOS are supported.

npm, yarn and pnpm are the supported package managers. The template is automatically adjusted based on the package manager used.

The latest version targets the active LTS and current version of Node.js. To create a project for an older version of Node.js, use an older version of this package.

| Node.js version | Package version | | --------------- | --------------- | | 20.x or greater | latest | | 18.x | ^0.4.0 | | 10.x | ^0.2.0 | | 8.x | ^0.1.0 |

You can use an older version easily with npx: npx create-ts-node@^0.4.0 new-app.

Project creation is tested with the combination (matrix) of supported Node.js versions, package managers and operating systems.

Dockerfile in project

A Dockerfile is included in the project to build a Docker image. It is based on the official Node.js image and follows the best practices for Node.js Docker images. You can build the image with npm run docker:build and run it with npm run docker:run. These scripts provide a quick way to test the application in a container.

Having issues?

If there are any issues with the template, please open an issue. To debug issues you can set the environment variable NODE_DEBUG=create-ts-node to get more detailed logs. Output with the variable set should be included in any bug reports.