Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
chore: add interop test suite (#12)
Browse files Browse the repository at this point in the history
Splits repo into monorepo and adds a package for doing interop testing between @helia/unixfs and kubo.

Also updates all deps.
  • Loading branch information
achingbrain authored Mar 15, 2023
1 parent 47c5879 commit 3ad5f5d
Show file tree
Hide file tree
Showing 57 changed files with 779 additions and 221 deletions.
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,26 @@
</a>
</p>

# @helia/unixfs <!-- omit in toc -->
# @helia/ipns <!-- omit in toc -->

[![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)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-unixfs)
[![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)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-ipns.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-ipns)
[![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)

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

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

## Install
## Structure

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

### Browser `<script>` tag

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

```html
<script src="https://unpkg.com/@helia/unixfs/dist/index.min.js"></script>
```
- [`/packages/interop`](./packages/interop) Interop tests for @helia/unixfs
- [`/packages/unixfs`](./packages/unixfs) A Helia-compatible wrapper for UnixFS

## API Docs

Expand Down
173 changes: 27 additions & 146 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@helia/unixfs",
"version": "1.0.5",
"description": "A Helia-compatible wrapper for UnixFS",
"version": "0.0.0",
"description": "An implementation of Unixfs for Helia",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/ipfs/helia-unixfs#readme",
"repository": {
Expand All @@ -12,156 +12,37 @@
"url": "https://github.com/ipfs/helia-unixfs/issues"
},
"keywords": [
"IPFS"
"ipfs"
],
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"type": "module",
"types": "./dist/src/index.d.ts",
"files": [
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
}
},
"eslintConfig": {
"extends": "ipfs",
"parserOptions": {
"sourceType": "module"
}
},
"release": {
"branches": [
"main"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
},
"private": true,
"scripts": {
"clean": "aegir clean",
"lint": "aegir lint",
"dep-check": "aegir dep-check",
"build": "aegir build",
"docs": "aegir docs",
"test": "aegir test",
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main",
"release": "aegir release"
},
"dependencies": {
"@ipld/dag-pb": "^4.0.0",
"@libp2p/interfaces": "^3.3.1",
"@libp2p/logger": "^2.0.5",
"@multiformats/murmur3": "^2.1.2",
"hamt-sharding": "^3.0.2",
"interface-blockstore": "^4.0.1",
"ipfs-unixfs": "^11.0.0",
"ipfs-unixfs-exporter": "^12.0.0",
"ipfs-unixfs-importer": "^14.0.1",
"it-last": "^2.0.0",
"it-pipe": "^2.0.5",
"merge-options": "^3.0.4",
"multiformats": "^11.0.1",
"sparse-array": "^1.3.2"
"reset": "aegir run clean && aegir clean **/node_modules **/package-lock.json",
"test": "aegir run test",
"test:node": "aegir run test:node",
"test:chrome": "aegir run test:chrome",
"test:chrome-webworker": "aegir run test:chrome-webworker",
"test:firefox": "aegir run test:firefox",
"test:firefox-webworker": "aegir run test:firefox-webworker",
"test:electron-main": "aegir run test:electron-main",
"test:electron-renderer": "aegir run test:electron-renderer",
"clean": "aegir run clean",
"generate": "aegir run generate",
"build": "aegir run build",
"lint": "aegir run lint",
"docs": "NODE_OPTIONS=--max_old_space_size=4096 aegir docs",
"docs:no-publish": "npm run docs -- --publish false",
"dep-check": "aegir run dep-check",
"release": "npm run docs:no-publish && aegir run release && npm run docs"
},
"devDependencies": {
"aegir": "^38.1.0",
"blockstore-core": "^3.0.0",
"delay": "^5.0.0",
"it-all": "^2.0.0",
"it-drain": "^2.0.0",
"it-first": "^2.0.0",
"it-to-buffer": "^3.0.0",
"uint8arrays": "^4.0.3"
}
"aegir": "^38.1.0"
},
"type": "module",
"workspaces": [
"packages/*"
]
}
45 changes: 45 additions & 0 deletions packages/interop/.aegir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import getPort from 'aegir/get-port'
import { createServer } from 'ipfsd-ctl'
import * as kuboRpcClient from 'kubo-rpc-client'

/** @type {import('aegir').PartialOptions} */
export default {
test: {
before: async (options) => {
if (options.runner !== 'node') {
const ipfsdPort = await getPort()
const ipfsdServer = await createServer({
host: '127.0.0.1',
port: ipfsdPort
}, {
ipfsBin: (await import('go-ipfs')).default.path(),
kuboRpcModule: kuboRpcClient,
ipfsOptions: {
config: {
Addresses: {
Swarm: [
"/ip4/0.0.0.0/tcp/4001",
"/ip4/0.0.0.0/tcp/4002/ws"
]
}
}
}
}).start()

return {
env: {
IPFSD_SERVER: `http://127.0.0.1:${ipfsdPort}`
},
ipfsdServer
}
}

return {}
},
after: async (options, beforeResult) => {
if (options.runner !== 'node') {
await beforeResult.ipfsdServer.stop()
}
}
}
}
4 changes: 4 additions & 0 deletions packages/interop/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This project is dual licensed under MIT and Apache-2.0.

MIT: https://www.opensource.org/licenses/mit
Apache-2.0: https://www.apache.org/licenses/license-2.0
5 changes: 5 additions & 0 deletions packages/interop/LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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

http://www.apache.org/licenses/LICENSE-2.0

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.
19 changes: 19 additions & 0 deletions packages/interop/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
59 changes: 59 additions & 0 deletions packages/interop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<p align="center">
<a href="https://github.com/ipfs/helia" title="Helia">
<img src="https://raw.githubusercontent.com/ipfs/helia/main/assets/helia.png" alt="Helia logo" width="300" />
</a>
</p>

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

[![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)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/helia-unixfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/helia-unixfs)
[![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)

> Interop tests for @helia/unixfs
## 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/unixfs-interop
```

### Browser `<script>` tag

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

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

## API Docs

- <https://ipfs.github.io/helia-unixfs/modules/_helia_unixfs_interop.html>

## 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

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

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.

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).

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.

[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
Loading

0 comments on commit 3ad5f5d

Please sign in to comment.