Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

chore: monorepo separating interfaces and compliance tests #97

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
30 changes: 30 additions & 0 deletions .github/workflows/bundlesize.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# Checks bundlesize, does not run on master
on:
pull_request:
branches:
- '*'

name: Bundlesize
jobs:
check:
runs-on: ubuntu-latest # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
strategy:
matrix:
node-version: [16]
project:
- packages/interfaces
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v2
- run: npm install -g @mapbox/node-pre-gyp && npm install
- name: Bundlesize ${{ matrix.project }}
uses: ipfs/aegir/actions/[email protected]
continue-on-error: true
with:
project: ${{ matrix.project }}
github_token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 16 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,46 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npx aegir lint
- uses: gozala/[email protected]
- run: npx aegir build
- run: npx aegir dep-check
- uses: ipfs/aegir/actions/bundle-size@master
name: size
- uses: actions/setup-node@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
node-version: 16
- run: npm install
- run: npm run lint
- run: npm run build
- run: npm run dep-check
test-node:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node: [14, 15]
node: [16]
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npx nyc --reporter=lcov aegir test -t node -- --bail
- run: npm run test:node -- -- --bail
- uses: codecov/codecov-action@v1
test-chrome:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install
- run: npx aegir test -t browser -t webworker --bail
- run: npm run test:browser -- -- --bail
test-firefox:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install
- run: npx aegir test -t browser -t webworker --bail -- --browsers FirefoxHeadless
- run: npm run test:browser -- -- --bail --browser firefox
27 changes: 4 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,10 @@

