Repository navigation
build(npm): pack portable sources and ABIs as @crossecute/protocol - #137
Merged
Merged
Conversation
pack.mjs ships every src/ file whose imports stay within the protocol, OpenZeppelin and the guard, rewritten to relative imports, so integrators can depend on the package without the repo's remappings or submodules.
A tag npm-v<version> publishes after the npm environment's reviewer approves, with no npm token and with provenance. The job refuses a tag that does not match the version or a package with install scripts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
contracts/evm/npm/, which builds@crossecute/protocol: Solidity sources and ABIs that integrators can install with npm instead of adding this repo as a submodule.npm/pack.mjsruns afterforge build. It ships every file undersrc/(and the guard'ssrc/once that merges) whose imports stay within the protocol, OpenZeppelin and the guard. It rewrites those imports to relative paths. It also writes each shipped contract's ABI as JSON, plusabi/index.jsandabi/index.d.tswith literal types for viem. OpenZeppelin 5.4.0 is a peer dependency. The provider bindings undersrc/protocols/<p>/import vendored provider code, so they are left out.No file under
src/changes. Rewriting the baresrc/...imports at pack time keeps this out of the way of #117, #135 and #116.Why
A submodule brings the whole dependency tree (forge-std, both OpenZeppelin repos, and their nested submodules) into every project that depends on an SDK built on the protocol. It also pins a second copy of OpenZeppelin there. The package ships only the sources an integrator compiles.
Derived addresses
The package README tells consumers not to predict conduit addresses with
ProxyInitCode.hash()orProxyDeployer.predictcompiled in their own project. Both hashtype(Proxy).creationCodewith the consumer's compiler settings. Consumers should callpredictReceiver/predictTransmitteron the deployed transceiver instead.Checked
main: 51 sources and 63 ABIs.ICrossecuteGuardincluded) and 81 ABIs.npm/check-consumer.shrepeats that check under solc 0.8.28, the oldest compiler the package README promises. The newnpm-packageCI job runs it. With the rewrite deliberately broken for one file, the check fails.Publishing
.github/workflows/publish.ymlpublishes from a tagnpm-v<version>through npm trusted publishing. No npm token exists, and npm attaches provenance tying the tarball to the run. The job waits for a reviewer on thenpmenvironment, refuses a tag that does not matchpackage.json's version or a package with install scripts, and reruns the consumer check before publishing.Before the first release:
@crossecute/protocol: repositorycrossecute/protocol, workflowpublish.yml, environmentnpm. npm only allows this once the package exists, so a 0.0.0 placeholder reserves the name.npmenvironment in this repository's settings with required reviewers.Not in this PR
deploy/.