From f078447b6eba4c3d404d62bb930757aa1c0efe74 Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Mon, 8 Jan 2024 10:23:37 +0100 Subject: [PATCH] feat!: update helia to v3 and multiformats to v13 (#45) Updates all deps and fixes linting errors. BREAKING CHANGE: uses multiformats v13 and helia v3 --- .github/dependabot.yml | 2 +- .github/workflows/js-test-and-release.yml | 191 ++------------------ .github/workflows/semantic-pull-request.yml | 12 ++ README.md | 21 +-- package.json | 6 +- packages/dag-cbor/README.md | 39 ++-- packages/dag-cbor/package.json | 17 +- packages/interop/README.md | 22 +-- packages/interop/package.json | 16 +- packages/interop/test/dag-json.spec.ts | 3 +- 10 files changed, 100 insertions(+), 229 deletions(-) create mode 100644 .github/workflows/semantic-pull-request.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0bc3b42..d401a77 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ updates: schedule: interval: daily time: "10:00" - open-pull-requests-limit: 10 + open-pull-requests-limit: 20 commit-message: prefix: "deps" prefix-development: "deps(dev)" diff --git a/.github/workflows/js-test-and-release.yml b/.github/workflows/js-test-and-release.yml index a15c379..1d7ff79 100644 --- a/.github/workflows/js-test-and-release.yml +++ b/.github/workflows/js-test-and-release.yml @@ -1,182 +1,27 @@ name: test & maybe release + on: push: branches: - main pull_request: + workflow_dispatch: -jobs: - - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present lint - - run: npm run --if-present dep-check - - run: npm run --if-present doc-check - - test-node: - needs: check - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - node: [lts/*] - fail-fast: true - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:node - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: node - - test-chrome: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:chrome - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: chrome - - test-chrome-webworker: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:chrome-webworker - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: chrome-webworker +permissions: + contents: write + id-token: write + packages: write + pull-requests: write - test-firefox: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:firefox - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: firefox +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }} + cancel-in-progress: true - test-firefox-webworker: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:firefox-webworker - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: firefox-webworker - - test-webkit: - needs: check - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - node: [lts/*] - fail-fast: true - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:webkit - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: webkit - - test-webkit-webworker: - needs: check - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - node: [lts/*] - fail-fast: true - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npm run --if-present test:webkit-webworker - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: webkit-webworker - - test-electron-main: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npx xvfb-maybe npm run --if-present test:electron-main - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: electron-main - - test-electron-renderer: - needs: check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - run: npx xvfb-maybe npm run --if-present test:electron-renderer - - uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1 - with: - flags: electron-renderer - - release: - needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-webkit, test-webkit-webworker, test-electron-main, test-electron-renderer] - runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: ipfs/aegir/actions/cache-node-modules@master - - uses: ipfs/aegir/actions/docker-login@master - with: - docker-token: ${{ secrets.DOCKER_TOKEN }} - docker-username: ${{ secrets.DOCKER_USERNAME }} - - run: npm run --if-present release - env: - GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN || github.token }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +jobs: + js-test-and-release: + uses: pl-strflt/uci/.github/workflows/js-test-and-release.yml@v0.0 + secrets: + DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + UCI_GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN }} diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml new file mode 100644 index 0000000..bd00f09 --- /dev/null +++ b/.github/workflows/semantic-pull-request.yml @@ -0,0 +1,12 @@ +name: Semantic PR + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + uses: pl-strflt/.github/.github/workflows/reusable-semantic-pull-request.yml@v0.3 diff --git a/README.md b/README.md index f99f749..3d28e60 100644 --- a/README.md +++ b/README.md @@ -4,39 +4,34 @@

-# @helia/dag-cbor +# @helia/dag-cbor [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) [![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-dag-cbor.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-dag-cbor) [![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-dag-cbor/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia-dag-cbor/actions/workflows/js-test-and-release.yml?query=branch%3Amain) -> Add/get IPLD blocks containing json with your Helia node - -## Table of contents - -- [Structure](#structure) -- [API Docs](#api-docs) -- [License](#license) -- [Contribute](#contribute) +> Add/get IPLD blocks containing dag-cbor with your Helia node -## Structure +# Packages - [`/packages/dag-cbor`](./packages/dag-cbor) Add/get IPLD blocks containing dag-cbor with your Helia node - [`/packages/interop`](./packages/interop) Interop tests for @helia/dag-cbor -## API Docs +> Add/get IPLD blocks containing json with your Helia node + +# API Docs - -## License +# License Licensed under either of - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) - MIT ([LICENSE-MIT](LICENSE-MIT) / ) -## Contribute +# Contribute Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-dag-cbor/issues). diff --git a/package.json b/package.json index 2a1d8c4..789dbf2 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/helia-dag-cbor/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "ipfs" ], @@ -36,7 +40,7 @@ "docs:no-publish": "NODE_OPTIONS=--max_old_space_size=8192 aegir docs --publish false -- --exclude packages/interop" }, "devDependencies": { - "aegir": "^41.0.0", + "aegir": "^42.0.1", "npm-run-all": "^4.1.5" }, "type": "module", diff --git a/packages/dag-cbor/README.md b/packages/dag-cbor/README.md index 6350b66..6b5078c 100644 --- a/packages/dag-cbor/README.md +++ b/packages/dag-cbor/README.md @@ -4,7 +4,7 @@

-# @helia/dag-cbor +# @helia/dag-cbor [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) @@ -13,21 +13,36 @@ > Add/get IPLD blocks containing dag-cbor with your Helia node -## Table of contents +# About -- [Install](#install) - - [Browser ` ``` -## API Docs +# API Docs - -## License +# License Licensed under either of - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) - MIT ([LICENSE-MIT](LICENSE-MIT) / ) -## Contribute +# Contribute Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-dag-cbor/issues). diff --git a/packages/dag-cbor/package.json b/packages/dag-cbor/package.json index 7aab7be..7425743 100644 --- a/packages/dag-cbor/package.json +++ b/packages/dag-cbor/package.json @@ -3,7 +3,7 @@ "version": "1.0.3", "description": "Add/get IPLD blocks containing dag-cbor with your Helia node", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/helia-dag-cbor/tree/master/packages/dag-cbor#readme", + "homepage": "https://github.com/ipfs/helia-dag-cbor/tree/main/packages/dag-cbor#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/helia-dag-cbor.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/helia-dag-cbor/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "IPFS" ], @@ -31,6 +35,7 @@ "eslintConfig": { "extends": "ipfs", "parserOptions": { + "project": true, "sourceType": "module" } }, @@ -135,15 +140,15 @@ "release": "aegir release" }, "dependencies": { - "@helia/interface": "^2.0.0", + "@helia/interface": "^3.0.0", "@ipld/dag-cbor": "^9.0.0", "@libp2p/interfaces": "^3.3.1", - "interface-blockstore": "^5.0.0", - "multiformats": "^12.0.1", + "multiformats": "^13.0.0", "progress-events": "^1.0.0" }, "devDependencies": { - "aegir": "^41.0.0", - "blockstore-core": "^4.0.1" + "aegir": "^42.0.1", + "blockstore-core": "^4.0.1", + "interface-blockstore": "^5.0.0" } } diff --git a/packages/interop/README.md b/packages/interop/README.md index b7fddf7..807fb09 100644 --- a/packages/interop/README.md +++ b/packages/interop/README.md @@ -4,7 +4,7 @@

-# @helia/dag-cbor-interop +# @helia/dag-cbor-interop [![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech) [![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech) @@ -13,21 +13,13 @@ > Interop tests for @helia/dag-cbor -## Table of contents - -- [Install](#install) - - [Browser ` ``` -## API Docs - -- - -## License +# License Licensed under either of - Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) - MIT ([LICENSE-MIT](LICENSE-MIT) / ) -## Contribute +# Contribute Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-dag-cbor/issues). diff --git a/packages/interop/package.json b/packages/interop/package.json index 4115d05..eef7dff 100644 --- a/packages/interop/package.json +++ b/packages/interop/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "description": "Interop tests for @helia/dag-cbor", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/helia-dag-cbor/tree/master/packages/interop#readme", + "homepage": "https://github.com/ipfs/helia-dag-cbor/tree/main/packages/interop#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/helia-dag-cbor.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/helia-dag-cbor/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "IPFS" ], @@ -31,6 +35,7 @@ "eslintConfig": { "extends": "ipfs", "parserOptions": { + "project": true, "sourceType": "module" } }, @@ -49,16 +54,17 @@ }, "devDependencies": { "@helia/dag-cbor": "^1.0.0", - "@helia/interface": "^2.0.0", + "@helia/interface": "^3.0.0", "@ipld/dag-cbor": "^9.0.0", - "@libp2p/websockets": "^7.0.5", - "aegir": "^41.0.0", + "@libp2p/websockets": "^8.0.10", + "aegir": "^42.0.1", "go-ipfs": "^0.22.0", - "helia": "^2.0.1", + "helia": "^3.0.0", "ipfs-core-types": "^0.14.0", "ipfsd-ctl": "^13.0.0", "kubo-rpc-client": "^3.0.0", "merge-options": "^3.0.4", + "multiformats": "^13.0.0", "wherearewe": "^2.0.1" }, "browser": { diff --git a/packages/interop/test/dag-json.spec.ts b/packages/interop/test/dag-json.spec.ts index dd4ef3e..6bbc4cf 100644 --- a/packages/interop/test/dag-json.spec.ts +++ b/packages/interop/test/dag-json.spec.ts @@ -3,6 +3,7 @@ import { dagCbor, type DAGCBOR, type AddOptions } from '@helia/dag-cbor' import * as codec from '@ipld/dag-cbor' import { expect } from 'aegir/chai' +import { CID } from 'multiformats/cid' import { createHeliaNode } from './fixtures/create-helia.js' import { createKuboNode } from './fixtures/create-kubo.js' import type { Helia } from '@helia/interface' @@ -57,7 +58,7 @@ describe('dag-json interop', () => { it('should add to kubo and fetch from helia', async () => { const input = { hello: 'world' } const cid = await kubo.api.block.put(codec.encode(input)) - const output = await d.get(cid) + const output = await d.get(CID.parse(cid.toString())) expect(output).to.deep.equal(input) })