[Jacob Heun](https://github.com/jacobheun).

## Interfaces

- [Connection](./src/connection)
- [Content Routing](./src/content-routing)
- [Crypto](./src/crypto)
- [Peer Discovery](./src/peer-discovery)
- [Peer Routing](./src/peer-routing)
- [Pubsub](./src/pubsub)
- [Record](./src/record)
- [Stream Muxer](./src/stream-muxer)
- [Topology](./src/topology)
- [Transport](./src/transport)

### Origin Repositories

For posterity, here are links to the original repositories for each of the interfaces (if they had one).
- [Connection](https://github.com/libp2p/interface-connection)
- [Content Routing](https://github.com/libp2p/interface-content-routing)
- [Peer Discovery](https://github.com/libp2p/interface-peer-discovery)
- [Peer Routing](https://github.com/libp2p/interface-peer-routing)
- [Pubsub](https://github.com/libp2p/js-libp2p-pubsub)
- [Stream Muxer](https://github.com/libp2p/interface-stream-muxer)
- [Transport](https://github.com/libp2p/interface-transport)
## Structure

* [`/packages/interfaces`](./packages/interfaces) The interface definitions of various libp2p components
* [`/packages/compliance-tests`](./packages/compliance-tests) Tests to ensure adherence of an implementation to the spec

## Contribute

Expand Down
24 changes: 24 additions & 0 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"lerna": "3.22.0",
"packages": [
"packages/*"
],
"version": "independent",
"command": {
"bootstrap": {
"hoist": true
},
"run": {
"stream": true
},
"publish": {
"message": "chore: publish",
"createRelease": "github",
"conventionalCommits": true,
"verifyAccess": false
},
"version": {
"private": false
}
}
}
129 changes: 24 additions & 105 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,120 +1,39 @@
{
"name": "libp2p-interfaces",
"version": "0.12.1",
"name": "js-libp2p-interfaces",
"version": "1.0.0",
"description": "Interfaces for JS Libp2p",
"leadMaintainer": "Jacob Heun <[email protected]>",
"main": "src/index.js",
"files": [
"src",
"types",
"dist"
],
"types": "dist/src/index.d.ts",
"typesVersions": {
"*": {
"src/*": [
"dist/src/*",
"dist/src/*/index"
]
}
},
"eslintConfig": {
"extends": "ipfs"
},
"private": true,
"scripts": {
"prepare": "aegir build --no-bundle",
"lint": "aegir lint",
"build": "npm run build:proto && npm run build:proto-types && npm run build:types",
"build:types": "aegir build --no-bundle",
"build:proto": "npm run build:proto:rpc && npm run build:proto:topic-descriptor",
"build:proto:rpc": "pbjs -t static-module -w commonjs -r libp2p-pubsub-rpc --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/pubsub/message/rpc.js ./src/pubsub/message/rpc.proto",
"build:proto:topic-descriptor": "pbjs -t static-module -w commonjs -r libp2p-pubsub-topic-descriptor --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/pubsub/message/topic-descriptor.js ./src/pubsub/message/topic-descriptor.proto",
"build:proto-types": "npm run build:proto-types:rpc && npm run build:proto-types:topic-descriptor",
"build:proto-types:rpc": "pbts -o src/pubsub/message/rpc.d.ts src/pubsub/message/rpc.js",
"build:proto-types:topic-descriptor": "pbts -o src/pubsub/message/topic-descriptor.d.ts src/pubsub/message/topic-descriptor.js",
"test": "aegir test",
"test:node": "aegir test --target node",
"test:browser": "aegir test --target browser",
"release": "aegir release -t node -t browser",
"release-minor": "aegir release --type minor -t node -t browser",
"release-major": "aegir release --type major -t node -t browser"
"reset": "lerna run clean && rimraf ./node_modules ./package-lock.json packages/*/node_modules packages/*/package-lock.json packages/*/dist",
"test": "lerna run test",
"test:node": "lerna run test:node",
"test:browser": "lerna run test:browser",
"build": "lerna run build",
"lint": "lerna run lint",
"dep-check": "lerna run dep-check",
"release": "lerna run build && lerna publish"
},
"bugs": "https://github.com/libp2p/js-libp2p-interfaces/issues",
"homepage": "https://github.com/libp2p/js-libp2p-interfaces#readme",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/libp2p/js-interfaces.git"
"url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
},
"keywords": [
"libp2p",
"interface"
],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/libp2p/js-interfaces/issues"
},
"homepage": "https://github.com/libp2p/js-interfaces#readme",
"workspaces": [
"packages/*"
],
"dependencies": {
"abort-controller": "^3.0.0",
"abortable-iterator": "^3.0.0",
"chai": "^4.3.4",
"chai-checkmark": "^1.0.1",
"debug": "^4.3.1",
"delay": "^5.0.0",
"detect-node": "^2.0.4",
"dirty-chai": "^2.0.1",
"err-code": "^3.0.1",
"it-goodbye": "^3.0.0",
"it-length-prefixed": "^5.0.2",
"it-pair": "^1.0.0",
"it-pipe": "^1.1.0",
"it-pushable": "^1.4.2",
"libp2p-crypto": "^0.19.5",
"libp2p-tcp": "^0.17.0",
"multiaddr": "^10.0.0",
"multiformats": "^9.0.2",
"p-defer": "^3.0.0",
"p-limit": "^3.1.0",
"p-wait-for": "^3.2.0",
"peer-id": "^0.15.0",
"protobufjs": "^6.10.2",
"sinon": "^11.1.1",
"streaming-iterables": "^6.0.0",
"uint8arrays": "^2.1.3"
},
"devDependencies": {
"@types/bl": "^5.0.1",
"@types/debug": "^4.1.5",
"aegir": "^33.0.0",
"events": "^3.3.0",
"it-handshake": "^2.0.0",
"rimraf": "^3.0.2",
"util": "^0.12.3"
"lerna": "^4.0.0",
"rimraf": "^3.0.2"
},
"contributors": [
"Alan Shaw <[email protected]>",
"David Dias <[email protected]>",
"David Dias <[email protected]>",
"Dmitriy Ryajov <[email protected]>",
"Friedel Ziegelmayer <[email protected]>",
"Greg Zuro <[email protected]>",
"Jacob Heun <[email protected]>",
"Jacob Heun <[email protected]>",
"James Ray <[email protected]>",
"Jeffrey Hulten <[email protected]>",
"João Santos <[email protected]>",
"Maciej Krüger <[email protected]>",
"Matt Joiner <[email protected]>",
"Mike Goelzer <[email protected]>",
"Patrik Wallstrom <[email protected]>",
"Pau Ramon Revilla <[email protected]>",
"Richard Littauer <[email protected]>",
"Sathya Narrayanan <[email protected]>",
"Vasco Santos <[email protected]>",
"Vasco Santos <[email protected]>",
"dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>",
"dirkmc <[email protected]>",
"dmitriy ryajov <[email protected]>",
"greenkeeperio-bot <[email protected]>",
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <[email protected]>"
]
"engines": {
"node": ">=14.0.0",
"npm": ">=7.0.0"
}
}
7 changes: 7 additions & 0 deletions packages/compliance-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# JS libp2p Interfaces - compliance tests

> Contains test suites you should use to implement the various components of libp2p.

## Usage

Each [interface](../interfaces) has its documentation on how to use the compliance tests and should be used as the source of truth.
86 changes: 86 additions & 0 deletions packages/compliance-tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"name": "libp2p-interfaces-compliance-tests",
"version": "0.0.0",
"description": "Compliance tests for JS Libp2p interfaces",
"files": [
"src",
"dist"
],
"eslintConfig": {
"extends": "ipfs"
},
"scripts": {
"lint": "aegir lint",
"dep-check": "aegir dep-check",
"test": "aegir test",
"test:node": "aegir test --target node",
"test:browser": "aegir test --target browser",
"release": "aegir release --no-test",
"release-minor": "aegir release --type minor --no-test",
"release-major": "aegir release --type major --no-test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
},
"keywords": [
"libp2p",
"interface"
],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/libp2p/js-libp2p-interfaces/issues"
},
"homepage": "https://github.com/libp2p/js-libp2p-interfaces#readme",
"dependencies": {
"abort-controller": "^3.0.0",
"abortable-iterator": "^3.0.0",
"aegir": "^33.2.2",
"chai": "^4.3.4",
"chai-checkmark": "^1.0.1",
"delay": "^5.0.0",
"it-goodbye": "^3.0.0",
"it-pair": "^1.0.0",
"it-pipe": "^1.1.0",
"libp2p-interfaces": "^0.12.1",
"multiaddr": "^10.0.0",
"p-defer": "^3.0.0",
"p-limit": "^3.1.0",
"p-wait-for": "^3.2.0",
"peer-id": "^0.15.0",
"sinon": "^11.1.1",
"streaming-iterables": "^6.0.0",
"uint8arrays": "^2.1.3"
},
"devDependencies": {
"it-handshake": "^2.0.0"
},
"contributors": [
"Alan Shaw <[email protected]>",
"David Dias <[email protected]>",
"David Dias <[email protected]>",
"Dmitriy Ryajov <[email protected]>",
"Friedel Ziegelmayer <[email protected]>",
"Greg Zuro <[email protected]>",
"Jacob Heun <[email protected]>",
"Jacob Heun <[email protected]>",
"James Ray <[email protected]>",
"Jeffrey Hulten <[email protected]>",
"João Santos <[email protected]>",
"Maciej Krüger <[email protected]>",
"Matt Joiner <[email protected]>",
"Mike Goelzer <[email protected]>",
"Patrik Wallstrom <[email protected]>",
"Pau Ramon Revilla <[email protected]>",
"Richard Littauer <[email protected]>",
"Sathya Narrayanan <[email protected]>",
"Vasco Santos <[email protected]>",
"Vasco Santos <[email protected]>",
"dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>",
"dirkmc <[email protected]>",
"dmitriy ryajov <[email protected]>",
"greenkeeperio-bot <[email protected]>",
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <[email protected]>"
]
}
Loading