Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: switch upload-api to node16 #509

Merged
merged 2 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/upload-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup
uses: actions/setup-node@v3
with:
node-version: 18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to matrix test w/ both 16 and 18 if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it is worth it, because doing it in ucanto increases test time significantly. If we ever find that something does not work in node 18 lets add then.

node-version: 16
registry-url: https://registry.npmjs.org/
cache: 'pnpm'

Expand All @@ -60,7 +60,7 @@ jobs:
- name: Setup
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 16
registry-url: https://registry.npmjs.org/
cache: 'pnpm'

Expand Down
28 changes: 25 additions & 3 deletions packages/upload-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
"version": "1.0.2",
"type": "module",
"main": "./src/lib.js",
"files": [
"src",
"test",
"dist/src/**/*.d.ts",
"dist/src/**/*.d.ts.map"
],
"typesVersions": {
"*": {
"src/lib.js": [
Expand Down Expand Up @@ -48,8 +54,8 @@
"build": "tsc --build",
"check": "tsc --build",
"lint": "tsc --build",
"test": "mocha --bail --timeout 10s -n no-warnings -n experimental-vm-modules test/**/*.spec.js",
"test-watch": "pnpm build && mocha --bail --timeout 10s --watch --parallel -n no-warnings -n experimental-vm-modules --watch-files src,test"
"test": "mocha --bail --timeout 10s -n no-warnings -n experimental-vm-modules -n experimental-fetch test/**/*.spec.js",
"test-watch": "pnpm build && mocha --bail --timeout 10s --watch --parallel -n no-warnings -n experimental-vm-modules -n experimental-fetch --watch-files src,test"
},
"dependencies": {
"@ucanto/client": "^5.1.0",
Expand All @@ -66,7 +72,9 @@
"@types/mocha": "^10.0.1",
"@ucanto/core": "^5.1.0",
"@web3-storage/sigv4": "^1.0.2",
"mocha": "^10.2.0"
"@web-std/blob": "^3.0.4",
"mocha": "^10.2.0",
"hd-scripts": "^4.1.0"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -104,6 +112,20 @@
"coverage"
]
},
"depcheck": {
"specials": [
"bin"
],
"ignorePatterns": [
"dist"
],
"ignores": [
"dist",
"@types/*",
"hd-scripts",
"eslint-config-prettier"
]
},
"engines": {
"node": ">=16.15"
}
Expand Down
8 changes: 7 additions & 1 deletion packages/upload-api/test/car-store-bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export class CarStoreBucket {
}

response.end()
// otherwise it keep connection lingering
response.destroy()
})
await new Promise((resolve) => server.listen(resolve))

Expand Down Expand Up @@ -80,7 +82,11 @@ export class CarStoreBucket {
*/
deactivate() {
return new Promise((resolve, reject) => {
this.server.closeAllConnections()
// does not exist in node 16
if (typeof this.server.closeAllConnections === 'function') {
this.server.closeAllConnections()
}

this.server.close((error) => {
if (error) {
reject(error)
Expand Down
1 change: 1 addition & 0 deletions packages/upload-api/test/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { sha256 } from 'multiformats/hashes/sha2'
import * as CAR from '@ucanto/transport/car'
import * as raw from 'multiformats/codecs/raw'
import { CarWriter } from '@ipld/car'
import { Blob } from '@web-std/blob'

/** did:key:z6Mkk89bC3JrVqKie71YEcc5M1SMVxuCgNx6zLZ8SYJsxALi */
export const alice = ed25519.parse(
Expand Down
39 changes: 34 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.