Skip to content

Commit

Permalink
installation from git in various package managers: add e2e, fix (#2010)
Browse files Browse the repository at this point in the history
* add e2e tests for installing ts-node from git w/various package managers
* fix installation from git, add workaround for npm bugs
  • Loading branch information
cspotcode committed May 7, 2023
1 parent 71dcfd7 commit 0bf1366
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 22 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/e2e-git-installs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: E2E Install from git
# TODO test global installs, too?
on:
# nightly
schedule:
- cron: '0 0 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
npm:
name: "npm"
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
steps:
# install node
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Test
run: |
npm --version
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
npm install https://github.com/TypeStrong/ts-node#main
npm test
pnpm:
name: "pnpm"
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
steps:
# install node
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Test
run: |
corepack enable
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 test
yarn:
name: "yarn"
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
steps:
# install node
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Test
run: |
corepack enable
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 typescript
yarn test
yarn1:
name: "yarn1 (officially *not* supported)"
runs-on: ${{ matrix.os }}-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows]
steps:
# install node
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Test
run: |
npm install -g yarn
yarn --version
yarn cache list
echo '{"scripts": {"test": "ts-node -vvv"}}' > package.json
yarn add https://github.com/TypeStrong/ts-node#main
yarn test
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ __prepack_template__ *ARGS:
just clean && just build-nopack "$@"
prepack *ARGS:
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 "$@"
prepare *ARGS:
workaround-broken-npm-prepack-behavior prepack "$@"
api-extractor *ARGS:
api-extractor run --local --verbose "$@"
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"coverage-report": "nyc report --reporter=lcov",
"__prepack_template__": "yarn clean && yarn build-nopack",
"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",
"prepare": "workaround-broken-npm-prepack-behavior prepack",
"api-extractor": "api-extractor run --local --verbose"
},
"repository": {
Expand Down Expand Up @@ -108,12 +109,12 @@
},
"homepage": "https://typestrong.org/ts-node",
"devDependencies": {
"@TypeStrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#8abd1494280116ff5318dde2c50ad01e1663790c",
"@cspotcode/ava-lib": "github:cspotcode/ava-lib#edcc1885d192d08d5af83490af9341468402ec41",
"@cspotcode/expect-stream": "github:cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f",
"@TypeStrong/fs-fixture-builder": "https://github.com/Typestrong/fs-fixture-builder.git#3099e53621daf99db971af29c96145dc115693cd",
"@cspotcode/ava-lib": "https://github.com/cspotcode/ava-lib#bbbed83f393342b51dc6caf2ddf775a3e89371d8",
"@cspotcode/expect-stream": "https://github.com/cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f",
"@microsoft/api-extractor": "^7.19.4",
"@swc/core": ">=1.3.32",
"@swc/wasm": ">=1.3.32",
"@swc/core": "1.3.32",
"@swc/wasm": "1.3.32",
"@types/diff": "^4.0.2",
"@types/lodash": "^4.14.151",
"@types/node": "13.13.5",
Expand All @@ -136,7 +137,8 @@
"throat": "^6.0.1",
"typedoc": "^0.22.10",
"typescript": "4.7.4",
"typescript-json-schema": "^0.54.0"
"typescript-json-schema": "^0.54.0",
"workaround-broken-npm-prepack-behavior": "https://github.com/cspotcode/workaround-broken-npm-prepack-behavior#1a7adbbb8a527784daf97edad6ba42d6e96611f6"
},
"peerDependencies": {
"@swc/core": ">=1.2.50",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const { join } = require('path');
const rootDir = join(__dirname, '..');
const testDir = join(__dirname, '../tests');
const tarballPath = join(testDir, 'ts-node-packed.tgz');
exec(`yarn pack --out "${tarballPath}"`, { cwd: rootDir }, (err, stdout) => {
exec(`yarn pack --out "${tarballPath}"`, { cwd: rootDir }, (err, stdout) => {
if (err) {
console.error(err);
process.exit(1);
Expand Down
40 changes: 25 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ __metadata:
version: 6
cacheKey: 8

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

Expand Down Expand Up @@ -241,20 +241,20 @@ __metadata:
languageName: node
linkType: hard

"@cspotcode/ava-lib@github:cspotcode/ava-lib#edcc1885d192d08d5af83490af9341468402ec41":
"@cspotcode/ava-lib@https://github.com/cspotcode/ava-lib#bbbed83f393342b51dc6caf2ddf775a3e89371d8":
version: 0.0.1
resolution: "@cspotcode/ava-lib@https://github.com/cspotcode/ava-lib.git#commit=edcc1885d192d08d5af83490af9341468402ec41"
resolution: "@cspotcode/ava-lib@https://github.com/cspotcode/ava-lib.git#commit=bbbed83f393342b51dc6caf2ddf775a3e89371d8"
dependencies:
"@types/node": "*"
throat: ^6.0.1
peerDependencies:
ava: "*"
expect: "*"
checksum: 82a6ad95a7bb32d9183fdf77e2bd4b16cb4c7e97c9dfee34e30c8ffcabc4dd3c10fa5b2c5781cf4a443e12d43ad3b01df59814492d81777d4f3876fc4846d3f2
checksum: 3ca30bbfe81abb537e1e96addd272b34daf19ecba56f13a5785115bc3433dc5309e733ab8440384531b7a74b88f58eb11c9151e62b75c5c219eccc7dd8b058ec
languageName: node
linkType: hard

"@cspotcode/expect-stream@github:cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f":
"@cspotcode/expect-stream@https://github.com/cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f":
version: 0.0.0
resolution: "@cspotcode/expect-stream@https://github.com/cspotcode/node-expect-stream.git#commit=4e425ff1eef240003af8716291e80fbaf3e3ae8f"
checksum: 32d78cccd0df519e7c6ac8a38d980d857877178e86ee5c82cce94ffbeecc11808c7eada0a83188bb1fe32852cc48a56c40b1f5a7bacb2a1d59881a214f999eaf
Expand Down Expand Up @@ -580,7 +580,7 @@ __metadata:
languageName: node
linkType: hard

"@swc/core@npm:>=1.3.32":
"@swc/core@npm:1.3.32":
version: 1.3.32
resolution: "@swc/core@npm:1.3.32"
dependencies:
Expand Down Expand Up @@ -619,7 +619,7 @@ __metadata:
languageName: node
linkType: hard

"@swc/wasm@npm:>=1.3.32":
"@swc/wasm@npm:1.3.32":
version: 1.3.32
resolution: "@swc/wasm@npm:1.3.32"
checksum: 80df9b6983f4211e049592f210762dfbbd19899a24d37bf3dad7d8c2ede6fee70c7945cca3c508dae24e6b7f4a14b0ca6d645648fab01694ac4e93fda1ced379
Expand Down Expand Up @@ -3802,13 +3802,13 @@ __metadata:
version: 0.0.0-use.local
resolution: "ts-node@workspace:."
dependencies:
"@TypeStrong/fs-fixture-builder": "github:TypeStrong/fs-fixture-builder#8abd1494280116ff5318dde2c50ad01e1663790c"
"@cspotcode/ava-lib": "github:cspotcode/ava-lib#edcc1885d192d08d5af83490af9341468402ec41"
"@cspotcode/expect-stream": "github:cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f"
"@TypeStrong/fs-fixture-builder": "https://github.com/Typestrong/fs-fixture-builder.git#3099e53621daf99db971af29c96145dc115693cd"
"@cspotcode/ava-lib": "https://github.com/cspotcode/ava-lib#bbbed83f393342b51dc6caf2ddf775a3e89371d8"
"@cspotcode/expect-stream": "https://github.com/cspotcode/node-expect-stream#4e425ff1eef240003af8716291e80fbaf3e3ae8f"
"@cspotcode/source-map-support": ^0.8.0
"@microsoft/api-extractor": ^7.19.4
"@swc/core": ">=1.3.32"
"@swc/wasm": ">=1.3.32"
"@swc/core": 1.3.32
"@swc/wasm": 1.3.32
"@tsconfig/node14": "*"
"@tsconfig/node16": "*"
"@tsconfig/node18": "*"
Expand Down Expand Up @@ -3841,6 +3841,7 @@ __metadata:
typescript: 4.7.4
typescript-json-schema: ^0.54.0
v8-compile-cache-lib: ^3.0.1
workaround-broken-npm-prepack-behavior: "https://github.com/cspotcode/workaround-broken-npm-prepack-behavior#1a7adbbb8a527784daf97edad6ba42d6e96611f6"
peerDependencies:
"@swc/core": ">=1.2.50"
"@swc/wasm": ">=1.2.50"
Expand Down Expand Up @@ -4064,6 +4065,15 @@ __metadata:
languageName: node
linkType: hard

"workaround-broken-npm-prepack-behavior@https://github.com/cspotcode/workaround-broken-npm-prepack-behavior#1a7adbbb8a527784daf97edad6ba42d6e96611f6":
version: 0.0.1
resolution: "workaround-broken-npm-prepack-behavior@https://github.com/cspotcode/workaround-broken-npm-prepack-behavior.git#commit=1a7adbbb8a527784daf97edad6ba42d6e96611f6"
bin:
workaround-broken-npm-prepack-behavior: bin.mjs
checksum: aa4f5bb6ff0560f510abb9f4290f1e239ce97166da108880e41b2247928039a709ffe237d1255231e427cc9848d969eea54574d58aebe9174296cc6efbbe4e9a
languageName: node
linkType: hard

"wrap-ansi@npm:^6.2.0":
version: 6.2.0
resolution: "wrap-ansi@npm:6.2.0"
Expand Down

0 comments on commit 0bf1366

Please sign in to comment.