Skip to content

Commit 7af5c48

Browse files
authored
Fix windows git install (TypeStrong#2017)
* fix git install on windows w/yarn due to spawn issue(?) * try e2e * tweak e2e * fix * turn off e2es; it works
1 parent 89a266d commit 7af5c48

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

.github/workflows/e2e-git-installs.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
npm --version
3030
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
31-
npm install https://github.com/TypeStrong/ts-node#main
31+
npm install https://github.com/TypeStrong/ts-node#${{ github.ref_name }}
3232
npm test
3333
pnpm:
3434
name: "pnpm"
@@ -49,7 +49,7 @@ jobs:
4949
corepack prepare pnpm@latest --activate
5050
pnpm --version
5151
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
52-
pnpm install https://github.com/TypeStrong/ts-node#main
52+
pnpm install https://github.com/TypeStrong/ts-node#${{ github.ref_name }}
5353
pnpm test
5454
yarn:
5555
name: "yarn"
@@ -70,7 +70,7 @@ jobs:
7070
corepack prepare yarn@stable --activate
7171
yarn --version
7272
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
73-
yarn add ts-node@https://github.com/TypeStrong/ts-node#main
73+
yarn add ts-node@https://github.com/TypeStrong/ts-node#${{ github.ref_name }}
7474
yarn add typescript
7575
yarn test
7676
yarn1:
@@ -93,5 +93,5 @@ jobs:
9393
yarn --version
9494
yarn cache list
9595
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
96-
yarn add https://github.com/TypeStrong/ts-node#main
96+
yarn add https://github.com/TypeStrong/ts-node#${{ github.ref_name }}
9797
yarn test

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
"@types/semver": "^7.1.0",
127127
"ava": "^5.1.1",
128128
"axios": "^0.21.1",
129+
"cross-spawn": "^7.0.3",
129130
"dprint": "^0.25.0",
130131
"expect": "27.0.2",
131132
"lodash": "^4.17.15",

scripts/prepack.mjs

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
import { spawnSync } from 'child_process';
2-
const { npm_node_execpath, npm_execpath } = process.env;
3-
import { readFileSync } from 'fs';
1+
const { npm_execpath } = process.env;
42

53
// prepack is executed by user's package manager when they install from git
64
// So cannot assume yarn
75

86
if (process.env.TS_NODE_SKIP_PREPACK == null) {
9-
if (readFileSync(npm_execpath, 'utf8').match(/^#!.*sh/)) {
10-
spawnSync(npm_execpath, ['run', 'prepack-worker'], {
11-
stdio: 'inherit',
12-
});
13-
} else {
14-
spawnSync(npm_node_execpath, [npm_execpath, 'run', 'prepack-worker'], {
15-
stdio: 'inherit',
16-
});
17-
}
7+
const crossSpawn = await import('cross-spawn');
8+
const result = crossSpawn.sync(npm_execpath, ['run', 'prepack-worker'], {
9+
stdio: 'inherit',
10+
});
11+
process.exit(result.status);
1812
}

yarn.lock

+1
Original file line numberDiff line numberDiff line change
@@ -3825,6 +3825,7 @@ __metadata:
38253825
arg: ^4.1.0
38263826
ava: ^5.1.1
38273827
axios: ^0.21.1
3828+
cross-spawn: ^7.0.3
38283829
diff: ^4.0.1
38293830
dprint: ^0.25.0
38303831
expect: 27.0.2

0 commit comments

Comments
 (0)