Monorepo for Streamr Network packages.
|NodeJS version |
Uses npm workspaces to manage monorepo.
Important: Do not use
npm ci or
npm install directly in the sub-package directories.
Install the dependencies and build all sub-packages, linking sub-packages together as needed.
# from top level npm ci
Install and build a single sub-package.
bootstrap-pkg installs the dependencies of a given sub-package, building and linking any required internal
sub-packages (by running their
prepare scripts), and finally the target dependency by using its
# from top level npm run bootstrap-pkg $PACKAGE_NAME
# from top level npm run bootstrap-pkg streamr-client npm run bootstrap-pkg streamr-network
To build all sub-packages (with dependencies pre-installed beforehand)
# from top level npm run build
# from top level npm run clean-lockfiles
The below clears all caches and removes
dist directories from each sub-package.
# from top level npm run clean-dist
Alternatively, to just clear caches.
# from top level npm run clean-cache
This removes all caches, built files, and
node_modules of each sub-package, and the
You will need to run
npm install, or
npm run bootstrap before proceeding.
# from top level npm run clean
Manually add the entry to the
package.json of the sub-package and
npm run bootstrap-pkg $PACKAGE_NAME.
npm install some-dependency --workspace=$PACKAGE_NAME
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.
|Command||After (using |
|Installs all top-level dependencies AND sub-packages according to top-level |
|Installs all top-level dependencies AND sub-packages and updates |
|Installs top-level dependencies AND the dependencies for a sub-package using package-lock. Does not update |
|Installs top-level dependencies (|
|Removes cache and |
|Removes all cache, dist & packages from root & sub-package |
|Removes all packages except the production deps needed by the specified package's |
|Removes all packages except those needed by top-level |
|Removes only top-level package-lock. There should only be a single top-level package-lock.|
git checkout main cd packages/network npm version <SEMVER_OPTION> # Go thru other packages' package.json and update streamr-network entry (if present) to newly generated version git add package.json git commit -m "release(network): vX.Y.Z" git tag network/vX.Y.Z git push origin git push origin network/vX.Y.Z npm publish
git checkout main cd packages/client npm version <SEMVER_OPTION> # Go thru broker's and cli-tools' package.json and update streamr-client entry to newly generated version git add package.json git commit -m "release(client): vX.Y.Z" git tag client/vX.Y.Z git push origin git push origin client/vX.Y.Z # If everything above went thru npm run build-production cd dist npm publish # Generate & upload API docs (if a major/minor version update) cd .. npm run docs aws s3 cp ./docs s3://api-docs.streamr.network/client/vX.Y --recursive --profile streamr-api-docs-upload # and update the API reference link in s3://api-docs.streamr.network/index.html
git checkout main cd packages/cli-tools npm version <SEMVER_OPTION> git add package.json git commit -m "release(cli-tools): vX.Y.Z" git tag cli-tools/vX.Y.Z git push origin git push origin cli-tools/vX.Y.Z npm run build npm publish
git checkout main cd packages/broker npm version <SEMVER_OPTION> git add package.json git commit -m "release(broker): vX.Y.Z" git tag broker/vX.Y.Z git push origin git push origin broker/vX.Y.Z npm run build npm publish
npm workspacesinstead of
npm@8, workspaces on
--workspace, as well as how they work with
npm ciwill install everything.
npm run bootstrapis
npm run bootstrap-pkg streamr-network, without running anything else beforehand. No
npm run bootstrapneeded.
bootstrap-pkginstalls both top-level and sub-dependencies. This is equivalent to what
npm ci && npm run bootstrap-pkg streamr-networkused to do.
npm install --workspacefrom the top-level, with the name of the sub-package you want to update. e.g.
npm install --workspace=streamr-network, or just regular
npm installat the top-level to install everything. It's possible these two commands will generate different package-lock results 🤷 .
npm run bootstrap-rootRemoves dist/cache & any sub-package dependencies from
package.jsonalone. Use when you (only) want to be able to run top-level scripts e.g.
npm run versionswithout installing anything else.
npm run eslintruns
eslintfor all packages. This runs as a git push hook.
npm run versionsalso run
manypkg check. This lints package.json to do things like ensure all packages are using the same versions of dependencies. e.g. same version of TS in every package.