Skip to content

Commit ff84dc0

Browse files
committed
fix: use execa for prebiuld script
1 parent 8fdf3cb commit ff84dc0

File tree

5 files changed

+138
-8
lines changed

5 files changed

+138
-8
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ test.js
1414
.cache/
1515
test/typings-compatibility/
1616
/script/*.js
17+
/script/*.mjs
1718
/script/*.d.ts
19+
/script/*.d.mts
1820
/script/*.js.map
21+
/script/*.mjs.map
1922
/script/*/*.js
23+
/script/*/*.mjs
2024
/script/*/*.d.ts
2125
/script/*/*.js.map
2226
tsconfig.tsbuildinfo
27+
tsconfig.esm.tsbuildinfo
2328
/docs-raw
2429
.DS_Store
2530
.idea

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"eslint": "^8",
4141
"eslint-config-atomic": "^1.22.0",
4242
"eslint-plugin-prettier": "^4.2.1",
43+
"execa": "^9.2.0",
4344
"fs-extra": "^10.1.0",
4445
"gh-pages": "^4.0.0",
4546
"minify-all-cli": "^1.0.13",
@@ -84,11 +85,11 @@
8485
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp && shx touch ./tmp/.gitkeep",
8586
"build.library.compat": "shx rm -rf ./lib/ts3.7 && downlevel-dts ./lib ./lib/ts3.7 --to=3.7",
8687
"build.library": "tsc -p ./src/tsconfig.json && run-s build.library.compat",
87-
"build.script": "tsc -p ./script/tsconfig.json",
88+
"build.script": "tsc -p ./script/tsconfig.json && tsc -p ./script/tsconfig.esm.json",
8889
"build.js": "run-p build.script build.library",
8990
"build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-raw -d docs --jsCompressor terser",
9091
"deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"",
91-
"prebuild": "run-s build.js && node ./script/prebuild.js",
92+
"prebuild": "run-s build.js && node ./script/prebuild.mjs",
9293
"build.native": "node-gyp configure --release && node-gyp configure --release -- -f compile_commands_json && node-gyp build --release",
9394
"build.native.debug": "node-gyp configure --debug && node-gyp configure --debug -- -f compile_commands_json && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
9495
"build": "run-s build.js build.native",

pnpm-lock.yaml

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

script/prebuild.ts renamed to script/prebuild.mts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {spawnSync} from "child_process"
2-
3-
main().catch(e => {
4-
throw e
5-
})
1+
import {execaCommandSync} from "execa"
62

73
async function main() {
84
console.log("Building distribution binary...")
@@ -37,13 +33,18 @@ async function main() {
3733
prebuildScript = `/alpine/enter-chroot ${prebuildScript}`
3834
}
3935

40-
spawnSync(prebuildScript, {
36+
execaCommandSync(prebuildScript, {
4137
shell: true,
38+
windowsHide: true,
4239
stdio: "inherit",
4340
encoding: "utf8",
4441
})
4542
}
4643

44+
main().catch(e => {
45+
throw e
46+
})
47+
4748
function getNodearch(): string {
4849
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/strict-boolean-expressions
4950
const arch = process.env.ARCH || process.arch

script/tsconfig.esm.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "ESNext",
5+
"moduleResolution": "node",
6+
},
7+
"include": ["./**/*.mts"],
8+
"exclude": []
9+
}

0 commit comments

Comments
 (0)