Skip to content

Commit 001247c

Browse files
authored
feat!: update helia to v3 and multiformats to v13 (#147)
Updates all deps and fixes linting errors. BREAKING CHANGE: uses multiformats v13 and helia v3
1 parent 1b0b2ef commit 001247c

14 files changed

+91
-83
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ updates:
55
schedule:
66
interval: daily
77
time: "10:00"
8-
open-pull-requests-limit: 10
8+
open-pull-requests-limit: 20
99
commit-message:
1010
prefix: "deps"
1111
prefix-development: "deps(dev)"

.github/workflows/js-test-and-release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ on:
99

1010
permissions:
1111
contents: write
12+
id-token: write
1213
packages: write
14+
pull-requests: write
1315

1416
concurrency:
1517
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Semantic PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
main:
12+
uses: pl-strflt/.github/.github/workflows/reusable-semantic-pull-request.yml@v0.3

README.md

+5-12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</a>
55
</p>
66

7-
# @helia/unixfs <!-- omit in toc -->
7+
# @helia/unixfs
88

99
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
1010
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
@@ -13,30 +13,23 @@
1313

1414
> An implementation of Unixfs for Helia
1515
16-
## Table of contents <!-- omit in toc -->
17-
18-
- [Structure](#structure)
19-
- [API Docs](#api-docs)
20-
- [License](#license)
21-
- [Contribute](#contribute)
22-
23-
## Structure
16+
# Packages
2417

2518
- [`/packages/interop`](./packages/interop) Interop tests for @helia/unixfs
2619
- [`/packages/unixfs`](./packages/unixfs) A Helia-compatible wrapper for UnixFS
2720

28-
## API Docs
21+
# API Docs
2922

3023
- <https://ipfs.github.io/helia-unixfs>
3124

32-
## License
25+
# License
3326

3427
Licensed under either of
3528

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

39-
## Contribute
32+
# Contribute
4033

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

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"bugs": {
1212
"url": "https://github.com/ipfs/helia-unixfs/issues"
1313
},
14+
"publishConfig": {
15+
"access": "public",
16+
"provenance": true
17+
},
1418
"keywords": [
1519
"ipfs"
1620
],

packages/interop/README.md

+5-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</a>
55
</p>
66

7-
# @helia/unixfs-interop <!-- omit in toc -->
7+
# @helia/unixfs-interop
88

99
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
1010
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
@@ -13,40 +13,28 @@
1313

1414
> Interop tests for @helia/unixfs
1515
16-
## Table of contents <!-- omit in toc -->
17-
18-
- [Install](#install)
19-
- [Browser `<script>` tag](#browser-script-tag)
20-
- [API Docs](#api-docs)
21-
- [License](#license)
22-
- [Contribute](#contribute)
23-
24-
## Install
16+
# Install
2517

2618
```console
2719
$ npm i @helia/unixfs-interop
2820
```
2921

30-
### Browser `<script>` tag
22+
## Browser `<script>` tag
3123

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

3426
```html
3527
<script src="https://unpkg.com/@helia/unixfs-interop/dist/index.min.js"></script>
3628
```
3729

38-
## API Docs
39-
40-
- <https://ipfs.github.io/helia-unixfs/modules/_helia_unixfs_interop.html>
41-
42-
## License
30+
# License
4331

4432
Licensed under either of
4533

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

49-
## Contribute
37+
# Contribute
5038

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

packages/interop/package.json

+17-11
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
"version": "0.0.0",
44
"description": "Interop tests for @helia/unixfs",
55
"license": "Apache-2.0 OR MIT",
6-
"homepage": "https://github.com/ipfs/helia-unixfs/tree/master/packages/interop#readme",
6+
"homepage": "https://github.com/ipfs/helia-unixfs/tree/main/packages/interop#readme",
77
"repository": {
88
"type": "git",
99
"url": "git+https://github.com/ipfs/helia-unixfs.git"
1010
},
1111
"bugs": {
1212
"url": "https://github.com/ipfs/helia-unixfs/issues"
1313
},
14+
"publishConfig": {
15+
"access": "public",
16+
"provenance": true
17+
},
1418
"keywords": [
1519
"IPFS"
1620
],
@@ -48,25 +52,27 @@
4852
"test:electron-main": "aegir test -t electron-main"
4953
},
5054
"devDependencies": {
51-
"@chainsafe/libp2p-noise": "^13.0.1",
52-
"@chainsafe/libp2p-yamux": "^5.0.0",
53-
"@helia/interface": "^2.0.0",
55+
"@chainsafe/libp2p-noise": "^14.1.0",
56+
"@chainsafe/libp2p-yamux": "^6.0.1",
57+
"@helia/interface": "^3.0.0",
5458
"@helia/unixfs": "^1.0.0",
55-
"@libp2p/tcp": "^8.0.6",
56-
"@libp2p/websockets": "^7.0.6",
57-
"aegir": "^41.0.0",
59+
"@libp2p/identify": "^1.0.9",
60+
"@libp2p/interface": "^1.1.1",
61+
"@libp2p/tcp": "^9.0.7",
62+
"@libp2p/websockets": "^8.0.7",
63+
"aegir": "^42.0.1",
5864
"blockstore-core": "^4.0.1",
5965
"datastore-core": "^9.0.3",
60-
"kubo": "^0.24.0",
61-
"helia": "^2.0.1",
66+
"helia": "^3.0.0",
6267
"ipfs-core-types": "^0.14.0",
6368
"ipfs-unixfs-importer": "^15.1.0",
6469
"ipfsd-ctl": "^13.0.0",
6570
"it-to-buffer": "^4.0.1",
71+
"kubo": "^0.25.0",
6672
"kubo-rpc-client": "^3.0.0",
67-
"libp2p": "^0.46.10",
73+
"libp2p": "^1.0.10",
6874
"merge-options": "^3.0.4",
69-
"multiformats": "^12.1.1",
75+
"multiformats": "^13.0.0",
7076
"wherearewe": "^2.0.1"
7177
},
7278
"browser": {

packages/interop/test/bitswap.spec.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import { type UnixFS, unixfs } from '@helia/unixfs'
44
import { expect } from 'aegir/chai'
55
import toBuffer from 'it-to-buffer'
6+
import { CID } from 'multiformats/cid'
67
import { createHeliaNode } from './fixtures/create-helia.js'
78
import { createKuboNode } from './fixtures/create-kubo.js'
89
import type { Helia } from '@helia/interface'
10+
import type { Libp2p } from '@libp2p/interface'
911
import type { FileCandidate } from 'ipfs-unixfs-importer'
1012
import type { Controller } from 'ipfsd-ctl'
1113

1214
describe('unixfs bitswap interop', () => {
13-
let helia: Helia
15+
let helia: Helia<Libp2p>
1416
let unixFs: UnixFS
1517
let kubo: Controller
1618

@@ -74,7 +76,7 @@ describe('unixfs bitswap interop', () => {
7476

7577
const { cid } = await kubo.api.add(candidate.content)
7678

77-
const bytes = await toBuffer(unixFs.cat(cid))
79+
const bytes = await toBuffer(unixFs.cat(CID.parse(cid.toString())))
7880

7981
expect(bytes).to.equalBytes(toBuffer(input))
8082
})

packages/interop/test/files.spec.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import { type AddOptions, type UnixFS, unixfs } from '@helia/unixfs'
44
import { expect } from 'aegir/chai'
55
import { fixedSize } from 'ipfs-unixfs-importer/chunker'
66
import { balanced } from 'ipfs-unixfs-importer/layout'
7+
import { CID } from 'multiformats/cid'
78
import { createHeliaNode } from './fixtures/create-helia.js'
89
import { createKuboNode } from './fixtures/create-kubo.js'
910
import type { Helia } from '@helia/interface'
11+
import type { Libp2p } from '@libp2p/interface'
1012
import type { AddOptions as KuboAddOptions } from 'ipfs-core-types/src/root.js'
1113
import type { FileCandidate } from 'ipfs-unixfs-importer'
1214
import type { Controller } from 'ipfsd-ctl'
13-
import type { CID } from 'multiformats/cid'
1415

1516
describe('unixfs interop', () => {
16-
let helia: Helia
17+
let helia: Helia<Libp2p>
1718
let unixFs: UnixFS
1819
let kubo: Controller
1920

@@ -26,7 +27,7 @@ describe('unixfs interop', () => {
2627
async function importToKubo (data: FileCandidate, opts?: KuboAddOptions): Promise<CID> {
2728
const result = await kubo.api.add(data.content, opts)
2829

29-
return result.cid
30+
return CID.parse(result.cid.toString())
3031
}
3132

3233
async function expectSameCid (data: () => FileCandidate, heliaOpts: Partial<AddOptions> = {}, kuboOpts: KuboAddOptions = {}): Promise<void> {

packages/interop/test/fixtures/create-helia.browser.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { noise } from '@chainsafe/libp2p-noise'
22
import { yamux } from '@chainsafe/libp2p-yamux'
3+
import { identify } from '@libp2p/identify'
34
import { webSockets } from '@libp2p/websockets'
45
import { all } from '@libp2p/websockets/filters'
56
import { MemoryBlockstore } from 'blockstore-core'
67
import { MemoryDatastore } from 'datastore-core'
78
import { createHelia } from 'helia'
89
import { bitswap } from 'helia/block-brokers'
9-
import { createLibp2p, type Libp2pOptions } from 'libp2p'
10-
import { identifyService } from 'libp2p/identify'
10+
import { createLibp2p } from 'libp2p'
1111
import type { Helia } from '@helia/interface'
12+
import type { Libp2p } from '@libp2p/interface'
13+
import type { Libp2pOptions } from 'libp2p'
1214

13-
export async function createHeliaNode (config: Libp2pOptions = {}): Promise<Helia> {
15+
export async function createHeliaNode (config: Libp2pOptions = {}): Promise<Helia<Libp2p>> {
1416
const blockstore = new MemoryBlockstore()
1517
const datastore = new MemoryDatastore()
1618

@@ -28,7 +30,7 @@ export async function createHeliaNode (config: Libp2pOptions = {}): Promise<Heli
2830
yamux()
2931
],
3032
services: {
31-
identify: identifyService()
33+
identify: identify()
3234
},
3335
datastore,
3436
connectionGater: {

packages/interop/test/fixtures/create-helia.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { noise } from '@chainsafe/libp2p-noise'
22
import { yamux } from '@chainsafe/libp2p-yamux'
3+
import { identify } from '@libp2p/identify'
34
import { tcp } from '@libp2p/tcp'
45
import { MemoryBlockstore } from 'blockstore-core'
56
import { MemoryDatastore } from 'datastore-core'
67
import { createHelia } from 'helia'
78
import { bitswap } from 'helia/block-brokers'
8-
import { createLibp2p, type Libp2pOptions } from 'libp2p'
9-
import { identifyService } from 'libp2p/identify'
9+
import { createLibp2p } from 'libp2p'
1010
import type { Helia } from '@helia/interface'
11+
import type { Libp2p } from '@libp2p/interface'
12+
import type { Libp2pOptions } from 'libp2p'
1113

12-
export async function createHeliaNode (config: Libp2pOptions = {}): Promise<Helia> {
14+
export async function createHeliaNode (config: Libp2pOptions = {}): Promise<Helia<Libp2p>> {
1315
const blockstore = new MemoryBlockstore()
1416
const datastore = new MemoryDatastore()
1517

@@ -25,7 +27,7 @@ export async function createHeliaNode (config: Libp2pOptions = {}): Promise<Heli
2527
],
2628
datastore,
2729
services: {
28-
identify: identifyService()
30+
identify: identify()
2931
},
3032
...config
3133
})

packages/unixfs/README.md

+9-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</a>
55
</p>
66

7-
# @helia/unixfs <!-- omit in toc -->
7+
# @helia/unixfs
88

99
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
1010
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
@@ -19,7 +19,7 @@
1919

2020
See the interface for all available operations.
2121

22-
## Example
22+
## Example - Creating files and directories
2323

2424
```typescript
2525
import { createHelia } from 'helia'
@@ -44,9 +44,9 @@ for await (const entry of fs.addAll([{
4444
}
4545
```
4646

47-
## Example
47+
## Example - Recursively adding a directory
4848

49-
Recursively adding a directory (Node.js-compatibly environments only):
49+
Node.js-compatibly environments only:
5050

5151
```typescript
5252
import { globSource } from '@helia/unixfs'
@@ -56,40 +56,32 @@ for await (const entry of fs.addAll(globSource('path/to/containing/dir', 'glob-p
5656
}
5757
```
5858

59-
## Table of contents <!-- omit in toc -->
60-
61-
- [Install](#install)
62-
- [Browser `<script>` tag](#browser-script-tag)
63-
- [API Docs](#api-docs)
64-
- [License](#license)
65-
- [Contribute](#contribute)
66-
67-
## Install
59+
# Install
6860

6961
```console
7062
$ npm i @helia/unixfs
7163
```
7264

73-
### Browser `<script>` tag
65+
## Browser `<script>` tag
7466

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

7769
```html
7870
<script src="https://unpkg.com/@helia/unixfs/dist/index.min.js"></script>
7971
```
8072

81-
## API Docs
73+
# API Docs
8274

8375
- <https://ipfs.github.io/helia-unixfs/modules/_helia_unixfs.html>
8476

85-
## License
77+
# License
8678

8779
Licensed under either of
8880

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

92-
## Contribute
84+
# Contribute
9385

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

0 commit comments

Comments
 (0)