Skip to content

Commit 6405c34

Browse files
authored
feat!: update helia to v3 and multiformats to v13 (#52)
Updates all deps and fixes linting errors. BREAKING CHANGE: uses multiformats v13 and helia v3
1 parent d0e8597 commit 6405c34

13 files changed

+123
-97
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

.github/workflows/stale.yml

+6-19
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,12 @@ name: Close and mark stale issue
22

33
on:
44
schedule:
5-
- cron: '0 0 * * *'
5+
- cron: '0 0 * * *'
6+
7+
permissions:
8+
issues: write
9+
pull-requests: write
610

711
jobs:
812
stale:
9-
10-
runs-on: ubuntu-latest
11-
permissions:
12-
issues: write
13-
pull-requests: write
14-
15-
steps:
16-
- uses: actions/stale@v3
17-
with:
18-
repo-token: ${{ secrets.GITHUB_TOKEN }}
19-
stale-issue-message: 'Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.'
20-
close-issue-message: 'This issue was closed because it is missing author input.'
21-
stale-issue-label: 'kind/stale'
22-
any-of-labels: 'need/author-input'
23-
exempt-issue-labels: 'need/triage,need/community-input,need/maintainer-input,need/maintainers-input,need/analysis,status/blocked,status/in-progress,status/ready,status/deferred,status/inactive'
24-
days-before-issue-stale: 6
25-
days-before-issue-close: 7
26-
enable-statistics: true
13+
uses: pl-strflt/.github/.github/workflows/reusable-stale-issue.yml@v0.3

README.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,23 @@
1313

1414
> Import/export car files from 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/car`](./packages/car) Import/export car files from Helia
2619
- [`/packages/interop`](./packages/interop) Interop tests for @helia/car
2720

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

3023
- <https://ipfs.github.io/helia-car>
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-car/issues).
4235

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"bugs": {
1212
"url": "https://github.com/ipfs/helia-car/issues"
1313
},
14+
"publishConfig": {
15+
"access": "public",
16+
"provenance": true
17+
},
1418
"keywords": [
1519
"ipfs"
1620
],
@@ -36,7 +40,7 @@
3640
"docs:no-publish": "NODE_OPTIONS=--max_old_space_size=8192 aegir docs --publish false -- --exclude packages/interop"
3741
},
3842
"devDependencies": {
39-
"aegir": "^41.0.0",
43+
"aegir": "^42.0.1",
4044
"npm-run-all": "^4.1.5"
4145
},
4246
"type": "module",

packages/car/README.md

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

7-
# @helia/car <!-- omit in toc -->
7+
# @helia/car
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,90 @@
1313

1414
> Import/export car files from Helia
1515
16-
## Table of contents <!-- omit in toc -->
16+
# About
1717

18-
- [Install](#install)
19-
- [Browser `<script>` tag](#browser-script-tag)
20-
- [API Docs](#api-docs)
21-
- [License](#license)
22-
- [Contribute](#contribute)
18+
`@helia/car` provides `import` and `export` methods to read/write Car files to Helia's blockstore.
2319

24-
## Install
20+
See the Car interface for all available operations.
21+
22+
By default it supports `dag-pb`, `dag-cbor`, `dag-json` and `raw` CIDs, more esoteric DAG walkers can be passed as an init option.
23+
24+
## Example - Exporting a DAG as a CAR file
25+
26+
```typescript
27+
import { createHelia } from 'helia'
28+
import { unixfs } from '@helia/unixfs'
29+
import { car } from '@helia/car'
30+
import { CarWriter } from '@ipld/car'
31+
import { Readable } from 'node:stream'
32+
import nodeFs from 'node:fs'
33+
34+
const helia = createHelia({
35+
// ... helia config
36+
})
37+
const fs = unixfs(helia)
38+
39+
// add some UnixFS data
40+
const cid = await fs.addBytes(fileData1)
41+
42+
// export it as a Car
43+
const c = car(helia)
44+
const { writer, out } = await CarWriter.create(cid)
45+
46+
// `out` needs to be directed somewhere, see the @ipld/car docs for more information
47+
Readable.from(out).pipe(nodeFs.createWriteStream('example.car'))
48+
49+
// write the DAG behind `cid` into the writer
50+
await c.export(cid, writer)
51+
```
52+
53+
## Example - Importing all blocks from a CAR file
54+
55+
```typescript
56+
import { createHelia } from 'helia'
57+
import { unixfs } from '@helia/unixfs'
58+
import { car } from '@helia/car'
59+
import { CarReader } from '@ipld/car'
60+
import { Readable } from 'node:stream'
61+
import nodeFs from 'node:fs'
62+
63+
const helia = createHelia({
64+
// ... helia config
65+
})
66+
67+
// import the car
68+
const inStream = nodeFs.createReadStream('example.car')
69+
const reader = await CarReader.fromIterable(inStream)
70+
71+
await c.import(reader)
72+
```
73+
74+
# Install
2575

2676
```console
2777
$ npm i @helia/car
2878
```
2979

30-
### Browser `<script>` tag
80+
## Browser `<script>` tag
3181

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

3484
```html
3585
<script src="https://unpkg.com/@helia/car/dist/index.min.js"></script>
3686
```
3787

38-
## API Docs
88+
# API Docs
3989

4090
- <https://ipfs.github.io/helia-car/modules/_helia_car.html>
4191

42-
## License
92+
# License
4393

4494
Licensed under either of
4595

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

49-
## Contribute
99+
# Contribute
50100

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

packages/car/package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
"version": "1.0.4",
44
"description": "Import/export car files from Helia",
55
"license": "Apache-2.0 OR MIT",
6-
"homepage": "https://github.com/ipfs/helia-car/tree/master/packages/car#readme",
6+
"homepage": "https://github.com/ipfs/helia-car/tree/main/packages/car#readme",
77
"repository": {
88
"type": "git",
99
"url": "git+https://github.com/ipfs/helia-car.git"
1010
},
1111
"bugs": {
1212
"url": "https://github.com/ipfs/helia-car/issues"
1313
},
14+
"publishConfig": {
15+
"access": "public",
16+
"provenance": true
17+
},
1418
"keywords": [
1519
"IPFS"
1620
],
@@ -42,10 +46,6 @@
4246
".": {
4347
"types": "./dist/src/index.d.ts",
4448
"import": "./dist/src/index.js"
45-
},
46-
"./errors": {
47-
"types": "./dist/src/errors.d.ts",
48-
"import": "./dist/src/errors.js"
4949
}
5050
},
5151
"eslintConfig": {
@@ -155,24 +155,24 @@
155155
"release": "aegir release"
156156
},
157157
"dependencies": {
158-
"@helia/interface": "^2.0.0",
158+
"@helia/interface": "^3.0.0",
159159
"@ipld/car": "^5.1.1",
160160
"@ipld/dag-pb": "^4.0.0",
161161
"@libp2p/interfaces": "^3.3.1",
162162
"cborg": "^4.0.3",
163-
"interface-blockstore": "^5.0.0",
163+
"it-drain": "^3.0.5",
164164
"it-map": "^3.0.3",
165-
"multiformats": "^12.0.1",
165+
"multiformats": "^13.0.0",
166166
"p-defer": "^4.0.0",
167-
"p-queue": "^7.3.4",
167+
"p-queue": "^8.0.1",
168168
"progress-events": "^1.0.0"
169169
},
170170
"devDependencies": {
171-
"@helia/unixfs": "^1.2.2",
172-
"aegir": "^41.0.0",
171+
"@helia/unixfs": "^2.0.0",
172+
"aegir": "^42.0.1",
173173
"blockstore-core": "^4.0.1",
174+
"interface-blockstore": "^5.2.9",
174175
"ipfs-unixfs-importer": "^15.1.0",
175-
"it-drain": "^3.0.1",
176176
"it-to-buffer": "^4.0.2"
177177
}
178178
}

packages/car/src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* By default it supports `dag-pb`, `dag-cbor`, `dag-json` and `raw` CIDs, more esoteric DAG walkers can be passed as an init option.
99
*
10-
* @example
10+
* @example Exporting a DAG as a CAR file
1111
*
1212
* ```typescript
1313
* import { createHelia } from 'helia'
@@ -36,7 +36,7 @@
3636
* await c.export(cid, writer)
3737
* ```
3838
*
39-
* @example
39+
* @example Importing all blocks from a CAR file
4040
*
4141
* ```typescript
4242
* import { createHelia } from 'helia'

packages/car/typedoc.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"entryPoints": [
3-
"./src/index.ts",
4-
"./src/errors.ts"
3+
"./src/index.ts"
54
]
65
}

packages/interop/README.md

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

7-
# @helia/car-interop <!-- omit in toc -->
7+
# @helia/car-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,14 @@
1313

1414
> Interop tests for @helia/car
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
25-
26-
```console
27-
$ npm i @helia/car-interop
28-
```
29-
30-
### Browser `<script>` tag
31-
32-
Loading this module through a script tag will make it's exports available as `HeliaCarInterop` in the global namespace.
33-
34-
```html
35-
<script src="https://unpkg.com/@helia/car-interop/dist/index.min.js"></script>
36-
```
37-
38-
## API Docs
39-
40-
- <https://ipfs.github.io/helia-car/modules/_helia_car_interop.html>
41-
42-
## License
16+
# License
4317

4418
Licensed under either of
4519

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

49-
## Contribute
23+
# Contribute
5024

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

0 commit comments

Comments
 (0)