9.1.1 • Published 8 months ago

@checkdigit/typescript-config v9.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

checkdigit/typescript-config

MIT License

Copyright © 2021–2025 Check Digit, LLC

Introduction

This module contains the standard Check Digit TypeScript configuration, along with our standard build tool builder.

TypeScript Configuration

  • currently requires Node 22.11 or above.
  • emits esnext, with the default libraries, to avoid down-leveling. It is intended that application spec tests pick up any issues with using newer features unavailable in a particular environment. Browsers and Node.js are fast-moving targets, and can add language features at any time.
  • uses the module type of esnext.
  • all compiler options set for maximum strictness.

Builder

builder is a command line tool that generates ESM modules from the TypeScript source. It is intended to be used when publishing a package to NPM, or to bundle a package for deployment. It uses tsc for generating types, and esbuild for generating code.

Note: the require function will be defined as a global variable, to allow dynamic requires by CommonJS submodules. This is not a problem for Node.js, but will cause issues in a browser environment.

Options

  • --type the type of output to generate. Defaults to module (ESM). Valid values are module or types.
  • --entryPoint the entry point for the bundle, relative to the inDir. if not provided, the files in the inDir will be processed as individual unbundled files.
  • --inDir the input source code directory.
  • --outDir the output directory.
  • --outFile the output file, relative to --outDir. This is provided for single-file bundles, along with --entryPoint.
  • --external external modules to exclude from the bundle. Built-in node modules are automatically excluded. A wildcard * can be used to exclude multiple external modules.
  • --minify whether to minify the output.
  • --sourceMap whether to include inline sourcemap.

Examples

# build ESM .mjs files from TypeScript source
npx builder --type=module --outDir=build-esm

# build single-file ESM .mjs bundle from TypeScript source
npx builder --type=module --outDir=build-esm-bundle --entryPoint=index.ts --outFile=index.mjs

Tests

This module includes a number of integration-style tests, to ensure that a specific version of TypeScript will interoperate with builder, in addition to runtimes, libraries and frameworks used by Check Digit:

  • Recent TC39 proposals
  • Node versions supported by AWS Lambda, Google Cloud Functions, and Azure Functions
  • ESLint and @typescript-eslint/eslint-plugin
  • Built-in node:test runner
  • prettier
  • tsc, and specific features introduced in each version of TypeScript
  • esbuild
  • Wallaby.js (supports node:test by including @swc-node/register as a peer dependency)

We do this to ensure that TypeScript upgrades do not break these dependencies, and that updates to these related projects do not break builds.

Note: New major versions of TypeScript are not immediately supported by projects such as eslint, prettier, typescript-eslint, etc. Our policy is to wait until these projects fully support the new version of TypeScript, and/or without emitting warnings during these tests, before publishing.

A note about versioning

Strict semver is a little complicated, as TypeScript itself does not adhere to semver. So our "best effort" policy is:

  • Each update to the minimum Node target (e.g., Node 18 to Node 20), or a change to a major compiler output option (e.g. module, target or moduleResolution) will result in a new major version of this module. We coordinate this with whatever the latest LTS version of Node is currently supported by Amazon Lambda, Google Cloud Functions, and Azure Functions.
  • Each new "major" version of TypeScript (e.g. 5.7.x to 5.8.x) will result in a new minor version of this module.
  • A new minor update of TypeScript (e.g. 5.7.2 to 5.7.3) or a key dependency (e.g., Node 22.11 to Node 22.14) may result in a patch.

Bear in mind, any update of TypeScript can potentially break your build. But hopefully in a way that's useful.

Installation

npm add -D @checkdigit/typescript-config

Note: you do not need to explicitly install TypeScript itself, as the most recent supported version comes in as a peer dependency of @checkdigit/typescript-config.

Make sure your project's tsconfig.json extends @checkdigit/typescript-config.

Example tsconfig.json

{
  "extends": "@checkdigit/typescript-config"
}

Note this configuration has moduleResolution set to bundler. This requires the use of the builder command to produce working code for deployment.

License

MIT

9.0.0-PR.68-ef55

12 months ago

9.1.0-PR.71-5c30

9 months ago

9.0.0-PR.68-c009

12 months ago

9.1.1-PR.74-3fa1

8 months ago

9.1.0-PR.71-b661

10 months ago

9.1.0-PR.71-d604

9 months ago

9.1.1-PR.74-63d5

