From ae7cbc9a16a267cb0f6d7cecd381f919430afaea Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Mon, 8 Jan 2024 10:21:05 +0100 Subject: [PATCH] feat!: update helia to v3 and multiformats to v13 (#87) 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 | 17 +- package.json | 6 +- packages/interop/README.md | 32 +-- packages/interop/package.json | 33 +-- .../test/fixtures/create-helia.browser.ts | 4 +- .../interop/test/fixtures/create-helia.ts | 4 +- packages/interop/test/strings.spec.ts | 3 +- packages/strings/README.md | 41 +++- packages/strings/package.json | 26 +-- 12 files changed, 123 insertions(+), 248 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 522fa06..c3c3601 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

-# @helia/strings +# @helia/strings [![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,30 +13,23 @@ > Add/get IPLD blocks containing strings with your Helia node -## Table of contents - -- [Structure](#structure) -- [API Docs](#api-docs) -- [License](#license) -- [Contribute](#contribute) - -## Structure +# Packages - [`/packages/interop`](./packages/interop) Interop tests for @helia/strings - [`/packages/strings`](./packages/strings) Add/get IPLD blocks containing strings with your Helia node -## 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-strings/issues). diff --git a/package.json b/package.json index 850b254..2b1aa5a 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/helia-strings/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/interop/README.md b/packages/interop/README.md index 473db66..a0dc16c 100644 --- a/packages/interop/README.md +++ b/packages/interop/README.md @@ -4,7 +4,7 @@

-# @helia/strings-interop +# @helia/strings-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,40 +13,14 @@ > Interop tests for @helia/strings -## 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-strings/issues). diff --git a/packages/interop/package.json b/packages/interop/package.json index 99c135c..b661b32 100644 --- a/packages/interop/package.json +++ b/packages/interop/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "description": "Interop tests for @helia/strings", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/helia-strings/tree/master/packages/interop#readme", + "homepage": "https://github.com/ipfs/helia-strings/tree/main/packages/interop#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/helia-strings.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/helia-strings/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "IPFS" ], @@ -31,8 +35,9 @@ "eslintConfig": { "extends": "ipfs", "parserOptions": { - "package": true, - "sourceType": "module" + "project": true, + "sourceType": "module", + "package": true } }, "scripts": { @@ -49,23 +54,25 @@ "test:electron-main": "aegir test -t electron-main" }, "devDependencies": { - "@chainsafe/libp2p-noise": "^13.0.1", - "@chainsafe/libp2p-yamux": "^5.0.0", - "@helia/interface": "^2.0.0", + "@chainsafe/libp2p-noise": "^14.1.0", + "@chainsafe/libp2p-yamux": "^6.0.1", + "@helia/interface": "^3.0.0", "@helia/strings": "^1.0.0", - "@libp2p/tcp": "^8.0.8", - "@libp2p/websockets": "^7.0.8", - "aegir": "^41.0.0", + "@libp2p/identify": "^1.0.9", + "@libp2p/tcp": "^9.0.10", + "@libp2p/websockets": "^8.0.10", + "aegir": "^42.0.1", "blockstore-core": "^4.0.1", "datastore-core": "^9.0.3", - "helia": "^2.0.3", + "helia": "^3.0.0", "ipfs-core-types": "^0.14.0", "ipfsd-ctl": "^13.0.0", - "kubo": "^0.23.0", + "kubo": "^0.25.0", "kubo-rpc-client": "^3.0.0", - "libp2p": "^0.46.12", + "libp2p": "^1.1.1", "merge-options": "^3.0.4", - "uint8arrays": "^4.0.3", + "multiformats": "^13.0.0", + "uint8arrays": "^5.0.1", "wherearewe": "^2.0.1" }, "browser": { diff --git a/packages/interop/test/fixtures/create-helia.browser.ts b/packages/interop/test/fixtures/create-helia.browser.ts index 867de49..5f0f582 100644 --- a/packages/interop/test/fixtures/create-helia.browser.ts +++ b/packages/interop/test/fixtures/create-helia.browser.ts @@ -1,12 +1,12 @@ import { noise } from '@chainsafe/libp2p-noise' import { yamux } from '@chainsafe/libp2p-yamux' +import { identify } from '@libp2p/identify' import { webSockets } from '@libp2p/websockets' import { all } from '@libp2p/websockets/filters' import { MemoryBlockstore } from 'blockstore-core' import { MemoryDatastore } from 'datastore-core' import { createHelia } from 'helia' import { createLibp2p, type Libp2pOptions } from 'libp2p' -import { identifyService } from 'libp2p/identify' import type { Helia } from '@helia/interface' export async function createHeliaNode (config: Libp2pOptions = {}): Promise { @@ -27,7 +27,7 @@ export async function createHeliaNode (config: Libp2pOptions = {}): Promise { @@ -24,7 +24,7 @@ export async function createHeliaNode (config: Libp2pOptions = {}): Promise { it('should add to kubo and fetch from helia', async () => { const input = 'hello world' const cid = await kubo.api.block.put(uint8ArrayFromString(input)) - const output = await str.get(cid) + const output = await str.get(CID.parse(cid.toString())) expect(output).to.equal(input) }) diff --git a/packages/strings/README.md b/packages/strings/README.md index bbca118..3a0a845 100644 --- a/packages/strings/README.md +++ b/packages/strings/README.md @@ -4,7 +4,7 @@

-# @helia/strings +# @helia/strings [![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) @@ -17,7 +17,7 @@ `@helia/strings` makes working with strings Helia simple & straightforward. -See the Strings interface for all available operations. +See the interface for all available operations. ## Example @@ -33,3 +33,40 @@ const string = await str.get(cid) console.info(string) // hello world ``` + +# Install + +```console +$ npm i @helia/strings +``` + +## Browser ` +``` + +# API Docs + +- + +# License + +Licensed under either of + +- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) +- MIT ([LICENSE-MIT](LICENSE-MIT) / ) + +# Contribute + +Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-strings/issues). + +Also see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. + +Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + +[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) diff --git a/packages/strings/package.json b/packages/strings/package.json index 96ceac9..d713507 100644 --- a/packages/strings/package.json +++ b/packages/strings/package.json @@ -3,7 +3,7 @@ "version": "1.0.1", "description": "Add/get IPLD blocks containing strings with your Helia node", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/ipfs/helia-strings/tree/master/packages/strings#readme", + "homepage": "https://github.com/ipfs/helia-strings/tree/main/packages/strings#readme", "repository": { "type": "git", "url": "git+https://github.com/ipfs/helia-strings.git" @@ -11,6 +11,10 @@ "bugs": { "url": "https://github.com/ipfs/helia-strings/issues" }, + "publishConfig": { + "access": "public", + "provenance": true + }, "keywords": [ "IPFS" ], @@ -31,8 +35,9 @@ "eslintConfig": { "extends": "ipfs", "parserOptions": { - "package": true, - "sourceType": "module" + "project": true, + "sourceType": "module", + "package": true } }, "release": { @@ -136,18 +141,15 @@ "release": "aegir release" }, "dependencies": { - "@helia/interface": "^2.0.0", + "@helia/interface": "^3.0.0", "@libp2p/interfaces": "^3.3.1", - "interface-blockstore": "^5.0.0", - "multiformats": "^12.1.2", + "multiformats": "^13.0.0", "progress-events": "^1.0.0", - "uint8arrays": "^4.0.3" + "uint8arrays": "^5.0.1" }, "devDependencies": { - "aegir": "^41.0.0", - "blockstore-core": "^4.0.1" - }, - "typedoc": { - "entryPoint": "./src/index.ts" + "aegir": "^42.0.1", + "blockstore-core": "^4.0.1", + "interface-blockstore": "^5.0.0" } }