Skip to content

Commit

Permalink
feat!: update helia to v3 and multiformats to v13 (#46)
Browse files Browse the repository at this point in the history
Updates all deps and fixes linting errors.

BREAKING CHANGE: uses multiformats v13 and helia v3
  • Loading branch information
achingbrain authored Jan 8, 2024
1 parent 903d9e4 commit e3dc586
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 241 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
191 changes: 18 additions & 173 deletions .github/workflows/js-test-and-release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
secrets:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
UCI_GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Semantic PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
uses: pl-strflt/.github/.github/workflows/[email protected]
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</a>
</p>

# @helia/json <!-- omit in toc -->
# @helia/json

[![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)
Expand All @@ -13,30 +13,23 @@

> Add/get IPLD blocks containing json with your Helia node
## Table of contents <!-- omit in toc -->

- [Structure](#structure)
- [API Docs](#api-docs)
- [License](#license)
- [Contribute](#contribute)

## Structure
# Packages

- [`/packages/interop`](./packages/interop) Interop tests for @helia/json
- [`/packages/json`](./packages/json) Add/get IPLD blocks containing json with your Helia node

## API Docs
# API Docs

- <https://ipfs.github.io/helia-json>

## License
# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribute
# Contribute

Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-json/issues).

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"bugs": {
"url": "https://github.com/ipfs/helia-json/issues"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"keywords": [
"ipfs"
],
Expand All @@ -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",
Expand Down
32 changes: 3 additions & 29 deletions packages/interop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</a>
</p>

# @helia/json-interop <!-- omit in toc -->
# @helia/json-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)
Expand All @@ -13,40 +13,14 @@

> Interop tests for @helia/json
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [API Docs](#api-docs)
- [License](#license)
- [Contribute](#contribute)

## Install

```console
$ npm i @helia/json-interop
```

### Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `HeliaJsonInterop` in the global namespace.

```html
<script src="https://unpkg.com/@helia/json-interop/dist/index.min.js"></script>
```

## API Docs

- <https://ipfs.github.io/helia-json/modules/_helia_json_interop.html>

## License
# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribute
# Contribute

Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-json/issues).

Expand Down
16 changes: 10 additions & 6 deletions packages/interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
"version": "0.0.0",
"description": "Interop tests for @helia/json",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/ipfs/helia-json/tree/master/packages/interop#readme",
"homepage": "https://github.com/ipfs/helia-json/tree/main/packages/interop#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/helia-json.git"
},
"bugs": {
"url": "https://github.com/ipfs/helia-json/issues"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"keywords": [
"IPFS"
],
Expand Down Expand Up @@ -49,17 +53,17 @@
"test:electron-main": "aegir test -t electron-main"
},
"devDependencies": {
"@helia/interface": "^2.0.0",
"@helia/interface": "^3.0.0",
"@helia/json": "^1.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": "^12.0.1",
"multiformats": "^13.0.0",
"wherearewe": "^2.0.1"
},
"browser": {
Expand Down
3 changes: 2 additions & 1 deletion packages/interop/test/json.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { json, type JSON, type AddOptions } from '@helia/json'
import { expect } from 'aegir/chai'
import { CID } from 'multiformats/cid'
import * as jsonCodec from 'multiformats/codecs/json'
import { createHeliaNode } from './fixtures/create-helia.js'
import { createKuboNode } from './fixtures/create-kubo.js'
Expand Down Expand Up @@ -57,7 +58,7 @@ describe('json interop', () => {
it('should add to kubo and fetch from helia', async () => {
const input = { hello: 'world' }
const cid = await kubo.api.block.put(jsonCodec.encode(input))
const output = await j.get(cid)
const output = await j.get(CID.parse(cid.toString()))

expect(output).to.deep.equal(input)
})
Expand Down
Loading

0 comments on commit e3dc586

Please sign in to comment.