8 months ago

9.1.0-PR.71-c74f

10 months ago

9.0.0

12 months ago

9.1.0-PR.71-89e1

10 months ago

9.1.1-PR.74-38bd

8 months ago

9.1.1

8 months ago

9.1.0

9 months ago

9.1.0-PR.71-bf12

10 months ago

9.1.0-PR.71-27df

10 months ago

9.1.0-PR.71-fee0

9 months ago

9.1.0-PR.71-db2f

9 months ago

9.1.1-PR.74-81d7

8 months ago

9.0.0-PR.68-e44d

12 months ago

9.1.0-PR.71-f692

9 months ago

8.1.0-PR.68-c5c2

12 months ago

9.1.0-PR.71-5fc4

10 months ago

9.1.1-PR.74-de1e

8 months ago

8.1.0-PR.68-5d97

12 months ago

9.1.0-PR.71-eda1

9 months ago

9.1.0-PR.71-628b

10 months ago

9.1.1-PR.74-0d9b

8 months ago

9.1.0-PR.71-e555

10 months ago

9.0.0-PR.68-1d14

12 months ago

9.1.0-PR.71-6d62

9 months ago

9.0.0-PR.68-18b8

12 months ago

9.1.0-PR.71-2cc8

9 months ago

9.1.0-PR.71-3ed3

9 months ago

9.1.0-PR.71-649c

9 months ago

9.1.0-PR.71-9784

9 months ago

9.0.0-PR.68-8780

12 months ago

9.0.0-PR.68-a24b

12 months ago

8.0.0

1 year ago

7.1.2

1 year ago

7.1.1

1 year ago

7.1.0

1 year ago

7.1.0-PR.58-728d

2 years ago

7.1.0-PR.58-27dc

2 years ago

7.1.0-PR.58-be3b

2 years ago

7.1.0-PR.58-1ac7

2 years ago

7.1.0-PR.58-a51d

2 years ago

7.1.0-PR.58-9487

2 years ago

7.1.0-PR.58-c7d5

2 years ago

7.1.0-PR.58-49c4

2 years ago

7.0.1-PR.56-de3a

2 years ago

7.0.1

2 years ago

7.0.0

2 years ago

7.0.0-PR.54-bda2

2 years ago

7.0.0-PR.54-ef07

2 years ago

7.0.0-PR.54-1ad1

2 years ago

7.0.0-PR.54-df7f

2 years ago

7.0.0-PR.54-7e35

2 years ago

7.0.0-PR.54-bfac

2 years ago

7.0.0-PR.54-d088

2 years ago

7.0.0-PR.54-9750

2 years ago

7.0.0-PR.54-b9a5

2 years ago

7.0.0-PR.54-2621

2 years ago

7.0.0-PR.54-a0b3

2 years ago

7.0.0-PR.54-665c

2 years ago

7.0.0-PR.54-eb75

2 years ago

7.0.0-PR.54-457d

2 years ago

7.0.0-PR.54-950f

2 years ago

7.0.0-PR.54-a1c4

2 years ago

7.0.0-PR.54-6ba6

2 years ago

6.0.0-PR.47-cd17

2 years ago

6.0.0-PR.47-d1e9

2 years ago

6.0.0

2 years ago

5.0.0-PR.41-dc59

2 years ago

4.1.0-PR.41-e183

2 years ago

5.1.1-PR.49-d349

2 years ago

5.1.1-PR.49-88af

2 years ago

4.0.0-PR.41-c1b3

2 years ago

4.1.0-PR.41-6096

2 years ago

4.1.0-PR.41-9f26

2 years ago

4.1.0-PR.41-5c03

2 years ago

4.0.0

2 years ago

4.1.0-PR.41-46cd

2 years ago

5.0.0-PR.41-f275

2 years ago

5.0.0-PR.41-a4c8

2 years ago

4.1.0-PR.41-0e64

2 years ago

5.0.0

2 years ago

4.0.0-PR.38-a266

2 years ago

6.0.0-PR.47-db23

2 years ago

5.1.1-PR.49-8f68

2 years ago

4.0.0-PR.38-6d85

2 years ago

5.0.0-PR.41-929c

2 years ago

5.0.0-PR.41-9b87

2 years ago

5.2.0-PR.47-39c5

2 years ago

5.2.0-PR.47-e8bc

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

4.0.0-PR.42-4737

