Publishing

Because contracts live in your client applications, publishing and sharing contracts require maintaining a separate package.json specifically for your contracts. This lets you publish only your contracts to an npm registry.

Private APIs

If you're working with a private API, it's recommended that you use either private package, or something else like Gemfury to keep your contracts private. If you're completely opposed to either of those options, you also have the option of using your github repo as your contract package.

Distributing Contracts

The Rivet CLI helps manage your contracts with an npm registry. There are 4 CLI commands that you should be aware of. All of these commands are expected to be run from your consumer application root directory (along side your package.json that requires rivet)

rivet compile

Compiles your javascript contract files into JSON Schema files, for distribution.

rivet watch

Watches contracts for change to files, and compiles changes to JSON Schema files, for distribution.

rivet version <version|major|minor|patch>

Bumps the contracts version, and writes the new version to the contracts' package.json. It will also create a version commit and tag.

rivet publish

Publishes your contracts package to the registry.

Note: Only use this, if you are using an npm registry to host your contracts.

Importing Contracts

Last updated