@checkdigit/typescript-config 3.4.0 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/bin/builder.mjs +8 -4
- package/package.json +7 -6
package/README.md
CHANGED
@@ -25,7 +25,7 @@ types, and `esbuild` for generating code.
|
|
25
25
|
|
26
26
|
#### Options
|
27
27
|
|
28
|
-
- `--type` the type of
|
28
|
+
- `--type` the type of output to generate. Defaults to `module` (ESM). Valid values are `commonjs`, `module` or `types`.
|
29
29
|
- `--entryPoint` the entry point for the bundle, relative to the inDir. if not provided, the files in the inDir will
|
30
30
|
be processed as individual unbundled files.
|
31
31
|
- `--inDir` the input source code directory.
|
package/bin/builder.mjs
CHANGED
@@ -78,8 +78,9 @@ async function builder_default({
|
|
78
78
|
moduleResolution: typescript.ModuleResolutionKind.Bundler,
|
79
79
|
target: typescript.ScriptTarget.ESNext,
|
80
80
|
declaration: true,
|
81
|
+
noEmit: type2 !== "types",
|
81
82
|
noEmitOnError: true,
|
82
|
-
emitDeclarationOnly:
|
83
|
+
emitDeclarationOnly: type2 === "types",
|
83
84
|
rootDir: inDir2,
|
84
85
|
outDir: outDir2,
|
85
86
|
noLib: false,
|
@@ -120,8 +121,11 @@ async function builder_default({
|
|
120
121
|
messages2.push(`tsc: ${typescript.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`);
|
121
122
|
}
|
122
123
|
}
|
123
|
-
if (
|
124
|
-
throw new Error(`
|
124
|
+
if (messages2.length > 0) {
|
125
|
+
throw new Error(`tsc failed ${JSON.stringify(messages2)}`);
|
126
|
+
}
|
127
|
+
if (type2 === "types") {
|
128
|
+
return [];
|
125
129
|
}
|
126
130
|
const buildResult = await build({
|
127
131
|
entryPoints: productionSourceFiles,
|
@@ -177,7 +181,7 @@ var {
|
|
177
181
|
sourceMap: { type: "boolean", short: "s", default: false }
|
178
182
|
}
|
179
183
|
});
|
180
|
-
assert2.ok(type === "module" || type === "commonjs", "type must be module or commonjs");
|
184
|
+
assert2.ok(type === "module" || type === "commonjs" || type === "types", "type must be types, module or commonjs");
|
181
185
|
assert2.ok(inDir !== void 0, "inDir is required");
|
182
186
|
assert2.ok(outDir !== void 0, "outDir is required");
|
183
187
|
var messages = await builder_default({
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@checkdigit/typescript-config",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.5.0",
|
4
4
|
"description": "Check Digit standard Typescript configuration",
|
5
5
|
"prettier": "@checkdigit/prettier-config",
|
6
6
|
"engines": {
|
@@ -34,6 +34,7 @@
|
|
34
34
|
"prettier:fix": "prettier --ignore-path .gitignore --write .",
|
35
35
|
"test": "npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style",
|
36
36
|
"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",
|
37
|
+
"build-types": "rimraf build-types && npx builder --type=types --outDir=build-types",
|
37
38
|
"build-cjs": "rimraf build-cjs && npx builder --type=commonjs --outDir=build-cjs",
|
38
39
|
"build-cjs-bundle": "rimraf build-cjs-bundle && npx builder --type=commonjs --entryPoint=test/index.test.ts --outDir=build-cjs-bundle --outFile=test/index.test.cjs --minify --sourceMap",
|
39
40
|
"build-cjs-bundle-no-external": "rimraf build-cjs-bundle-no-external && npx builder --type=commonjs --external=./node_modules/* --entryPoint=test/index.test.ts --outDir=build-cjs-bundle-no-external --outFile=test/index.test.cjs",
|
@@ -49,19 +50,19 @@
|
|
49
50
|
"test-esm-bundle": "echo \"node --test build-esm-bundle/test/index.test.mjs\"",
|
50
51
|
"test-esm-bundle-no-external": "node --test build-esm-bundle-no-external/test/index.test.mjs",
|
51
52
|
"ci:test": "npm run test-jest-cjs && npm run test-jest-esm && npm run test-cjs && npm run test-cjs-bundle && npm run test-cjs-bundle-no-external && npm run test-esm && npm run test-esm-bundle && npm run test-esm-bundle-no-external",
|
52
|
-
"ci:compile": "npm run build-builder && npm run build-cjs && npm run build-cjs-bundle && npm run build-cjs-bundle-no-external && npm run build-esm && npm run build-esm-bundle && npm run build-esm-bundle-no-external",
|
53
|
+
"ci:compile": "npm run build-builder && npm run build-types && npm run build-cjs && npm run build-cjs-bundle && npm run build-cjs-bundle-no-external && npm run build-esm && npm run build-esm-bundle && npm run build-esm-bundle-no-external",
|
53
54
|
"ci:lint": "npm run lint",
|
54
55
|
"ci:style": "npm run prettier"
|
55
56
|
},
|
56
57
|
"devDependencies": {
|
57
58
|
"@checkdigit/prettier-config": "^3.4.0",
|
58
|
-
"@types/debug": "^4.1.
|
59
|
+
"@types/debug": "^4.1.8",
|
59
60
|
"@types/jest": "^29.5.1",
|
60
61
|
"@types/uuid": "^9.0.1",
|
61
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
62
|
-
"@typescript-eslint/parser": "^5.59.
|
62
|
+
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
63
|
+
"@typescript-eslint/parser": "^5.59.7",
|
63
64
|
"debug": "^4.3.4",
|
64
|
-
"eslint": "^8.
|
65
|
+
"eslint": "^8.41.0",
|
65
66
|
"eslint-config-prettier": "^8.8.0",
|
66
67
|
"get-port": "^6.1.2",
|
67
68
|
"got": "^11.8.6",
|