Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export binary from @helia/interop #384

Merged
merged 1 commit into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/interop/.aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as kuboRpcClient from 'kubo-rpc-client'
/** @type {import('aegir').PartialOptions} */
export default {
test: {
files: './dist/src/*.spec.js',
before: async (options) => {
if (options.runner !== 'node') {
const ipfsdPort = await getPort()
Expand Down
11 changes: 11 additions & 0 deletions packages/interop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@

> Interop tests for Helia
# About

Runs interop tests between Helia and Kubo.

## Example - Testing a new Kubo release

```console
$ npm i @helia/interop
$ KUBO_BINARY=/path/to/kubo helia-interop
```

# Install

```console
Expand Down
10 changes: 7 additions & 3 deletions packages/interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"keywords": [
"IPFS"
],
"bin": {
"helia-interop": "./dist/src/bin.js"
},
"type": "module",
"types": "./dist/src/index.d.ts",
"files": [
Expand Down Expand Up @@ -52,7 +55,7 @@
"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main"
},
"devDependencies": {
"dependencies": {
"@helia/block-brokers": "^1.0.0",
"@helia/car": "^2.0.1",
"@helia/dag-cbor": "^2.0.1",
Expand Down Expand Up @@ -88,8 +91,9 @@
"wherearewe": "^2.0.1"
},
"browser": {
"./dist/test/fixtures/create-helia.js": "./dist/test/fixtures/create-helia.browser.js",
"./dist/test/fixtures/create-kubo.js": "./dist/test/fixtures/create-kubo.browser.js",
"./dist/src/fixtures/create-helia.js": "./dist/src/fixtures/create-helia.browser.js",
"./dist/src/fixtures/create-kubo.js": "./dist/src/fixtures/create-kubo.browser.js",
"./dist/src/bin.js": "./dist/src/index.js",
"kubo": false
}
}
18 changes: 18 additions & 0 deletions packages/interop/src/bin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /usr/bin/env node
/* eslint-disable no-console */

import { spawn } from 'node:child_process'

const test = spawn('npx', ['aegir', 'test'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need npx here but not sure of the hassle of getting aegir binary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aegir is installed as a dep - we need to find the binary so we could assume the location with:

spawn('node', ['node_modules', '.bin', 'aegir', 'test'])

or use npx and let npm figure it out.


test.stdout.on('data', (data) => {
process.stdout.write(data)
})

test.stderr.on('data', (data) => {
process.stderr.write(data)
})

test.on('close', (code) => {
process.exit(code ?? 0)
})
File renamed without changes.
13 changes: 13 additions & 0 deletions packages/interop/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
/**
* @packageDocumentation
*
* Runs interop tests between Helia and Kubo.
*
* @example Testing a new Kubo release
*
* ```console
* $ npm i @helia/interop
* $ KUBO_BINARY=/path/to/kubo helia-interop
* ```
*/

export {}
File renamed without changes.
3 changes: 0 additions & 3 deletions packages/interop/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
{
"path": "../helia"
},
{
"path": "../interface"
},
{
"path": "../ipns"
},
Expand Down