ci: create npm workspaces and sort out dependencies

This requires at least npm v7.

Reference: https://docs.npmjs.com/cli/v10/using-npm/workspaces

Note: @types/node is pinned at `18.15.3` because it's the last version
which supports TypeScript v4.2.
This commit is contained in:
Damien Arrachequesne
2024-07-04 17:46:33 +02:00
parent 7aedc79436
commit d9b4c3cb03
9 changed files with 14575 additions and 7657 deletions

View File

@@ -32,14 +32,16 @@ jobs:
- name: Install dependencies
run: npm ci
# in order to test our compliance with TypeScript v4.2 (older versions are not tested)
- name: Install TypeScript 4.2
run: npm i typescript@4.2
if: ${{ matrix.node-version == '16' }}
- name: Compile each package
run: npm run compile --workspaces
- name: Run tests
run: npm test
env:
CI: true
run: npm test --workspaces
build-examples:
runs-on: ubuntu-latest

1
.gitignore vendored
View File

@@ -12,3 +12,4 @@ coverage
.idea
.nyc_output
dist/
build/

14551
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

15
package.json Normal file
View File

@@ -0,0 +1,15 @@
{
"private": true,
"workspaces": [
"packages/socket.io-parser",
"packages/socket.io-client",
"packages/socket.io"
],
"overrides": {
"@types/estree": "0.0.52",
"@types/lodash": "4.14.189"
},
"devDependencies": {
"@types/node": "18.15.3"
}
}

View File

@@ -404,6 +404,7 @@ export class Manager<
on(socket, "data", this.ondata.bind(this)),
on(socket, "error", this.onerror.bind(this)),
on(socket, "close", this.onclose.bind(this)),
// @ts-ignore
on(this.decoder, "decoded", this.ondecoded.bind(this))
);
}

View File

@@ -61,7 +61,6 @@
"@rollup/plugin-node-resolve": "^13.0.5",
"@sinonjs/fake-timers": "^7.1.2",
"@types/mocha": "^9.0.0",
"@types/node": "^16.7.6",
"@types/sinonjs__fake-timers": "^6.0.3",
"@wdio/cli": "^7.26.0",
"@wdio/local-runner": "^7.26.0",
@@ -84,7 +83,7 @@
"text-blob-builder": "0.0.1",
"ts-loader": "^8.3.0",
"ts-node": "^10.2.1",
"tsd": "^0.17.0",
"tsd": "^0.27.0",
"typescript": "^4.4.2"
},
"scripts": {

View File

@@ -29,7 +29,6 @@
"@babel/preset-env": "~7.9.6",
"@babel/register": "^7.18.9",
"@types/debug": "^4.1.5",
"@types/node": "^14.11.1",
"@wdio/cli": "^7.26.0",
"@wdio/local-runner": "^7.26.0",
"@wdio/mocha-framework": "^7.26.0",

File diff suppressed because it is too large Load Diff

View File

@@ -413,7 +413,7 @@ describe("server", () => {
const sansTimeout = sio.in("1");
// Without timeout, `emitWithAck` shouldn't accept any events
expectType<never>(
undefined as Parameters<typeof sansTimeout["emitWithAck"]>[0]
undefined as Parameters<(typeof sansTimeout)["emitWithAck"]>[0]
);
// @ts-expect-error - "noArgs" doesn't have a callback and is thus excluded
sio.timeout(0).emitWithAck("noArgs");