diff --git a/.github/workflows/e2e-git-installs.yml b/.github/workflows/e2e-git-installs.yml index 0047cbcc1..0dd9a3667 100644 --- a/.github/workflows/e2e-git-installs.yml +++ b/.github/workflows/e2e-git-installs.yml @@ -28,7 +28,7 @@ jobs: run: | npm --version echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json - npm install https://github.com/TypeStrong/ts-node#main + npm install https://github.com/TypeStrong/ts-node#${{ github.ref_name }} npm test pnpm: name: "pnpm" @@ -49,7 +49,7 @@ jobs: corepack prepare pnpm@latest --activate pnpm --version echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json - pnpm install https://github.com/TypeStrong/ts-node#main + pnpm install https://github.com/TypeStrong/ts-node#${{ github.ref_name }} pnpm test yarn: name: "yarn" @@ -70,7 +70,7 @@ jobs: corepack prepare yarn@stable --activate yarn --version echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json - yarn add ts-node@https://github.com/TypeStrong/ts-node#main + yarn add ts-node@https://github.com/TypeStrong/ts-node#${{ github.ref_name }} yarn add typescript yarn test yarn1: @@ -93,5 +93,5 @@ jobs: yarn --version yarn cache list echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json - yarn add https://github.com/TypeStrong/ts-node#main + yarn add https://github.com/TypeStrong/ts-node#${{ github.ref_name }} yarn test diff --git a/package.json b/package.json index 01476a59f..dc0ea0d92 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,7 @@ "@types/semver": "^7.1.0", "ava": "^5.1.1", "axios": "^0.21.1", + "cross-spawn": "^7.0.3", "dprint": "^0.25.0", "expect": "27.0.2", "lodash": "^4.17.15", diff --git a/scripts/prepack.mjs b/scripts/prepack.mjs index 2a26d6326..e458fe8f0 100644 --- a/scripts/prepack.mjs +++ b/scripts/prepack.mjs @@ -1,18 +1,12 @@ -import { spawnSync } from 'child_process'; -const { npm_node_execpath, npm_execpath } = process.env; -import { readFileSync } from 'fs'; +const { npm_execpath } = process.env; // prepack is executed by user's package manager when they install from git // So cannot assume yarn if (process.env.TS_NODE_SKIP_PREPACK == null) { - if (readFileSync(npm_execpath, 'utf8').match(/^#!.*sh/)) { - spawnSync(npm_execpath, ['run', 'prepack-worker'], { - stdio: 'inherit', - }); - } else { - spawnSync(npm_node_execpath, [npm_execpath, 'run', 'prepack-worker'], { - stdio: 'inherit', - }); - } + const crossSpawn = await import('cross-spawn'); + const result = crossSpawn.sync(npm_execpath, ['run', 'prepack-worker'], { + stdio: 'inherit', + }); + process.exit(result.status); } diff --git a/yarn.lock b/yarn.lock index c6150dfcd..22468f8f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3825,6 +3825,7 @@ __metadata: arg: ^4.1.0 ava: ^5.1.1 axios: ^0.21.1 + cross-spawn: ^7.0.3 diff: ^4.0.1 dprint: ^0.25.0 expect: 27.0.2