Skip to content

Commit 0bf1366

Browse files
authored
installation from git in various package managers: add e2e, fix (#2010)
* add e2e tests for installing ts-node from git w/various package managers * fix installation from git, add workaround for npm bugs
1 parent 71dcfd7 commit 0bf1366

File tree

5 files changed

+131
-22
lines changed

5 files changed

+131
-22
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: E2E Install from git
2+
# TODO test global installs, too?
3+
on:
4+
# nightly
5+
schedule:
6+
- cron: '0 0 * * *'
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
permissions:
10+
contents: read # to fetch code (actions/checkout)
11+
jobs:
12+
npm:
13+
name: "npm"
14+
runs-on: ${{ matrix.os }}-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu, windows]
19+
steps:
20+
# install node
21+
- name: Use Node.js 18
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 18
25+
- name: Test
26+
run: |
27+
npm --version
28+
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
29+
npm install https://github.com/TypeStrong/ts-node#main
30+
npm test
31+
pnpm:
32+
name: "pnpm"
33+
runs-on: ${{ matrix.os }}-latest
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
os: [ubuntu, windows]
38+
steps:
39+
# install node
40+
- name: Use Node.js 18
41+
uses: actions/setup-node@v3
42+
with:
43+
node-version: 18
44+
- name: Test
45+
run: |
46+
corepack enable
47+
corepack prepare pnpm@latest --activate
48+
pnpm --version
49+
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
50+
pnpm install https://github.com/TypeStrong/ts-node#main
51+
pnpm test
52+
yarn:
53+
name: "yarn"
54+
runs-on: ${{ matrix.os }}-latest
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
os: [ubuntu, windows]
59+
steps:
60+
# install node
61+
- name: Use Node.js 18
62+
uses: actions/setup-node@v3
63+
with:
64+
node-version: 18
65+
- name: Test
66+
run: |
67+
corepack enable
68+
corepack prepare yarn@stable --activate
69+
yarn --version
70+
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
71+
yarn add ts-node@https://github.com/TypeStrong/ts-node#main
72+
yarn add typescript
73+
yarn test
74+
yarn1:
75+
name: "yarn1 (officially *not* supported)"
76+
runs-on: ${{ matrix.os }}-latest
77+
continue-on-error: true
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
os: [ubuntu, windows]
82+
steps:
83+
# install node
84+
- name: Use Node.js 18
85+
uses: actions/setup-node@v3
86+
with:
87+
node-version: 18
88+
- name: Test
89+
run: |
90+
npm install -g yarn
91+
yarn --version
92+
yarn cache list
93+
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
94+
yarn add https://github.com/TypeStrong/ts-node#main
95+
yarn test

justfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,7 @@ __prepack_template__ *ARGS:
6868
just clean && just build-nopack "$@"
6969
prepack *ARGS:
7070
rimraf temp dist tsconfig.schema.json tsconfig.schemastore-schema.json tsconfig.tsbuildinfo tests/ts-node-packed.tgz tests/node_modules tests/tmp && tsc -b ./tsconfig.build-dist.json && typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema "$@"
71+
prepare *ARGS:
72+
workaround-broken-npm-prepack-behavior prepack "$@"
7173
api-extractor *ARGS:
7274
api-extractor run --local --verbose "$@"

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"coverage-report": "nyc report --reporter=lcov",
7777
"__prepack_template__": "yarn clean && yarn build-nopack",
7878
"prepack": "rimraf temp dist tsconfig.schema.json tsconfig.schemastore-schema.json tsconfig.tsbuildinfo tests/ts-node-packed.tgz tests/node_modules tests/tmp && tsc -b ./tsconfig.build-dist.json && typescript-json-schema --topRef --refs --validationKeywords allOf --out tsconfig.schema.json tsconfig.build-schema.json TsConfigSchema && node --require ./register ./scripts/create-merged-schema",
79+
"prepare": "workaround-broken-npm-prepack-behavior prepack",
7980
"api-extractor": "api-extractor run --local --verbose"
8081
},
8182
"repository": {
@@ -108,12 +109,12 @@
108109
},
109110
"homepage": "https://typestrong.org/ts-node",
110111
"devDependencies": {
111-
"@TypeStrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#8abd1494280116ff5318dde2c50ad01e1663790c",
112-
"@cspotcode/ava-lib": "github:cspotcode/ava-lib#edcc1885d192d08d5af83490af9341468402ec41",
113-
"@cspotcode/expect-stream": "github:cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f",
112+
"@TypeStrong/fs-fixture-builder": "https://github.com/Typestrong/fs-fixture-builder.git#3099e53621daf99db971af29c96145dc115693cd",
113+
"@cspotcode/ava-lib": "https://github.com/cspotcode/ava-lib#bbbed83f393342b51dc6caf2ddf775a3e89371d8",
114+
"@cspotcode/expect-stream": "https://github.com/cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f",
114115
"@microsoft/api-extractor": "^7.19.4",
115-
"@swc/core": ">=1.3.32",
116-
"@swc/wasm": ">=1.3.32",
116+
"@swc/core": "1.3.32",
117+
"@swc/wasm": "1.3.32",
117118
"@types/diff": "^4.0.2",
118119
"@types/lodash": "^4.14.151",
119120
"@types/node": "13.13.5",
@@ -136,7 +137,8 @@
136137
"throat": "^6.0.1",
137138
"typedoc": "^0.22.10",
138139
"typescript": "4.7.4",
139-
"typescript-json-schema": "^0.54.0"
140+
"typescript-json-schema": "^0.54.0",
141+
"workaround-broken-npm-prepack-behavior": "https://github.com/cspotcode/workaround-broken-npm-prepack-behavior#1a7adbbb8a527784daf97edad6ba42d6e96611f6"
140142
},
141143
"peerDependencies": {
142144
"@swc/core": ">=1.2.50",

scripts/build-pack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { join } = require('path');
77
const rootDir = join(__dirname, '..');
88
const testDir = join(__dirname, '../tests');
99
const tarballPath = join(testDir, 'ts-node-packed.tgz');
10-
exec(`yarn pack --out "${tarballPath}"`, { cwd: rootDir }, (err, stdout) => {
10+
exec(`yarn pack --out "${tarballPath}"`, { cwd: rootDir }, (err, stdout) => {
1111
if (err) {
1212
console.error(err);
1313
process.exit(1);

yarn.lock

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ __metadata:
55
version: 6
66
cacheKey: 8
77

8-
"@TypeStrong/fs-fixture-builder@github:TypeStrong/fs-fixture-builder#8abd1494280116ff5318dde2c50ad01e1663790c":
8+
"@TypeStrong/fs-fixture-builder@https://github.com/Typestrong/fs-fixture-builder.git#3099e53621daf99db971af29c96145dc115693cd":
99
version: 0.0.0
10-
resolution: "@TypeStrong/fs-fixture-builder@https://github.com/TypeStrong/fs-fixture-builder.git#commit=8abd1494280116ff5318dde2c50ad01e1663790c"
10+
resolution: "@TypeStrong/fs-fixture-builder@https://github.com/Typestrong/fs-fixture-builder.git#commit=3099e53621daf99db971af29c96145dc115693cd"
1111
bin:
12-
capture-fs-fixture: ./dist/capture-fixture.ts
13-
checksum: f9fc2cdf58b79470373fbac56449540c8c727553f13b9a402e5dcec47b0c909fca2d246cb09f6b55632ff823fa4da3332a593f18720e4227f88478be566898c1
12+
capture-fs-fixture: ./dist/capture-fixture.js
13+
checksum: f95f5f84c8f578a3ca1862a1b43d5e063fb3cda86dc585ea84d5b612aa3f7e6a5d80d17440e81f659ed32ba7bc4ad2830b7695d953ef06ecbe7796482ad754e1
1414
languageName: node
1515
linkType: hard
1616

@@ -241,20 +241,20 @@ __metadata:
241241
languageName: node
242242
linkType: hard
243243

244-
"@cspotcode/ava-lib@github:cspotcode/ava-lib#edcc1885d192d08d5af83490af9341468402ec41":
244+
"@cspotcode/ava-lib@https://github.com/cspotcode/ava-lib#bbbed83f393342b51dc6caf2ddf775a3e89371d8":
245245
version: 0.0.1
246-
resolution: "@cspotcode/ava-lib@https://github.com/cspotcode/ava-lib.git#commit=edcc1885d192d08d5af83490af9341468402ec41"
246+
resolution: "@cspotcode/ava-lib@https://github.com/cspotcode/ava-lib.git#commit=bbbed83f393342b51dc6caf2ddf775a3e89371d8"
247247
dependencies:
248248
"@types/node": "*"
249249
throat: ^6.0.1
250250
peerDependencies:
251251
ava: "*"
252252
expect: "*"
253-
checksum: 82a6ad95a7bb32d9183fdf77e2bd4b16cb4c7e97c9dfee34e30c8ffcabc4dd3c10fa5b2c5781cf4a443e12d43ad3b01df59814492d81777d4f3876fc4846d3f2
253+
checksum: 3ca30bbfe81abb537e1e96addd272b34daf19ecba56f13a5785115bc3433dc5309e733ab8440384531b7a74b88f58eb11c9151e62b75c5c219eccc7dd8b058ec
254254
languageName: node
255255
linkType: hard
256256

257-
"@cspotcode/expect-stream@github:cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f":
257+
"@cspotcode/expect-stream@https://github.com/cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f":
258258
version: 0.0.0
259259
resolution: "@cspotcode/expect-stream@https://github.com/cspotcode/node-expect-stream.git#commit=4e425ff1eef240003af8716291e80fbaf3e3ae8f"
260260
checksum: 32d78cccd0df519e7c6ac8a38d980d857877178e86ee5c82cce94ffbeecc11808c7eada0a83188bb1fe32852cc48a56c40b1f5a7bacb2a1d59881a214f999eaf
@@ -580,7 +580,7 @@ __metadata:
580580
languageName: node
581581
linkType: hard
582582

583-
"@swc/core@npm:>=1.3.32":
583+
"@swc/core@npm:1.3.32":
584584
version: 1.3.32
585585
resolution: "@swc/core@npm:1.3.32"
586586
dependencies:
@@ -619,7 +619,7 @@ __metadata:
619619
languageName: node
620620
linkType: hard
621621

622-
"@swc/wasm@npm:>=1.3.32":
622+
"@swc/wasm@npm:1.3.32":
623623
version: 1.3.32
624624
resolution: "@swc/wasm@npm:1.3.32"
625625
checksum: 80df9b6983f4211e049592f210762dfbbd19899a24d37bf3dad7d8c2ede6fee70c7945cca3c508dae24e6b7f4a14b0ca6d645648fab01694ac4e93fda1ced379
@@ -3802,13 +3802,13 @@ __metadata:
38023802
version: 0.0.0-use.local
38033803
resolution: "ts-node@workspace:."
38043804
dependencies:
3805-
"@TypeStrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#8abd1494280116ff5318dde2c50ad01e1663790c"
3806-
"@cspotcode/ava-lib": "github:cspotcode/ava-lib#edcc1885d192d08d5af83490af9341468402ec41"
3807-
"@cspotcode/expect-stream": "github:cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f"
3805+
"@TypeStrong/fs-fixture-builder": "https://github.com/Typestrong/fs-fixture-builder.git#3099e53621daf99db971af29c96145dc115693cd"
3806+
"@cspotcode/ava-lib": "https://github.com/cspotcode/ava-lib#bbbed83f393342b51dc6caf2ddf775a3e89371d8"
3807+
"@cspotcode/expect-stream": "https://github.com/cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f"
38083808
"@cspotcode/source-map-support": ^0.8.0
38093809
"@microsoft/api-extractor": ^7.19.4
3810-
"@swc/core": ">=1.3.32"
3811-
"@swc/wasm": ">=1.3.32"
3810+
"@swc/core": 1.3.32
3811+
"@swc/wasm": 1.3.32
38123812
"@tsconfig/node14": "*"
38133813
"@tsconfig/node16": "*"
38143814
"@tsconfig/node18": "*"
@@ -3841,6 +3841,7 @@ __metadata:
38413841
typescript: 4.7.4
38423842
typescript-json-schema: ^0.54.0
38433843
v8-compile-cache-lib: ^3.0.1
3844+
workaround-broken-npm-prepack-behavior: "https://github.com/cspotcode/workaround-broken-npm-prepack-behavior#1a7adbbb8a527784daf97edad6ba42d6e96611f6"
38443845
peerDependencies:
38453846
"@swc/core": ">=1.2.50"
38463847
"@swc/wasm": ">=1.2.50"
@@ -4064,6 +4065,15 @@ __metadata:
40644065
languageName: node
40654066
linkType: hard
40664067

4068+
"workaround-broken-npm-prepack-behavior@https://github.com/cspotcode/workaround-broken-npm-prepack-behavior#1a7adbbb8a527784daf97edad6ba42d6e96611f6":
4069+
version: 0.0.1
4070+
resolution: "workaround-broken-npm-prepack-behavior@https://github.com/cspotcode/workaround-broken-npm-prepack-behavior.git#commit=1a7adbbb8a527784daf97edad6ba42d6e96611f6"
4071+
bin:
4072+
workaround-broken-npm-prepack-behavior: bin.mjs
4073+
checksum: aa4f5bb6ff0560f510abb9f4290f1e239ce97166da108880e41b2247928039a709ffe237d1255231e427cc9848d969eea54574d58aebe9174296cc6efbbe4e9a
4074+
languageName: node
4075+
linkType: hard
4076+
40674077
"wrap-ansi@npm:^6.2.0":
40684078
version: 6.2.0
40694079
resolution: "wrap-ansi@npm:6.2.0"

0 commit comments

Comments
 (0)