-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Description
In the latest version of @openzeppelin/wizard and @openzeppelin/contracts-mcp, attempting to use these packages as a dependency causes the following error:
Cannot find module '../openzeppelin-contracts' from 'node_modules/@openzeppelin/wizard/dist/get-versioned-remappings.js'
Require stack:
node_modules/@openzeppelin/wizard/dist/get-versioned-remappings.js
node_modules/@openzeppelin/wizard/dist/api.js
node_modules/@openzeppelin/wizard/dist/index.js
node_modules/@openzeppelin/contracts-mcp/dist/solidity/tools/account.js
node_modules/@openzeppelin/contracts-mcp/dist/solidity/tools.js
node_modules/@openzeppelin/contracts-mcp/dist/index.js
app/contracts/solidity/[transport]/route.ts
__tests__/contracts/solidity.test.ts
Full log is here: https://github.com/OpenZeppelin/openzeppelin-mcp/actions/runs/19337851749/job/55317829277
This occurs because in #724, packages/core/solidity/src/get-versioned-remappings.ts uses the version field from packages/core/solidity/openzeppelin-contracts.json, but this JSON file is not included in the NPM package.
We should NOT include the entire JSON file, because most of its contents is just OpenZeppelin Contracts source code and is not necessary for the API/MCP. Including that file would just make the NPM package unnecessarily large.
The proper fix should be:
- In
packages/core/solidity/src/scripts/prepare.ts, when it generatesopenzeppelin-contracts.json, add a step to also generate a separate file containing only theversionfield. This can be a minimal json file, for exampleopenzeppelin-contracts-version.jsonwith only the following contents:
{
"version": "5.5.0"
}
- Add a file similar to
packages/core/solidity/openzeppelin-contracts.d.tswith only the version field. This is used for the types. - Update
packages/core/solidity/src/get-versioned-remappings.tsto get the version from the new file instead ofopenzeppelin-contracts. - Update the
filesentry inpackages/core/solidity/package.jsonto include the new json file in the package. - Run
yarn changesetto add apatchchange for@openzeppelin/wizard
Metadata
Metadata
Assignees
Labels
No labels