Skip to content

Commit 34edd33

Browse files
committed
h
1 parent bb49dd1 commit 34edd33

6 files changed

Lines changed: 109 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.tar.gz
55
*.zip
66
lcov.info
7+
tsc.ignore.tsconfig.json
78
node_modules
89
/bin/
910
preprocessed.js

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"devDependencies": {
4040
"@playwright/test": "1.59.1",
4141
"@types/express": "^5.0.6",
42+
"@types/gitignore-parser": "^0.0.3",
4243
"@types/lodash": "^4.17.24",
4344
"@types/node": "^25.6.0",
4445
"@types/serve-index": "^1.9.4",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsc.ignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# for tsc.sh
2+
3+
tsc.ignore.ts
4+
5+
6+
7+
node_modules
8+
es.ts
9+
tsc.ignore.ts
10+
bash/tee.ts
11+
vitest.config.ts
12+
esbuild.ts
13+
14+
# server-template.ts
15+
# bash/fs/relative.ts
16+
# scripts/template.ts
17+
# scripts/template.v2.ts
18+
# pages/online_services/generator/index.ts
19+
# pages/js/flipget/dataFactory.ts
20+
# pages/typescript/node/transform-types.ts
21+
# pages/typescript/node/lib.ts
22+
# pages/typescript/node/tstest.ts
23+
# pages/bookmarklets/gmail/extract.ts
24+
# pages/node/libs/lib.ts
25+
# pages/node/libs/tstest.ts
26+
# pages/node/env/env.ts
27+
# pages/node/env/env.unit.ts
28+
# pages/node/semaphore/Semaphore.test.ts
29+
# pages/node/semaphore/Semaphore.ts
30+
# pages/node/builtin-test-runner.test.ts
31+
# pages/children/caesar/moduleCaesarCypher.ts

tsc.ignore.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* NODE_OPTIONS= node tsc.ignore.ts "tsc.ignore" tsconfig.json tsc.ignore.tsconfig.json
3+
*/
4+
5+
import fs from "fs";
6+
7+
import ts from "typescript";
8+
9+
const th = (msg: string) => new Error(`tsc.ignore.ts error: ${msg}`);
10+
11+
const args = process.argv.slice(2);
12+
13+
const ignorefile = args[0];
14+
const tsconfigfile = args[1];
15+
const outputfile = args[2];
16+
17+
if (!fs.existsSync(ignorefile)) {
18+
throw th(`${ignorefile} doesn't exist`);
19+
}
20+
21+
if (!fs.existsSync(tsconfigfile)) {
22+
throw th(`${tsconfigfile} doesn't exist`);
23+
}
24+
25+
const fileContent = fs.readFileSync(ignorefile, "utf-8");
26+
27+
const exclude = fileContent
28+
.split("\n")
29+
.map((l) => l.trim())
30+
.filter(Boolean)
31+
.filter((l) => !l.startsWith("#"));
32+
33+
console.log(exclude);
34+
35+
const tsconfigContent = fs.readFileSync(tsconfigfile, "utf-8");
36+
37+
const { config: tsconfigObj, error } = ts.parseConfigFileTextToJson(tsconfigfile, tsconfigContent);
38+
39+
if (error) {
40+
throw th(`Error parsing ${tsconfigfile}: ${ts.flattenDiagnosticMessageText(error.messageText, "\n")}`);
41+
}
42+
43+
tsconfigObj.exclude = exclude;
44+
45+
fs.writeFileSync(outputfile, JSON.stringify(tsconfigObj, null, 2));
46+
47+
console.log(`
48+
49+
tsc.ignore.ts config generated at: ${outputfile}:
50+
${JSON.stringify(tsconfigObj, null, 2)}
51+
52+
`);

tsc.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
3+
# to find all ts files
4+
find . \( \
5+
-type d -name node_modules -prune -o \
6+
-type d -name .git -prune -o \
7+
-type d -name coverage -prune -o \
8+
-type d -name noprettier -prune \
9+
\) \
10+
-o \
11+
\( -type f \( -name "*.ts" \) -print \)
12+
13+
14+
NODE_OPTIONS= node tsc.ignore.ts "tsc.ignore" tsconfig.json tsc.ignore.tsconfig.json
15+
16+
npx tsc -p tsconfig.json

0 commit comments

Comments
 (0)