2 years ago

5.0.0-PR.41-b783

2 years ago

5.0.0-PR.41-ffb4

2 years ago

5.0.0-PR.41-e772

2 years ago

5.0.1-PR.43-f6fc

2 years ago

4.0.0-PR.42-634e

2 years ago

5.2.0-PR.47-28b4

2 years ago

6.0.0-PR.47-90c1

2 years ago

5.1.0-PR.45-be45

2 years ago

5.0.0-PR.41-b153

2 years ago

5.0.0-PR.41-12a2

2 years ago

4.1.0-PR.41-c9ce

2 years ago

6.0.0-PR.47-da40

2 years ago

4.0.0-PR.41-79d1

2 years ago

5.1.1-PR.49-70e0

2 years ago

4.1.0-PR.41-8ff5

2 years ago

6.0.0-PR.47-6de7

2 years ago

6.0.0-PR.47-7acc

2 years ago

5.0.0-PR.41-8b7c

2 years ago

5.1.0-PR.47-1768

2 years ago

5.2.0-PR.47-a551

2 years ago

4.0.0-PR.38-97bd

2 years ago

4.1.0-PR.41-69b2

2 years ago

4.0.0-PR.41-6cc3

2 years ago

5.1.1-PR.49-ae5b

2 years ago

5.0.0-PR.41-790a

2 years ago

5.1.1-PR.49-9683

2 years ago

4.0.0-PR.38-7c81

2 years ago

3.7.0-PR.38-0546

2 years ago

4.0.0-PR.38-3292

2 years ago

3.7.0-PR.38-40bc

2 years ago

3.7.0-PR.38-4984

2 years ago

4.0.0-PR.38-1ff4

2 years ago

3.6.0-PR.38-eb05

2 years ago

4.0.0-PR.38-3041

2 years ago

3.7.0-PR.38-fb1e

2 years ago

4.0.0-PR.38-ff3c

2 years ago

3.7.0-PR.38-c2e9

2 years ago

4.0.0-PR.38-e2c9

2 years ago

3.6.0-PR.38-5b3b

2 years ago

3.3.0-PR.34-c87d

2 years ago

3.3.0-PR.30-cbc4

3 years ago

3.3.0-PR.30-c398

3 years ago

3.3.0-PR.30-2491

3 years ago

3.3.0-PR.30-dcb8

3 years ago

3.3.0-PR.30-d5d5

3 years ago

3.3.0-PR.30-223a

3 years ago

3.3.0-PR.30-9280

3 years ago

3.4.0

2 years ago

3.3.0-PR.30-f430

3 years ago

3.3.0-PR.30-f38e

3 years ago

3.3.0-PR.30-0bbb

3 years ago

3.3.0-PR.30-cf30

3 years ago

3.3.0-PR.30-1eae

3 years ago

3.3.0-PR.30-dfde

3 years ago

3.3.0-PR.30-0e8f

3 years ago

3.3.0-PR.30-36db

3 years ago

3.4.0-PR.36-4133

2 years ago

3.3.0-PR.30-3a83

3 years ago

3.4.0-PR.36-36e6

2 years ago

3.5.0

2 years ago

3.3.0-PR.30-a6df

3 years ago

3.3.0-PR.30-c147

3 years ago

3.6.0-PR.38-9dab

2 years ago

3.3.0-PR.30-064b

3 years ago

3.3.0-PR.30-12d8

3 years ago

3.3.0-PR.30-f96e

3 years ago

3.3.0-PR.30-0551

3 years ago

3.3.0-PR.30-8d2b

3 years ago

3.3.0-PR.30-3087

3 years ago

3.3.0-PR.30-01ed

3 years ago

3.3.0-PR.29-5bac

3 years ago

3.3.0-PR.30-05fd

3 years ago

3.3.0-PR.30-e4fc

3 years ago

3.3.0-PR.30-e0ba

3 years ago

3.3.0-PR.30-869c

3 years ago

3.3.0-PR.30-1055

3 years ago

3.3.0-PR.30-6fd7

3 years ago

3.3.0-PR.30-f3e9

3 years ago

3.3.0-PR.30-0c40

3 years ago

3.3.0-PR.30-47e2

3 years ago

3.3.0

3 years ago

3.2.0-PR.23-1083

3 years ago

3.2.0-PR.23-30a4

3 years ago

3.2.0-PR.23-dcac

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago