@checkdigit/typescript-config 3.3.0-PR.30-8d2b → 3.3.0-PR.30-0c40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -9
- package/package.json +1 -1
- package/src/describe-it.ts +11 -0
package/README.md
CHANGED
@@ -8,20 +8,39 @@ Copyright (c) 2022-2023 [Check Digit, LLC](https://checkdigit.com)
|
|
8
8
|
|
9
9
|
This module contains the standard Check Digit Typescript configuration.
|
10
10
|
|
11
|
-
- requires Node 16 or above
|
12
|
-
- emits
|
11
|
+
- currently requires Node 16 or above.
|
12
|
+
- emits `esnext`, with the default libraries, to avoid down-leveling. It is intended that application spec tests pick
|
13
|
+
up any issues with using newer features unavailable in a particular environment. Browsers and NodeJS are fast moving
|
14
|
+
targets, and can add language features at any time.
|
13
15
|
- uses the `module` type of `commonjs`.
|
14
|
-
- all compiler options set for maximum strictness
|
16
|
+
- all compiler options set for maximum strictness.
|
15
17
|
|
16
|
-
|
18
|
+
### Tests
|
19
|
+
|
20
|
+
This module includes a number of integration-style tests, to ensure that a specific version of Typescript will interoperate
|
21
|
+
with various bundlers, libraries and frameworks used by Check Digit:
|
22
|
+
|
23
|
+
- Jest and `ts-jest`
|
24
|
+
- `node:test`
|
25
|
+
- prettier
|
26
|
+
- tsc
|
27
|
+
- swc
|
28
|
+
- esbuild
|
29
|
+
|
30
|
+
We do this to ensure that Typescript upgrades do not break things. New major versions of Typescript are not immediately
|
31
|
+
supported by projects such as ts-jest, eslint, prettier, etc. Our policy is to wait until these projects fully support
|
32
|
+
the new version of Typescript, and/or without emitting warnings during these tests, before publishing.
|
33
|
+
|
34
|
+
### A note about versioning
|
17
35
|
|
18
36
|
Strict semver is a little complicated, as Typescript itself does not adhere to semver. So our "best effort" policy is:
|
19
37
|
|
20
|
-
- Each
|
21
|
-
with whatever the latest LTS version of Node is currently supported by Amazon Lambda, Google Cloud Functions
|
38
|
+
- Each update to the minimum Node target (e.g. Node 16 to Node 18) will result in a new major version of this module.
|
39
|
+
We coordinate this with whatever the latest LTS version of Node is currently supported by Amazon Lambda, Google Cloud Functions
|
22
40
|
and Azure Functions.
|
23
|
-
- 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.
|
24
|
-
-
|
41
|
+
- 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.
|
42
|
+
- A new minor update of Typescript (e.g. `4.3.1` to `4.3.2`) _may_ result in a patch, in
|
43
|
+
a situation where a specific need or issue requires setting a new minimum version of Typescript.
|
25
44
|
|
26
45
|
Bear in mind, any update of Typescript can potentially break your build. But hopefully in a way that's useful.
|
27
46
|
|
@@ -31,7 +50,8 @@ Bear in mind, any update of Typescript can potentially break your build. But hop
|
|
31
50
|
npm add -D @checkdigit/typescript-config
|
32
51
|
```
|
33
52
|
|
34
|
-
Note: you do not need to explicitly install Typescript itself, as
|
53
|
+
Note: you do not need to explicitly install Typescript itself, as the most recent supported version comes in as a
|
54
|
+
peer dependency of `@checkdigit/typescript-config`.
|
35
55
|
|
36
56
|
Make sure your project's `tsconfig.json` extends `@checkdigit/typescript-config`.
|
37
57
|
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"name":"@checkdigit/typescript-config","version":"3.3.0-PR.30-
|
1
|
+
{"name":"@checkdigit/typescript-config","version":"3.3.0-PR.30-0c40","description":"Check Digit standard Typescript configuration","prettier":"@checkdigit/prettier-config","engines":{"node":">=16"},"peerDependencies":{"@types/node":">=16","typescript":">=5.0.4 <5.1"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/typescript-config.git"},"author":"Check Digit, LLC","license":"MIT","bugs":{"url":"https://github.com/checkdigit/typescript-config/issues"},"homepage":"https://github.com/checkdigit/typescript-config#readme","scripts":{"preversion":"npm test","postversion":"git push && git push --tags","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:style","build-tsc":"rimraf build && tsc","build-es":"rimraf build-es && esbuild ./src/*.ts ./src/*/*.ts --platform=node --bundle --format=cjs --sourcemap=inline --outdir=build-es","build-swc":"rimraf build-swc && swc ./src -d ./build-swc","ci:test":"NODE_OPTIONS=\"--no-warnings --experimental-vm-modules\" jest --coverage=false && node --test build/*.spec.js build/*/*.spec.js && node --test build-es/*.spec.js build-es/*/*.spec.js","ci:compile":"npm run build-tsc && npm run build-es","ci:style":"npm run prettier"},"devDependencies":{"@checkdigit/prettier-config":"^3.4.0","@swc/cli":"^0.1.62","@swc/core":"^1.3.50","@types/jest":"^29.5.0","esbuild":"^0.17.16","get-port":"^6.1.2","got":"11.8.6","jest":"^29.5.0","rimraf":"^5.0.0","ts-jest":"^29.1.0"},"jest":{"extensionsToTreatAsEsm":[".mts"],"transform":{"^.+\\.ts$":["ts-jest",{"isolatedModules":true,"diagnostics":false,"useESM":false}]},"collectCoverageFrom":["<rootDir>/src/**","!<rootDir>/src/**/*.spec.ts","!<rootDir>/src/**/*.test.ts"],"testMatch":["<rootDir>/src/**/*.spec.ts"]},"files":["tsconfig.json","SECURITY.md","/src/"]}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// describe-it.ts
|
2
|
+
|
3
|
+
import { describe as nodeDescribe, it as nodeIt } from 'node:test';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* If we're running inside a Jest environment, "describe" and "it" will be defined globally. If not, we fall back to
|
7
|
+
* the built-in node.js test runner.
|
8
|
+
*/
|
9
|
+
|
10
|
+
export const describe = globalThis.describe ?? nodeDescribe;
|
11
|
+
export const it = globalThis.it ?? nodeIt;
|