Skip to content

Commit ce2d28a

Browse files
chore: use node strip types instead of tsx
1 parent 6b3df5e commit ce2d28a

File tree

4 files changed

+15
-986
lines changed

4 files changed

+15
-986
lines changed

bin/sync.ts renamed to bin/sync.mts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/* eslint-disable import/no-extraneous-dependencies */
22

33
import { writeFileSync } from "fs";
4-
import { join } from "path";
54

6-
import * as z from "zod";
5+
import { z } from "zod";
76

87
const sourceUrl = (branch = "master") =>
98
`https://github.com/postgres/postgres/raw/${branch}/src/backend/utils/errcodes.txt`;
@@ -107,7 +106,14 @@ const getEnum = async () => {
107106
};
108107

109108
const writeEnum = (enumString: string) => {
110-
writeFileSync(join(__dirname, "../src/PostgresError.ts"), enumString);
109+
writeFileSync(
110+
new URL(
111+
"../src/PostgresError.ts",
112+
// @ts-expect-error requires package.json type: module
113+
import.meta.url,
114+
),
115+
enumString,
116+
);
111117
};
112118

113119
void getEnum()

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"types": "dist/index.d.ts",
1717
"packageManager": "[email protected]+sha512.5383cc12567a95f1d668fbe762dfe0075c595b4bfff433be478dbbe24e05251a8e8c3eb992a986667c1d53b6c3a9c85b8398c35a960587fbd9fa3a0915406728",
1818
"scripts": {
19-
"sync": "tsx bin/sync.ts",
19+
"sync": "node --experimental-strip-types bin/sync.mts",
2020
"clean": "rm -rf ./dist/",
2121
"typecheck": "tsc --noEmit --project tsconfig.json && tsc --noEmit --project tsconfig.build.json",
2222
"build": "tsc --build tsconfig.build.json",
@@ -36,7 +36,6 @@
3636
"knip": "^5.43.6",
3737
"lefthook": "^1.10.10",
3838
"prettier": "^3.4.2",
39-
"tsx": "^4.19.2",
4039
"typescript": "^5.7.3",
4140
"typescript-eslint": "^8.23.0",
4241
"zod": "^3.24.1"

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"files": [
1616
"src/index.ts",
1717
"src/PostgresError.ts",
18-
"bin/sync.ts",
18+
"bin/sync.mts",
1919
"bin/test.js",
2020
"eslint.config.mjs"
2121
]

0 commit comments

Comments
 (0)