From 6461ba3851dea1fa4381a0fb1477c669279cdd44 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Wed, 4 Dec 2024 16:01:05 -0500 Subject: [PATCH] Prepare for NPM publishing, update instructions for NPM and Soldeer (#86) --- .gitignore | 3 +++ README.md | 25 +++++++++++++++++++++ docs/modules/pages/foundry-upgrades.adoc | 28 ++++++++++++++++++++++++ package.json | 16 ++++++++++++-- 4 files changed, 70 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b33036f..a1728e5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ broadcast/ # Node modules node_modules/ +# NPM package files +*.tgz + # Hardhat build output artifacts/ cache_hardhat/ diff --git a/README.md b/README.md index 0096df3..73074fb 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,31 @@ Set the following in `remappings.txt`: > **Note** > Use [LegacyUpgrades.sol](src/LegacyUpgrades.sol) instead of `Upgrades.sol` to upgrade existing deployments that were created with OpenZeppelin Contracts v4. +### Optional: Alternative installation methods + +#### NPM + +Follow the steps above, but instead of running `forge install OpenZeppelin/openzeppelin-foundry-upgrades`, use this command instead: +``` +npm install @openzeppelin/foundry-upgrades +``` + +Then add the following additional lines to `remappings.txt`, in addition to the ones described above: +``` +openzeppelin-foundry-upgrades/=node_modules/@openzeppelin/foundry-upgrades/src/ +solidity-stringutils/=node_modules/@openzeppelin/foundry-upgrades/lib/solidity-stringutils/ +``` + +#### Soldeer + +Follow the steps above, but instead of running `forge install OpenZeppelin/openzeppelin-foundry-upgrades`, use one of the install commands described in https://soldeer.xyz/project/openzeppelin-foundry-upgrades + +Then add the following additional lines to `remappings.txt`, in addition to the ones described above (replace `0.3.6` with the version of the plugin that you installed): +``` +openzeppelin-foundry-upgrades/=dependencies/openzeppelin-foundry-upgrades-0.3.6/src/ +solidity-stringutils/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/solidity-stringutils/ +``` + ## OpenZeppelin Defender integration See [DEFENDER.md](DEFENDER.md) diff --git a/docs/modules/pages/foundry-upgrades.adoc b/docs/modules/pages/foundry-upgrades.adoc index 5729046..70c68f5 100644 --- a/docs/modules/pages/foundry-upgrades.adoc +++ b/docs/modules/pages/foundry-upgrades.adoc @@ -49,6 +49,34 @@ Set the following in `remappings.txt`: NOTE: Use `LegacyUpgrades.sol` instead of `Upgrades.sol` to upgrade existing deployments that were created with OpenZeppelin Contracts v4. +=== Optional: Alternative installation methods + +==== NPM + +Follow the steps above, but instead of running `forge install OpenZeppelin/openzeppelin-foundry-upgrades`, use this command instead: +[source,console] +---- +npm install @openzeppelin/foundry-upgrades +---- + +Then add the following additional lines to `remappings.txt`, in addition to the ones described above: +[source,console] +---- +openzeppelin-foundry-upgrades/=node_modules/@openzeppelin/foundry-upgrades/src/ +solidity-stringutils/=node_modules/@openzeppelin/foundry-upgrades/lib/solidity-stringutils/ +---- + +==== Soldeer + +Follow the steps above, but instead of running `forge install OpenZeppelin/openzeppelin-foundry-upgrades`, use one of the install commands described in https://soldeer.xyz/project/openzeppelin-foundry-upgrades + +Then add the following additional lines to `remappings.txt`, in addition to the ones described above (replace `0.3.6` with the version of the plugin that you installed): +[source,console] +---- +openzeppelin-foundry-upgrades/=dependencies/openzeppelin-foundry-upgrades-0.3.6/src/ +solidity-stringutils/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/solidity-stringutils/ +---- + == Foundry Requirements This library requires https://github.com/foundry-rs/forge-std[forge-std] version 1.8.0 or higher. diff --git a/package.json b/package.json index 6a59885..da3e27e 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,16 @@ { - "name": "openzeppelin-foundry-upgrades", - "private": true, + "name": "@openzeppelin/foundry-upgrades", "version": "0.3.6", + "description": "Foundry library for deploying and managing upgradeable contracts", "license": "MIT", + "files": [ + "src/**/*", + "lib/solidity-stringutils/**/*" + ], + "repository": { + "type": "git", + "url": "https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades.git" + }, "scripts": { "clean": "forge clean && hardhat clean", "compile": "forge build", @@ -33,5 +41,9 @@ "solhint": "^3.3.6", "solhint-plugin-openzeppelin": "file:scripts/solhint-custom", "solidity-docgen": "^0.6.0-beta.36" + }, + "peerDependencies": { + "@openzeppelin/defender-deploy-client-cli": "0.0.1-alpha.9", + "@openzeppelin/upgrades-core": "^1.37.0" } }