Skip to content

everettmorgan/base-ts

Repository files navigation

Base TypeScript Project

A minimal starter for small TypeScript libraries and packages.

Overview

This repository provides a lightweight TypeScript project with source files in src/, tests in tests/, and compiled output in dist/. It uses Mocha + Chai for testing, NYC for coverage, and ESLint (flat config, Airbnb base + @typescript-eslint).

Prerequisites

  • Node.js (18+ recommended)
  • Yarn 4 (managed by Corepack)

To ensure the correct Yarn version:

corepack enable
corepack prepare yarn@4.9.3 --activate

Quick start

Install dependencies:

  • Using Yarn:
    yarn install

Run tests (lints first, then runs Mocha with coverage):

  • Using Yarn:
    yarn test

Lint the code:

  • Using Yarn:
    yarn lint

View coverage (after running tests):

  • Open coverage/index.html in your browser.

Scripts

  • lint: Lints the TypeScript sources with ESLint.
    yarn lint
  • tests: Runs the test suite with Mocha via ts-node, instrumented by NYC (generates coverage/).
    yarn tests
  • test: Runs lint then tests.
    yarn test
  • test-publish: Dry-run the publish step to verify package contents.
    yarn test-publish
  • publish: Publishes the package (uses npm publish under the hood).
    yarn publish

Project layout

  • src/ — TypeScript source files
  • tests/ — Mocha + Chai tests (via ts-node)
  • dist/ — Compiled output (generated by tsc)
    • dist/types/ — Type declaration files (from declaration: true)
  • coverage/ — Test coverage reports (generated by NYC)
  • tsconfig.json — TypeScript configuration (ESNext target, CommonJS module)
  • eslint.config.cjs — ESLint flat config (Airbnb base + @typescript-eslint)
  • package.json — Project metadata & scripts

Publishing

Before publishing, update placeholders in package.json:

{
  "name": "---name---",
  "description": "---description---",
  "repository": "---repo---"
}
  • Dry-run:
    yarn test-publish
  • Publish:
    yarn publish

Contributing

Feel free to open issues or PRs. Keep edits small and include tests where applicable.

License

See the LICENSE file for license details.

About

A repo that contains my ideal starting point for Typescript projects.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published