🎈 Thanks for your help improving the project! We are so happy to have you!
No contribution is too small and all contributions are valued.
This guide will help you get started. Do not let this guide intimidate you. It should be considered a map to help you navigate the process. Any concerns not addressed in this guide can be raised via a Github issue or discussion.
Nomad strives to create an inclusive and welcoming development environment. Generally, we follow the Rust Code of Conduct.
This is the minimum expected behavior of our employees and outside contributors. Violations of this code of conduct should be reported to the team directly via [email protected].
This repo is a yarn workspace. All
packages are located in packages/
. Generally, packages are intended to
contain a src/
directory, which is built to dist/
See [Publishing to npm]
(#publishing-to-npm) for more details on publishing each package to [npm]
(https://www.npmjs.com/settings/nomad-xyz/packages).
Published packages:
@nomad-xyz/contracts-core
@nomad-xyz/contracts-router
@nomad-xyz/contracts-bridge
@nomad-xyz/sdk
@nomad-xyz/sdk-bridge
@nomad-xyz/sdk-govern
Tooling and other unpublished packages:
local-environment
deploy
indexer
Examples:
After cloning the repo, Confirm that you are using yarn2
$ yarn -v
And install Foundry using the instructions here or via these commands:
$ curl -L https://foundry.paradigm.xyz | bash
$ foundryup
If needed, reference Foundry's Troubleshooting Installation guide to resolve any errors.
Then run the following:
$ yarn install
$ yarn build
If you wish to interact with the local environment, Docker is a requirement and can be downloaded here.
Packages in this repo follow a standard yarn script template. New packages should implement these scripts. All of these scripts should work in any package. Running them from the repo root will run them concurrently in all packages.
$ yarn prettier
$ yarn lint
$ yarn test:unit
$ yarn build
To create a new package, perform the following steps:
- Make a new directory in
packages/
- From that new directory, run
yarn init
$ yarn add
any dependencies- Common deps include:
ethers
- Common dev-deps include:
typescript
,eslint
,eslint-config-prettier
- Check other
package.json
files for a list :)
- Common deps include:
- In the newly generated
package.json
do the following:- set the standard 4 yarn scripts (usually copied from other packages)
- set
"main": "dist/index.js",
- set
"types": "dist/index.d.ts",
- ensure that in-repo deps are specified as
"workspace:^
- Create a
src/
directory to hold the TS source - Create a new
tsconfig.json
- make sure to set the
"references"
key if you have in-repo deps :)
- make sure to set the
- Update the
"references"
key inpackages/tsconfig.package.json
- Copy and review the following files from another package
.gitignore
.eslintrc.json
.prettierrc
.eslintignore
- Write a
README.md
for your package - Create a
CHANGELOG.md
for your package
Yes this is a lot, we intend to automate it later :)
Before publishing any package to npm
perform the following steps:
- Run
yarn
to ensure the lockfile is up to date - Run
yarn lint
to ensure all packages are linted - Run
yarn test:unit
to ensure all unit tests are passing - Run
yarn build
to build all the packages - Ensure that your package has a sensible
.npmignore
- Ensure that the
main
andtypes
keys in your package are set correctly - Bump the version number in
package.json
(https://semver.org/, ask the team if you're unsure) - Commit the above changes to a branch
- Create a PR and get approval
- Merge the PR to main
- Pull and checkout latest main and tag the commit (
git tag -s <package-to-release>@<new-package-version> <commit>
) - Push tags (
git push --tags
) - From the tagged commit, ensure your working tree is clean with
git status
- Ensure that you are on the root of the monorepo before publishing. Publishing from the individual package folder will not replace versions with
workspace:^
with the actual versions in the package.json that is uploaded to npm. This will cause errors when you try to install the packages from npm. - Publish to npm (run this from the root
yarn <package-to-release> npm publish --access public
)