Skip to content

Template TypeScript Node.js package with all the CI bells & whistles I commonly use. ✨

License

Notifications You must be signed in to change notification settings

webpro/template-typescript-node-package

 
 

Repository files navigation

Template TypeScript Node Package

A quickstart-friendly TypeScript package with lots of great repository tooling. ✨

All Contributors: 5 Codecov Test Coverage Contributor Covenant License: MIT Sponsor: On GitHub Style: Prettier TypeScript: Strict

Explainer

This template is available for anybody who wants to set up a basic Node application using TypeScript. It sets up the following tooling for you:

  • All Contributors: Tracks various kinds of contributions and displays them in a nicely formatted table in the README.md.
  • ESLint: Static analysis for JavaScript code, configured with typescript-eslint for TypeScript code and other general-use plugins.
  • Markdownlint: Static analysis for Markdown code.
  • pnpm: Disk-efficient package manager alternative.
  • PR Compliance Action: Checks PRs for compliance on chore such as addressing a linked issue and proper title formatting.
  • Prettier: Opinionated formatting for code, run on file save and as a Git commit hook via husky and lint-staged.
  • release-it: Generates changelogs, bumps the package version, and publishes to GitHub and npm based on conventional commits.
  • Renovate: Keeps dependencies up-to-date with PRs, configured to wait a few days after each update for safety.
  • ts-prune: Unused exports detection for TypeScript code.
  • TypeScript: A typed superset of JavaScript, configured with strict compiler options.
  • Vitest: Fast unit tests, configured with coverage tracking.

Setup

First make sure you have the following installed:

To use this template:

  1. Click the Use this template button to create a new repository with the same Git history
  2. Open that repository, such as by cloning it locally or developing in a codespace
  3. Create two tokens in repository secrets:
  4. pnpm install
  5. pnpm run setup
  6. Install the Renovate GitHub App

The setup script removes the ## Explainer and ## Setup from this README.md.

Setup Options

The setup script requires four options to fill out repository details. It will interactively prompt for any that are not provided as a string CLI flag:

  1. repository: The kebab-case name of the repository (e.g. template-typescript-node-package)
  2. title: Title Case title for the repository to be used in documentation (e.g. Template TypeScript Node Package)
  3. owner: GitHub organization or user the repository is underneath (e.g. JoshuaKGoldberg)
  4. description: Sentence case description of the repository (e.g. A quickstart-friendly TypeScript package with lots of great repository tooling. ✨)

Additionally, a --skip-api boolean CLI flag may be specified to prevent the setup script from calling to GitHub APIs for repository hydration. The script normally posts to GitHub APIs to set information such as repository description and branch protections on github.com. Specifying --skip-api prevents those API calls, effectively limiting setup changes to local files in Git. Doing so can be useful to preview what running setup does.

For example, pre-populating all values and skipping API calls:

pnpm run setup --repository "testing-repository" --title "Testing Title" --owner "TestingOwner" --description "Test Description" --skip-api

Tip: after running pnpm run setup with --skip-api, you can always git add -A; git reset --hard HEAD to completely reset all changes.

Usage

npm i template-typescript-node-package
import { greet } from "template-typescript-node-package";

greet("Hello, world!");

Development

See .github/CONTRIBUTING.md. Thanks! 💖

Contributors

Josh Goldberg
Josh Goldberg

🐛 💻 🖋 💡 🤔 🚇 🚧 📦 📆 👀 🛡️ 🔧 ⚠️
Jeff Wen
Jeff Wen

🔧
Paul Esch-Laurent
Paul Esch-Laurent

🔧
NazCodeland
NazCodeland

🔧
John Reilly
John Reilly

🐛 🤔 📣 🚧 💻 👀

💙 This package is based on @JoshuaKGoldberg's template-typescript-node-package.

About

Template TypeScript Node.js package with all the CI bells & whistles I commonly use. ✨

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 82.2%
  • TypeScript 17.3%
  • Shell 0.5%