Publish generated contract bindings to npm
Configure a GitMyABI project so each successful build publishes typed TypeScript contract bindings to npm.
Every GitMyABI project that builds successfully publishes a TypeScript bindings package to an npm registry. This guide covers the configuration that controls package visibility and how a consumer installs the result. Use the package name, version, and registry shown on the build detail page rather than hardcoding any of these values.
What gets published
A versioned npm package containing one named class export per compiled contract. The shape of the package is documented in review the package format.
Steps
- Open the project — either during initial setup or in Project Settings — and locate the NPM Package Visibility section.
- Use the checkbox labelled “Make this package publicly accessible without authentication” to choose the package's visibility. By default, this checkbox is auto-synced from the GitHub repository's visibility: public repositories produce public packages, private repositories produce private packages. You can change this later in project settings.
- For private packages, configure the registry shown in the package installation instructions on the build detail page. The registry configuration includes the registry URL and an authentication token. The exact values are project-specific; do not assume a fixed registry URL.
- Trigger a build for the desired branch, tag, release, or commit. On success, the build detail page shows the package name, version, and install command.
Versioning
The published package version comes from the project's package.json if one is set, otherwise it falls back to 0.0.<buildNumber>. The published version is shown on the build detail page.
Package name
The published package name is shown on the build detail page; reference it from there rather than guessing a convention. Consumers install with npm install <package-name>@<version> using the values displayed there.
See ABI and TypeScript bindings publishing for the end-to-end pipeline.
Related
- ABI and bindings publishing
How GitMyABI delivers ABIs via CDN and bindings via npm.
- Generated contract bindings
TypeScript packages produced from contract ABIs for typed integration.
- Use generated bindings in a frontend
Consume a published bindings package from a frontend application.
- Package format
Shape of the published bindings package and the CDN-hosted ABI artifacts.