Skip to content

A monorepo containing Data Union SDK, smart contracts, and subgraphs

Notifications You must be signed in to change notification settings

dataunions/dataunions

Repository files navigation

Discord Chat

Discord Chat

Data Union monorepo

/packages:

  • contracts: Smart contracts for Data Unions 2.0 and 3.0
  • client: Data Union client
  • thegraph-subgraph: TheGraph subgraph for Data Union smart contracts
  • join-server: Base implementation of a HTTP server for requiring Data Union members to fulfil certain requirements in order to join a Data Union
  • default-join-server: Simple HTTP server that adds members who know a secret password, and gives them publish rights to the DU's streams. Hosted by the DU DAO at

Development

Monorepo is managed using npm workspaces. Integration tests are run in Streamr docker dev environment and its configs are found in the @streamr/config NPM package.

Important: Do not use npm ci or npm install directly in the sub-package directories, only in the root directory.

Load project Node and npm

nvm use

Bootstrap all sub-packages

The go to command for most use cases.

To install all required dependencies and build all sub-packages (linking sub-packages together as needed):

# from top level
npm run bootstrap

Bootstrap a single sub-package

To install the required dependencies and build a specific sub-package:

# from top level
npm run bootstrap-pkg --package=$PACKAGE_NAME

Install dependencies only

To only install required dependencies and link sub-packages together (and skip build phase):

# from top level
npm ci

Build

To build all sub-packages:

# from top level
npm run build

Build a sub-package

To build a specific sub-package:

# from top level
npm run build --workspace=$PACKAGE_NAME

Clear caches and built files

To clear all caches and remove the dist directory from each sub-package:

# from top level
npm run clean-dist

Clean all

To removes all caches, built files, and node_modules of each sub-package, and the top-level node_modules:

# from top level
npm run clean

Add a dependency into a sub-package

Manually add the entry to the package.json of the sub-package and run npm run bootstrap-pkg $PACKAGE_NAME.

Alternatively:

npm install some-dependency --workspace=$PACKAGE_NAME

List active versions & symlinks

Check which sub-packages are currently being symlinked.

# from top level
npm run versions

This lists sub-packages & their versions on the left, linked sub-packages are columns. If the package on the left links to the package in the column, it shows a checkmark & the semver range, otherwise it shows the mismatched semver range and prints a warning at the end. It prints the version ranges so you can double-check that they're formatted as you expect e.g. ^X.Y.Z vs X.Y.Z

image

Install dependencies:

npm ci

Build client:

cd packages/client
npm run build

Run tests:

npm run test