Skip to content

Commit 3ad5f5d

Browse files
authored
chore: add interop test suite (#12)
Splits repo into monorepo and adds a package for doing interop testing between @helia/unixfs and kubo. Also updates all deps.
1 parent 47c5879 commit 3ad5f5d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+779
-221
lines changed

README.md

+8-18
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,26 @@
44
</a>
55
</p>
66

7-
# @helia/unixfs <!-- omit in toc -->
7+
# @helia/ipns <!-- omit in toc -->
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)
11-
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-unixfs)
12-
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-unixfs/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia-unixfs/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
11+
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-ipns.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-ipns)
12+
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-ipns/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia-ipns/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
1313

14-
> A Helia-compatible wrapper for UnixFS
14+
> An implementation of Unixfs for Helia
1515
1616
## Table of contents <!-- omit in toc -->
1717

18-
- [Install](#install)
19-
- [Browser `<script>` tag](#browser-script-tag)
18+
- [Structure](#structure)
2019
- [API Docs](#api-docs)
2120
- [License](#license)
2221
- [Contribute](#contribute)
2322

24-
## Install
23+
## Structure
2524

26-
```console
27-
$ npm i @helia/unixfs
28-
```
29-
30-
### Browser `<script>` tag
31-
32-
Loading this module through a script tag will make it's exports available as `HeliaUnixfs` in the global namespace.
33-
34-
```html
35-
<script src="https://unpkg.com/@helia/unixfs/dist/index.min.js"></script>
36-
```
25+
- [`/packages/interop`](./packages/interop) Interop tests for @helia/unixfs
26+
- [`/packages/unixfs`](./packages/unixfs) A Helia-compatible wrapper for UnixFS
3727

3828
## API Docs
3929

package.json

+27-146
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@helia/unixfs",
3-
"version": "1.0.5",
4-
"description": "A Helia-compatible wrapper for UnixFS",
3+
"version": "0.0.0",
4+
"description": "An implementation of Unixfs for Helia",
55
"license": "Apache-2.0 OR MIT",
66
"homepage": "https://github.com/ipfs/helia-unixfs#readme",
77
"repository": {
@@ -12,156 +12,37 @@
1212
"url": "https://github.com/ipfs/helia-unixfs/issues"
1313
},
1414
"keywords": [
15-
"IPFS"
15+
"ipfs"
1616
],
1717
"engines": {
1818
"node": ">=16.0.0",
1919
"npm": ">=7.0.0"
2020
},
21-
"type": "module",
22-
"types": "./dist/src/index.d.ts",
23-
"files": [
24-
"src",
25-
"dist",
26-
"!dist/test",
27-
"!**/*.tsbuildinfo"
28-
],
29-
"exports": {
30-
".": {
31-
"types": "./dist/src/index.d.ts",
32-
"import": "./dist/src/index.js"
33-
}
34-
},
35-
"eslintConfig": {
36-
"extends": "ipfs",
37-
"parserOptions": {
38-
"sourceType": "module"
39-
}
40-
},
41-
"release": {
42-
"branches": [
43-
"main"
44-
],
45-
"plugins": [
46-
[
47-
"@semantic-release/commit-analyzer",
48-
{
49-
"preset": "conventionalcommits",
50-
"releaseRules": [
51-
{
52-
"breaking": true,
53-
"release": "major"
54-
},
55-
{
56-
"revert": true,
57-
"release": "patch"
58-
},
59-
{
60-
"type": "feat",
61-
"release": "minor"
62-
},
63-
{
64-
"type": "fix",
65-
"release": "patch"
66-
},
67-
{
68-
"type": "docs",
69-
"release": "patch"
70-
},
71-
{
72-
"type": "test",
73-
"release": "patch"
74-
},
75-
{
76-
"type": "deps",
77-
"release": "patch"
78-
},
79-
{
80-
"scope": "no-release",
81-
"release": false
82-
}
83-
]
84-
}
85-
],
86-
[
87-
"@semantic-release/release-notes-generator",
88-
{
89-
"preset": "conventionalcommits",
90-
"presetConfig": {
91-
"types": [
92-
{
93-
"type": "feat",
94-
"section": "Features"
95-
},
96-
{
97-
"type": "fix",
98-
"section": "Bug Fixes"
99-
},
100-
{
101-
"type": "chore",
102-
"section": "Trivial Changes"
103-
},
104-
{
105-
"type": "docs",
106-
"section": "Documentation"
107-
},
108-
{
109-
"type": "deps",
110-
"section": "Dependencies"
111-
},
112-
{
113-
"type": "test",
114-
"section": "Tests"
115-
}
116-
]
117-
}
118-
}
119-
],
120-
"@semantic-release/changelog",
121-
"@semantic-release/npm",
122-
"@semantic-release/github",
123-
"@semantic-release/git"
124-
]
125-
},
21+
"private": true,
12622
"scripts": {
127-
"clean": "aegir clean",
128-
"lint": "aegir lint",
129-
"dep-check": "aegir dep-check",
130-
"build": "aegir build",
131-
"docs": "aegir docs",
132-
"test": "aegir test",
133-
"test:chrome": "aegir test -t browser --cov",
134-
"test:chrome-webworker": "aegir test -t webworker",
135-
"test:firefox": "aegir test -t browser -- --browser firefox",
136-
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
137-
"test:node": "aegir test -t node --cov",
138-
"test:electron-main": "aegir test -t electron-main",
139-
"release": "aegir release"
140-
},
141-
"dependencies": {
142-
"@ipld/dag-pb": "^4.0.0",
143-
"@libp2p/interfaces": "^3.3.1",
144-
"@libp2p/logger": "^2.0.5",
145-
"@multiformats/murmur3": "^2.1.2",
146-
"hamt-sharding": "^3.0.2",
147-
"interface-blockstore": "^4.0.1",
148-
"ipfs-unixfs": "^11.0.0",
149-
"ipfs-unixfs-exporter": "^12.0.0",
150-
"ipfs-unixfs-importer": "^14.0.1",
151-
"it-last": "^2.0.0",
152-
"it-pipe": "^2.0.5",
153-
"merge-options": "^3.0.4",
154-
"multiformats": "^11.0.1",
155-
"sparse-array": "^1.3.2"
23+
"reset": "aegir run clean && aegir clean **/node_modules **/package-lock.json",
24+
"test": "aegir run test",
25+
"test:node": "aegir run test:node",
26+
"test:chrome": "aegir run test:chrome",
27+
"test:chrome-webworker": "aegir run test:chrome-webworker",
28+
"test:firefox": "aegir run test:firefox",
29+
"test:firefox-webworker": "aegir run test:firefox-webworker",
30+
"test:electron-main": "aegir run test:electron-main",
31+
"test:electron-renderer": "aegir run test:electron-renderer",
32+
"clean": "aegir run clean",
33+
"generate": "aegir run generate",
34+
"build": "aegir run build",
35+
"lint": "aegir run lint",
36+
"docs": "NODE_OPTIONS=--max_old_space_size=4096 aegir docs",
37+
"docs:no-publish": "npm run docs -- --publish false",
38+
"dep-check": "aegir run dep-check",
39+
"release": "npm run docs:no-publish && aegir run release && npm run docs"
15640
},
15741
"devDependencies": {
158-
"aegir": "^38.1.0",
159-
"blockstore-core": "^3.0.0",
160-
"delay": "^5.0.0",
161-
"it-all": "^2.0.0",
162-
"it-drain": "^2.0.0",
163-
"it-first": "^2.0.0",
164-
"it-to-buffer": "^3.0.0",
165-
"uint8arrays": "^4.0.3"
166-
}
42+
"aegir": "^38.1.0"
43+
},
44+
"type": "module",
45+
"workspaces": [
46+
"packages/*"
47+
]
16748
}

packages/interop/.aegir.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import getPort from 'aegir/get-port'
2+
import { createServer } from 'ipfsd-ctl'
3+
import * as kuboRpcClient from 'kubo-rpc-client'
4+
5+
/** @type {import('aegir').PartialOptions} */
6+
export default {
7+
test: {
8+
before: async (options) => {
9+
if (options.runner !== 'node') {
10+
const ipfsdPort = await getPort()
11+
const ipfsdServer = await createServer({
12+
host: '127.0.0.1',
13+
port: ipfsdPort
14+
}, {
15+
ipfsBin: (await import('go-ipfs')).default.path(),
16+
kuboRpcModule: kuboRpcClient,
17+
ipfsOptions: {
18+
config: {
19+
Addresses: {
20+
Swarm: [
21+
"/ip4/0.0.0.0/tcp/4001",
22+
"/ip4/0.0.0.0/tcp/4002/ws"
23+
]
24+
}
25+
}
26+
}
27+
}).start()
28+
29+
return {
30+
env: {
31+
IPFSD_SERVER: `http://127.0.0.1:${ipfsdPort}`
32+
},
33+
ipfsdServer
34+
}
35+
}
36+
37+
return {}
38+
},
39+
after: async (options, beforeResult) => {
40+
if (options.runner !== 'node') {
41+
await beforeResult.ipfsdServer.stop()
42+
}
43+
}
44+
}
45+
}

packages/interop/LICENSE

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This project is dual licensed under MIT and Apache-2.0.
2+
3+
MIT: https://www.opensource.org/licenses/mit
4+
Apache-2.0: https://www.apache.org/licenses/license-2.0

packages/interop/LICENSE-APACHE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
2+
3+
http://www.apache.org/licenses/LICENSE-2.0
4+
5+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

packages/interop/LICENSE-MIT

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

packages/interop/README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<p align="center">
2+
<a href="https://github.com/ipfs/helia" title="Helia">
3+
<img src="https://raw.githubusercontent.com/ipfs/helia/main/assets/helia.png" alt="Helia logo" width="300" />
4+
</a>
5+
</p>
6+
7+
# @helia/unixfs-interop <!-- omit in toc -->
8+
9+
[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)
10+
[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)
11+
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-unixfs)
12+
[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/helia-unixfs/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/ipfs/helia-unixfs/actions/workflows/js-test-and-release.yml?query=branch%3Amain)
13+
14+
> Interop tests for @helia/unixfs
15+
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/unixfs-interop
28+
```
29+
30+
### Browser `<script>` tag
31+
32+
Loading this module through a script tag will make it's exports available as `HeliaUnixfsInterop` in the global namespace.
33+
34+
```html
35+
<script src="https://unpkg.com/@helia/unixfs-interop/dist/index.min.js"></script>
36+
```
37+
38+
## API Docs
39+
40+
- <https://ipfs.github.io/helia-unixfs/modules/_helia_unixfs_interop.html>
41+
42+
## License
43+
44+
Licensed under either of
45+
46+
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
47+
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
48+
49+
## Contribute
50+
51+
Contributions welcome! Please check out [the issues](https://github.com/ipfs/helia-unixfs/issues).
52+
53+
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.
54+
55+
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).
56+
57+
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.
58+
59+
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)

0 commit comments

Comments
 (0)