Skip to content

Commit

Permalink
feat!: update helia to v3 and multiformats to v13 (#52)
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 committed Jan 8, 2024
1 parent d0e8597 commit 6405c34
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 97 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)"
2 changes: 2 additions & 0 deletions .github/workflows/js-test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:

permissions:
contents: write
id-token: write
packages: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
Expand Down
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/reusable-semantic-pull-request.yml@v0.3
25 changes: 6 additions & 19 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@ name: Close and mark stale issue

on:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * *'

permissions:
issues: write
pull-requests: write

jobs:
stale:

runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
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.'
close-issue-message: 'This issue was closed because it is missing author input.'
stale-issue-label: 'kind/stale'
any-of-labels: 'need/author-input'
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'
days-before-issue-stale: 6
days-before-issue-close: 7
enable-statistics: true
uses: pl-strflt/.github/.github/workflows/reusable-stale-issue.yml@v0.3
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,23 @@

> Import/export car files from Helia
## Table of contents <!-- omit in toc -->

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

## Structure
# Packages

- [`/packages/car`](./packages/car) Import/export car files from Helia
- [`/packages/interop`](./packages/interop) Interop tests for @helia/car

## API Docs
# API Docs

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

## 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-car/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-car/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
74 changes: 62 additions & 12 deletions packages/car/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</a>
</p>

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

[![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,90 @@

> Import/export car files from Helia
## Table of contents <!-- omit in toc -->
# About

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

## Install
See the Car interface for all available operations.

By default it supports `dag-pb`, `dag-cbor`, `dag-json` and `raw` CIDs, more esoteric DAG walkers can be passed as an init option.

## Example - Exporting a DAG as a CAR file

```typescript
import { createHelia } from 'helia'
import { unixfs } from '@helia/unixfs'
import { car } from '@helia/car'
import { CarWriter } from '@ipld/car'
import { Readable } from 'node:stream'
import nodeFs from 'node:fs'

const helia = createHelia({
// ... helia config
})
const fs = unixfs(helia)

// add some UnixFS data
const cid = await fs.addBytes(fileData1)

// export it as a Car
const c = car(helia)
const { writer, out } = await CarWriter.create(cid)

// `out` needs to be directed somewhere, see the @ipld/car docs for more information
Readable.from(out).pipe(nodeFs.createWriteStream('example.car'))

// write the DAG behind `cid` into the writer
await c.export(cid, writer)
```

## Example - Importing all blocks from a CAR file

```typescript
import { createHelia } from 'helia'
import { unixfs } from '@helia/unixfs'
import { car } from '@helia/car'
import { CarReader } from '@ipld/car'
import { Readable } from 'node:stream'
import nodeFs from 'node:fs'

const helia = createHelia({
// ... helia config
})

// import the car
const inStream = nodeFs.createReadStream('example.car')
const reader = await CarReader.fromIterable(inStream)

await c.import(reader)
```

# Install

```console
$ npm i @helia/car
```

### Browser `<script>` tag
## Browser `<script>` tag

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

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

## API Docs
# API Docs

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

Expand Down
24 changes: 12 additions & 12 deletions packages/car/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
"version": "1.0.4",
"description": "Import/export car files from Helia",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/ipfs/helia-car/tree/master/packages/car#readme",
"homepage": "https://github.com/ipfs/helia-car/tree/main/packages/car#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/helia-car.git"
},
"bugs": {
"url": "https://github.com/ipfs/helia-car/issues"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"keywords": [
"IPFS"
],
Expand Down Expand Up @@ -42,10 +46,6 @@
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
},
"./errors": {
"types": "./dist/src/errors.d.ts",
"import": "./dist/src/errors.js"
}
},
"eslintConfig": {
Expand Down Expand Up @@ -155,24 +155,24 @@
"release": "aegir release"
},
"dependencies": {
"@helia/interface": "^2.0.0",
"@helia/interface": "^3.0.0",
"@ipld/car": "^5.1.1",
"@ipld/dag-pb": "^4.0.0",
"@libp2p/interfaces": "^3.3.1",
"cborg": "^4.0.3",
"interface-blockstore": "^5.0.0",
"it-drain": "^3.0.5",
"it-map": "^3.0.3",
"multiformats": "^12.0.1",
"multiformats": "^13.0.0",
"p-defer": "^4.0.0",
"p-queue": "^7.3.4",
"p-queue": "^8.0.1",
"progress-events": "^1.0.0"
},
"devDependencies": {
"@helia/unixfs": "^1.2.2",
"aegir": "^41.0.0",
"@helia/unixfs": "^2.0.0",
"aegir": "^42.0.1",
"blockstore-core": "^4.0.1",
"interface-blockstore": "^5.2.9",
"ipfs-unixfs-importer": "^15.1.0",
"it-drain": "^3.0.1",
"it-to-buffer": "^4.0.2"
}
}
4 changes: 2 additions & 2 deletions packages/car/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* By default it supports `dag-pb`, `dag-cbor`, `dag-json` and `raw` CIDs, more esoteric DAG walkers can be passed as an init option.
*
* @example
* @example Exporting a DAG as a CAR file
*
* ```typescript
* import { createHelia } from 'helia'
Expand Down Expand Up @@ -36,7 +36,7 @@
* await c.export(cid, writer)
* ```
*
* @example
* @example Importing all blocks from a CAR file
*
* ```typescript
* import { createHelia } from 'helia'
Expand Down
3 changes: 1 addition & 2 deletions packages/car/typedoc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"entryPoints": [
"./src/index.ts",
"./src/errors.ts"
"./src/index.ts"
]
}
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/car-interop <!-- omit in toc -->
# @helia/car-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/car
## 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/car-interop
```

### Browser `<script>` tag

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

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

## API Docs

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

Expand Down
Loading

0 comments on commit 6405c34

Please sign in to comment.