Skip to content

Commit

Permalink
Typescript 5.4 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlansley authored Mar 11, 2024
1 parent 8d8b81a commit 65a4e94
Show file tree
Hide file tree
Showing 39 changed files with 817 additions and 1,279 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-published-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
name: Check Published
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check Published
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ jobs:
matrix:
node-version: [20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Audit Signatures
run: npm audit signatures
- name: Compile
run: npm run ci:compile
- name: Check Code Style
Expand All @@ -39,18 +37,16 @@ jobs:
matrix:
node-version: [20.x, 21.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Audit Signatures
run: npm audit signatures
- name: Compile
run: npm run ci:compile
- name: Check Code Style
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,35 @@ jobs:
runs-on: ubuntu-latest
name: Publish Beta
steps:
- uses: actions/checkout@v3
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Check Label
uses: checkdigit/github-actions/check-label@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
- name: Install latest npm
run: npm install -g npm@latest
- name: Install Dependencies
run: npm ci --ignore-scripts
- name: Audit Signatures
run: npm audit signatures
- name: Run Test
run: npm run test
run: npm run ci:test
- name: Prepare Beta
id: prepare-beta
uses: checkdigit/github-actions/prepare-beta@main
- name: Publish Beta
run: npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_PUBLISH }}
- name: Comment
- name: Comment npm publish result
uses: checkdigit/github-actions/comment-npm-publish@main
with:
betaPackage: ${{ steps.prepare-beta.outputs.betaPackage }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
id-token: write
name: Publish to NPM
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install latest npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Audit Signatures
run: npm audit signatures
- name: Run Test
run: npm run test
- name: Publish
run: npm publish --provenance
env:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DS_Store
.idea
coverage
build-*
dist-*
node_modules
bin
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2021-2023 Check Digit, LLC
Copyright (c) 2021-2024 Check Digit, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
30 changes: 12 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@

[![MIT License](https://img.shields.io/github/license/checkdigit/typescript-config)](https://github.com/checkdigit/typescript-config/blob/master/LICENSE.txt)

Copyright (c) 2022-2023 [Check Digit, LLC](https://checkdigit.com)
Copyright (c) 2022–2024 [Check Digit, LLC](https://checkdigit.com)

### Introduction

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

### Typescript Configuration

- currently requires Node 20 or above.
- currently requires Node 20.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 NodeJS are fast moving
up any issues with using newer features unavailable in a particular environment. Browsers and NodeJS are fast-moving
targets, and can add language features at any time.
- uses the `module` type of `commonjs`.
- uses the `module` type of `esnext`.
- all compiler options set for maximum strictness.

### Builder

`builder` is a command line tool that generates either CommonJS or ESM modules, from 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.
`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:** if building an ESM bundle, the `require` function will be defined as a global variable, to allow
**Note:** the `require` function will be defined as a global variable, to allow
dynamic `require`s by CommonJS submodules. This is not a problem for NodeJS, but will cause issues in a browser environment.

#### Options

- `--type` the type of output to generate. Defaults to `module` (ESM). Valid values are `commonjs`, `module` or `types`.
- `--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.
Expand All @@ -42,12 +42,6 @@ dynamic `require`s by CommonJS submodules. This is not a problem for NodeJS, but
#### Examples

```
# build commonjs .cjs files from Typescript source
npx builder --type=commonjs --outDir=build-cjs
# build single-file commonjs .cjs bundle from Typescript source
npx builder --type=commonjs --entryPoint=index.ts --outDir=build-cjs-bundle --outFile=index.cjs
# build ESM .mjs files from Typescript source
npx builder --type=module --outDir=build-esm
Expand Down Expand Up @@ -75,10 +69,10 @@ the new version of Typescript, and/or without emitting warnings during these tes

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
- 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.
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. `4.2.x` to `4.3.x`) will result in a new minor version of this module.
- A new minor update of Typescript (e.g. `4.3.1` to `4.3.2`) _may_ result in a patch, in
a situation where a specific need or issue requires setting a new minimum version of Typescript.
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ These versions of `@checkdigit/typescript-config` are currently being supported

| Version | Supported |
| ------- | ------------------ |
| \>= 5.x | :white_check_mark: |
| \< 5.0 | :x: |
| \>= 7.x | :white_check_mark: |
| \< 7.0 | :x: |

## Reporting a Vulnerability

Expand Down
Loading

0 comments on commit 65a4e94

Please sign in to comment.