@checkdigit/typescript-config 6.0.0 → 7.0.0-PR.54-457d

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![MIT License](https://img.shields.io/github/license/checkdigit/typescript-config)](https://github.com/checkdigit/typescript-config/blob/master/LICENSE.txt)
4
4
 
5
- Copyright (c) 2022-2023 [Check Digit, LLC](https://checkdigit.com)
5
+ Copyright (c) 2022-2024 [Check Digit, LLC](https://checkdigit.com)
6
6
 
7
7
  ### Introduction
8
8
 
@@ -10,7 +10,7 @@ This module contains the standard Check Digit Typescript configuration, along wi
10
10
 
11
11
  ### Typescript Configuration
12
12
 
13
- - currently requires Node 20 or above.
13
+ - currently requires Node 20.11 or above.
14
14
  - emits `esnext`, with the default libraries, to avoid down-leveling. It is intended that application spec tests pick
15
15
  up any issues with using newer features unavailable in a particular environment. Browsers and NodeJS are fast moving
16
16
  targets, and can add language features at any time.
package/bin/builder.mjs CHANGED
@@ -30,7 +30,7 @@ async function getFiles(directory) {
30
30
  function excludeSourceMaps(filter) {
31
31
  return (pluginBuild) => {
32
32
  pluginBuild.onLoad({ filter }, async (args) => {
33
- if (args.path.endsWith(".js") || args.path.endsWith(".mjs") || args.path.endsWith(".cjs")) {
33
+ if (args.path.endsWith(".js") || args.path.endsWith(".mjs")) {
34
34
  return {
35
35
  contents: `${await fs.readFile(
36
36
  args.path,
@@ -44,8 +44,7 @@ function excludeSourceMaps(filter) {
44
44
  });
45
45
  };
46
46
  }
47
- function resolveTypescriptPaths(type2) {
48
- const extension = type2 === "module" ? "mjs" : "cjs";
47
+ function resolveTypescriptPaths() {
49
48
  return (pluginBuild) => {
50
49
  pluginBuild.onResolve({ filter: /.*/u }, async (resolved) => {
51
50
  if (resolved.kind === "entry-point" || !resolved.path.startsWith(".") || resolved.path.endsWith(".js") || resolved.path.endsWith(".json")) {
@@ -58,7 +57,7 @@ function resolveTypescriptPaths(type2) {
58
57
  } catch {
59
58
  }
60
59
  let newPath = resolved.path;
61
- newPath += isDirectory ? `/index.${extension}` : `.${extension}`;
60
+ newPath += isDirectory ? `/index.mjs` : `.mjs`;
62
61
  return { path: newPath, external: true };
63
62
  });
64
63
  };
@@ -145,7 +144,7 @@ async function builder_default({
145
144
  minify: minify2,
146
145
  absWorkingDir: workingDirectory,
147
146
  platform: "node",
148
- format: type2 === "module" ? "esm" : "cjs",
147
+ format: "esm",
149
148
  treeShaking: type2 === "module",
150
149
  write: false,
151
150
  metafile: outFile2 !== void 0,
@@ -157,11 +156,11 @@ async function builder_default({
157
156
  ...outFile2 === void 0 ? {
158
157
  // individual files
159
158
  outdir: outDir2,
160
- outExtension: { ".js": type2 === "module" ? ".mjs" : ".cjs" },
159
+ outExtension: { ".js": ".mjs" },
161
160
  plugins: [
162
161
  {
163
162
  name: "resolve-typescript-paths",
164
- setup: resolveTypescriptPaths(type2)
163
+ setup: resolveTypescriptPaths()
165
164
  }
166
165
  ]
167
166
  } : {
@@ -227,7 +226,7 @@ var {
227
226
  sourceMap: { type: "boolean", short: "s", default: false }
228
227
  }
229
228
  });
230
- assert3.ok(type === "module" || type === "commonjs" || type === "types", "type must be types, module or commonjs");
229
+ assert3.ok(type === "module" || type === "types", "type must be types or module");
231
230
  assert3.ok(inDir !== void 0, "inDir is required");
232
231
  assert3.ok(outDir !== void 0, "outDir is required");
233
232
  var buildResult = await builder_default({
package/package.json CHANGED
@@ -1,207 +1 @@
1
- {
2
- "name": "@checkdigit/typescript-config",
3
- "version": "6.0.0",
4
- "description": "Check Digit standard Typescript configuration",
5
- "prettier": "@checkdigit/prettier-config",
6
- "engines": {
7
- "node": ">=20.9"
8
- },
9
- "bin": {
10
- "builder": "./bin/builder.mjs"
11
- },
12
- "peerDependencies": {
13
- "@types/node": ">=20.9",
14
- "esbuild": "0.19.8",
15
- "typescript": ">=5.3.2 <5.4.0"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/checkdigit/typescript-config.git"
20
- },
21
- "author": "Check Digit, LLC",
22
- "license": "MIT",
23
- "bugs": {
24
- "url": "https://github.com/checkdigit/typescript-config/issues"
25
- },
26
- "homepage": "https://github.com/checkdigit/typescript-config#readme",
27
- "scripts": {
28
- "prepublishOnly": "npm run build-builder",
29
- "lint:fix": "eslint --ignore-path .gitignore . --fix",
30
- "lint": "eslint --max-warnings 0 --ignore-path .gitignore .",
31
- "prettier": "prettier --ignore-path .gitignore --list-different .",
32
- "prettier:fix": "prettier --ignore-path .gitignore --write .",
33
- "test": "npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style",
34
- "build-builder": "esbuild src/builder/index.mts --bundle --platform=node --format=esm --external:typescript --external:esbuild --outfile=build-builder/builder.mjs && mkdir -p bin && { echo '#!/usr/bin/env node'; cat build-builder/builder.mjs; } > bin/builder.mjs && chmod +x bin/builder.mjs",
35
- "build-types": "rimraf build-types && bin/builder.mjs --type=types --outDir=build-types",
36
- "build-cjs": "rimraf build-cjs && bin/builder.mjs --type=commonjs --outDir=build-cjs",
37
- "build-cjs-bundle": "rimraf build-cjs-bundle && bin/builder.mjs --type=commonjs --entryPoint=test/index.test.ts --outDir=build-cjs-bundle --outFile=test/index.test.cjs --sourceMap",
38
- "build-cjs-bundle-minify": "rimraf build-cjs-bundle-minify && bin/builder.mjs --type=commonjs --entryPoint=test/index.test.ts --outDir=build-cjs-bundle-minify --outFile=test/index.test.cjs --minify --sourceMap",
39
- "build-cjs-bundle-no-external": "rimraf build-cjs-bundle-no-external && bin/builder.mjs --type=commonjs --external=./node_modules/* --entryPoint=test/index.test.ts --outDir=build-cjs-bundle-no-external --outFile=test/index.test.cjs",
40
- "build-mjs": "rimraf build-mjs && bin/builder.mjs --type=module --outDir=build-mjs",
41
- "build-mjs-bundle": "rimraf build-mjs-bundle && bin/builder.mjs --type=module --outDir=build-mjs-bundle --entryPoint=test/index.test.ts --outFile=test/index.test.mjs",
42
- "build-mjs-bundle-minify": "rimraf build-mjs-bundle-minify && bin/builder.mjs --type=module --minify --outDir=build-mjs-bundle-minify --entryPoint=test/index.test.ts --outFile=test/index.test.mjs",
43
- "build-mjs-bundle-no-external": "rimraf build-mjs-bundle-no-external && bin/builder.mjs --type=module --external=./node_modules/* --outDir=build-mjs-bundle-no-external --entryPoint=test/index.test.ts --outFile=test/index.test.mjs --minify",
44
- "test-jest-mjs": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --coverage=false src/*.mts src/*/*.mts src/*/*/*.mts",
45
- "test-jest-cjs": "jest --coverage=false src/*.ts src/*/*.ts src/*/*/*.ts",
46
- "test-cjs": "node --test build-cjs/test/index.test.cjs",
47
- "test-cjs-bundle": "node --test build-cjs-bundle/test/index.test.cjs",
48
- "test-cjs-bundle-minify": "node --test build-cjs-bundle-minify/test/index.test.cjs",
49
- "test-cjs-bundle-no-external": "node --test build-cjs-bundle-no-external/test/index.test.cjs",
50
- "test-mjs": "node --test build-mjs/test/index.test.mjs",
51
- "test-mjs-bundle": "node --test build-mjs-bundle/test/index.test.mjs",
52
- "test-mjs-bundle-minify": "node --test build-mjs-bundle-minify/test/index.test.mjs",
53
- "test-mjs-bundle-no-external": "node --test build-mjs-bundle-no-external/test/index.test.mjs",
54
- "ci:test": "npm run test-jest-cjs && npm run test-jest-mjs && npm run test-cjs && npm run test-cjs-bundle && npm run test-cjs-bundle-no-external && npm run test-mjs && npm run test-mjs-bundle && npm run test-mjs-bundle-no-external",
55
- "ci:compile": "tsc --noEmit && npm run build-builder && npm run build-types && npm run build-cjs && npm run build-cjs-bundle && npm run build-cjs-bundle-minify && npm run build-cjs-bundle-no-external && npm run build-mjs && npm run build-mjs-bundle && npm run build-mjs-bundle-minify && npm run build-mjs-bundle-no-external",
56
- "ci:lint": "npm run lint",
57
- "ci:style": "npm run prettier"
58
- },
59
- "devDependencies": {
60
- "@apidevtools/json-schema-ref-parser": "^11.1.0",
61
- "@checkdigit/prettier-config": "^5.0.0",
62
- "@types/debug": "^4.1.12",
63
- "@types/jest": "^29.5.10",
64
- "@types/uuid": "^9.0.7",
65
- "@typescript-eslint/eslint-plugin": "^6.13.0",
66
- "@typescript-eslint/parser": "^6.13.0",
67
- "debug": "^4.3.4",
68
- "eslint": "^8.54.0",
69
- "eslint-config-prettier": "^9.0.0",
70
- "get-port": "^7.0.0",
71
- "got": "^11.8.6",
72
- "jest": "^29.7.0",
73
- "node-fetch": "^3.3.2",
74
- "rimraf": "^5.0.5",
75
- "ts-jest": "^29.1.1",
76
- "uuid": "^9.0.1"
77
- },
78
- "eslintConfig": {
79
- "parser": "@typescript-eslint/parser",
80
- "plugins": [
81
- "@typescript-eslint"
82
- ],
83
- "parserOptions": {
84
- "project": "./tsconfig.json"
85
- },
86
- "extends": [
87
- "eslint:all",
88
- "plugin:@typescript-eslint/recommended",
89
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
90
- "plugin:@typescript-eslint/strict",
91
- "prettier"
92
- ],
93
- "rules": {
94
- "@typescript-eslint/non-nullable-type-assertion-style": "error",
95
- "capitalized-comments": "off",
96
- "one-var": "off",
97
- "sort-keys": "off",
98
- "sort-imports": "off",
99
- "max-lines": [
100
- "error",
101
- {
102
- "max": 500,
103
- "skipBlankLines": true,
104
- "skipComments": true
105
- }
106
- ],
107
- "func-style": [
108
- "error",
109
- "declaration",
110
- {
111
- "allowArrowFunctions": true
112
- }
113
- ],
114
- "no-magic-numbers": [
115
- "error",
116
- {
117
- "ignore": [
118
- 0,
119
- 1,
120
- 2
121
- ]
122
- }
123
- ],
124
- "no-undefined": "off",
125
- "no-ternary": "off"
126
- },
127
- "overrides": [
128
- {
129
- "files": [
130
- "*.spec.mts",
131
- "*.test.mts",
132
- "*.spec.ts",
133
- "*.test.ts"
134
- ],
135
- "rules": {
136
- "@typescript-eslint/non-nullable-type-assertion-style": "off",
137
- "@typescript-eslint/ban-types": "off",
138
- "@typescript-eslint/require-await": "off",
139
- "@typescript-eslint/consistent-type-definitions": "off",
140
- "@typescript-eslint/ban-ts-comment": "off",
141
- "@typescript-eslint/no-unnecessary-condition": "off",
142
- "@typescript-eslint/consistent-indexed-object-style": "off",
143
- "@typescript-eslint/no-unused-vars": "off",
144
- "@typescript-eslint/no-unsafe-member-access": "off",
145
- "line-comment-position": "off",
146
- "no-fallthrough": "off",
147
- "no-inline-comments": "off",
148
- "no-param-reassign": "off",
149
- "id-length": "off",
150
- "no-magic-numbers": "off",
151
- "func-names": "off",
152
- "no-duplicate-imports": "off",
153
- "symbol-description": "off",
154
- "no-invalid-this": "off",
155
- "max-lines-per-function": "off",
156
- "max-lines": "off",
157
- "max-statements": "off",
158
- "no-await-in-loop": "off"
159
- }
160
- }
161
- ]
162
- },
163
- "jest": {
164
- "moduleFileExtensions": [
165
- "js",
166
- "mjs",
167
- "cjs",
168
- "ts",
169
- "mts",
170
- "json",
171
- "node"
172
- ],
173
- "extensionsToTreatAsEsm": [
174
- ".mts"
175
- ],
176
- "transform": {
177
- "^.+\\.mts$": [
178
- "ts-jest",
179
- {
180
- "isolatedModules": true,
181
- "diagnostics": false,
182
- "useESM": true
183
- }
184
- ],
185
- "^.+\\.ts$": [
186
- "ts-jest",
187
- {
188
- "isolatedModules": true,
189
- "diagnostics": false,
190
- "useESM": false
191
- }
192
- ]
193
- },
194
- "collectCoverageFrom": [
195
- "<rootDir>/src/**"
196
- ],
197
- "testMatch": [
198
- "<rootDir>/src/**/*.spec.ts",
199
- "<rootDir>/src/**/*.spec.mts"
200
- ]
201
- },
202
- "files": [
203
- "bin",
204
- "tsconfig.json",
205
- "SECURITY.md"
206
- ]
207
- }
1
+ {"name":"@checkdigit/typescript-config","version":"7.0.0-PR.54-457d","description":"Check Digit standard Typescript configuration","prettier":"@checkdigit/prettier-config","engines":{"node":">=20.11"},"bin":{"builder":"./bin/builder.mjs"},"peerDependencies":{"@types/node":">=20.11","esbuild":"0.20.0","typescript":"5.4.0-beta"},"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":{"prepublishOnly":"npm run build-builder","lint:fix":"eslint --ignore-path .gitignore . --fix","lint":"eslint --max-warnings 0 --ignore-path .gitignore .","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:lint && npm run ci:style","build-builder":"esbuild src/builder/index.mts --bundle --platform=node --format=esm --external:typescript --external:esbuild --outfile=build-builder/builder.mjs && mkdir -p bin && { echo '#!/usr/bin/env node'; cat build-builder/builder.mjs; } > bin/builder.mjs && chmod +x bin/builder.mjs","build-types":"rimraf build-types && bin/builder.mjs --type=types --outDir=build-types","build-mjs":"rimraf build-mjs && bin/builder.mjs --type=module --outDir=build-mjs","build-mjs-bundle":"rimraf build-mjs-bundle && bin/builder.mjs --type=module --outDir=build-mjs-bundle --entryPoint=test/index.test.ts --outFile=test/index.test.mjs","build-mjs-bundle-minify":"rimraf build-mjs-bundle-minify && bin/builder.mjs --type=module --minify --outDir=build-mjs-bundle-minify --entryPoint=test/index.test.ts --outFile=test/index.test.mjs","build-mjs-bundle-no-external":"rimraf build-mjs-bundle-no-external && bin/builder.mjs --type=module --external=./node_modules/* --outDir=build-mjs-bundle-no-external --entryPoint=test/index.test.ts --outFile=test/index.test.mjs --minify","test-jest-mjs":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false src/*.mts src/*/*.mts src/*/*/*.mts","test-mjs":"node --test build-mjs/test/index.test.mjs","test-mjs-bundle":"node --test build-mjs-bundle/test/index.test.mjs","test-mjs-bundle-minify":"node --test build-mjs-bundle-minify/test/index.test.mjs","test-mjs-bundle-no-external":"node --test build-mjs-bundle-no-external/test/index.test.mjs","ci:test":"npm run test-jest-mjs && npm run test-mjs && npm run test-mjs-bundle && npm run test-mjs-bundle-no-external","ci:compile":"tsc --noEmit && npm run build-builder && npm run build-types && npm run build-mjs && npm run build-mjs-bundle && npm run build-mjs-bundle-minify && npm run build-mjs-bundle-no-external","ci:lint":"npm run lint","ci:style":"npm run prettier"},"devDependencies":{"@apidevtools/json-schema-ref-parser":"^11.1.0","@checkdigit/prettier-config":"^5.2.0","@types/debug":"^4.1.12","@types/jest":"^29.5.11","@types/uuid":"^9.0.8","@typescript-eslint/eslint-plugin":"^6.20.0","@typescript-eslint/parser":"^6.20.0","debug":"^4.3.4","eslint":"^8.56.0","eslint-config-prettier":"^9.1.0","get-port":"^7.0.0","got":"^11.8.6","jest":"^29.7.0","node-fetch":"^3.3.2","rimraf":"^5.0.5","ts-jest":"^29.1.2","uuid":"^9.0.1"},"eslintConfig":{"parser":"@typescript-eslint/parser","plugins":["@typescript-eslint"],"parserOptions":{"project":"./tsconfig.json"},"extends":["eslint:all","plugin:@typescript-eslint/recommended","plugin:@typescript-eslint/recommended-requiring-type-checking","plugin:@typescript-eslint/strict","prettier"],"rules":{"@typescript-eslint/non-nullable-type-assertion-style":"error","capitalized-comments":"off","one-var":"off","sort-keys":"off","sort-imports":"off","max-lines":["error",{"max":500,"skipBlankLines":true,"skipComments":true}],"func-style":["error","declaration",{"allowArrowFunctions":true}],"no-magic-numbers":["error",{"ignore":[0,1,2]}],"no-undefined":"off","no-ternary":"off"},"overrides":[{"files":["*.spec.mts","*.test.mts","*.spec.ts","*.test.ts"],"rules":{"@typescript-eslint/non-nullable-type-assertion-style":"off","@typescript-eslint/ban-types":"off","@typescript-eslint/require-await":"off","@typescript-eslint/consistent-type-definitions":"off","@typescript-eslint/ban-ts-comment":"off","@typescript-eslint/no-unnecessary-condition":"off","@typescript-eslint/consistent-indexed-object-style":"off","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-unsafe-member-access":"off","line-comment-position":"off","no-fallthrough":"off","no-inline-comments":"off","no-param-reassign":"off","id-length":"off","no-magic-numbers":"off","func-names":"off","no-duplicate-imports":"off","symbol-description":"off","no-invalid-this":"off","max-lines-per-function":"off","max-lines":"off","max-statements":"off","no-await-in-loop":"off"}}]},"jest":{"moduleFileExtensions":["js","mjs","cjs","ts","mts","json","node"],"extensionsToTreatAsEsm":[".mts"],"transform":{"^.+\\.mts$":["ts-jest",{"isolatedModules":true,"diagnostics":false,"useESM":true}],"^.+\\.ts$":["ts-jest",{"isolatedModules":true,"diagnostics":false,"useESM":false}]},"collectCoverageFrom":["<rootDir>/src/**"],"testMatch":["<rootDir>/src/**/*.spec.ts","<rootDir>/src/**/*.spec.mts"]},"files":["bin","tsconfig.json","SECURITY.md"],"overrides":{"typescript":"5.4.0-beta"}}
package/tsconfig.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "removeComments": false,
10
10
  "noLib": false,
11
11
  "noEmitOnError": false,
12
- "skipLibCheck": true,
12
+ "skipLibCheck": false,
13
13
  "strict": true,
14
14
  "preserveConstEnums": true,
15
15
  "noImplicitReturns": true,
@@ -28,6 +28,6 @@
28
28
  "allowUnreachableCode": false,
29
29
  "noImplicitOverride": true,
30
30
  "useUnknownInCatchVariables": true,
31
- "exactOptionalPropertyTypes": true
32
- }
31
+ "exactOptionalPropertyTypes": true,
32
+ },
33
33
  }