From 928c1034f992d5956a1b4f2e31a55880a0ec87dd Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 13 Oct 2023 09:35:19 +0100 Subject: [PATCH 1/5] feat(cli): add --alwaysPostDeploy flag to deploys --- packages/cli/src/runDeploy.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/runDeploy.ts b/packages/cli/src/runDeploy.ts index 0a5f370a70..7b759c7a6c 100644 --- a/packages/cli/src/runDeploy.ts +++ b/packages/cli/src/runDeploy.ts @@ -26,6 +26,10 @@ export const deployOptions = { worldAddress: { type: "string", desc: "Deploy to an existing World at the given address" }, srcDir: { type: "string", desc: "Source directory. Defaults to foundry src directory." }, skipBuild: { type: "boolean", desc: "Skip rebuilding the contracts before deploying" }, + alwaysPostDeploy: { + type: "boolean", + desc: "Always run PostDeploy.s.sol after each deploy (including during upgrades). By default, PostDeploy.s.sol is only run once after a new world is deployed.", + }, } as const satisfies Record; export type DeployOptions = InferredOptionTypes; @@ -84,7 +88,7 @@ in your contracts directory to use the default anvil private key.` client, config: resolvedConfig, }); - if (opts.worldAddress == null) { + if (opts.worldAddress == null || opts.alwaysPostDeploy) { await postDeploy(config.postDeployScript, worldDeploy.address, rpc, profile); } console.log(chalk.green("Deployment completed in", (Date.now() - startTime) / 1000, "seconds")); From bc9f75f3b6bba93d1a0caab0a8d27788e43ffcc7 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 13 Oct 2023 01:38:48 -0700 Subject: [PATCH 2/5] Create metal-pots-notice.md --- .changeset/metal-pots-notice.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/metal-pots-notice.md diff --git a/.changeset/metal-pots-notice.md b/.changeset/metal-pots-notice.md new file mode 100644 index 0000000000..a7390dae7a --- /dev/null +++ b/.changeset/metal-pots-notice.md @@ -0,0 +1,7 @@ +--- +"@latticexyz/cli": minor +--- + +Added a `--alwaysPostDeploy` flag to deploys (`deploy`, `test`, `dev-contracts` commands) to always run `PostDeploy.s.sol` script after each deploy. By default, `PostDeploy.s.sol` is only run once after a new world is deployed. + +This is helpful if you want to continue a deploy that may not have finished (due to an error or otherwise) or to run deploys with an idempotent `PostDeploy.s.sol` script. From dd22f050654008a3b9afad52ab124441c6a87ab8 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 13 Oct 2023 09:42:11 +0100 Subject: [PATCH 3/5] include alwaysPostDeploy option in dev-contracts --- packages/cli/src/commands/dev-contracts.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/cli/src/commands/dev-contracts.ts b/packages/cli/src/commands/dev-contracts.ts index 6ef7fd6da7..b1e7d65be0 100644 --- a/packages/cli/src/commands/dev-contracts.ts +++ b/packages/cli/src/commands/dev-contracts.ts @@ -15,6 +15,7 @@ import { Address } from "viem"; const devOptions = { rpc: deployOptions.rpc, configPath: deployOptions.configPath, + alwaysPostDeploy: deployOptions.alwaysPostDeploy, }; const commandModule: CommandModule> = { @@ -74,6 +75,7 @@ const commandModule: CommandModule Date: Fri, 13 Oct 2023 12:04:12 +0100 Subject: [PATCH 4/5] alwaysPostDeploy -> alwaysRunPostDeploy --- packages/cli/src/commands/dev-contracts.ts | 2 +- packages/cli/src/runDeploy.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/dev-contracts.ts b/packages/cli/src/commands/dev-contracts.ts index b1e7d65be0..bcd13ddbe3 100644 --- a/packages/cli/src/commands/dev-contracts.ts +++ b/packages/cli/src/commands/dev-contracts.ts @@ -15,7 +15,7 @@ import { Address } from "viem"; const devOptions = { rpc: deployOptions.rpc, configPath: deployOptions.configPath, - alwaysPostDeploy: deployOptions.alwaysPostDeploy, + alwaysRunPostDeploy: deployOptions.alwaysRunPostDeploy, }; const commandModule: CommandModule> = { diff --git a/packages/cli/src/runDeploy.ts b/packages/cli/src/runDeploy.ts index 4f9c1394dc..8bea78fa72 100644 --- a/packages/cli/src/runDeploy.ts +++ b/packages/cli/src/runDeploy.ts @@ -26,7 +26,7 @@ export const deployOptions = { worldAddress: { type: "string", desc: "Deploy to an existing World at the given address" }, srcDir: { type: "string", desc: "Source directory. Defaults to foundry src directory." }, skipBuild: { type: "boolean", desc: "Skip rebuilding the contracts before deploying" }, - alwaysPostDeploy: { + alwaysRunPostDeploy: { type: "boolean", desc: "Always run PostDeploy.s.sol after each deploy (including during upgrades). By default, PostDeploy.s.sol is only run once after a new world is deployed.", }, @@ -88,7 +88,7 @@ in your contracts directory to use the default anvil private key.` client, config: resolvedConfig, }); - if (opts.worldAddress == null || opts.alwaysPostDeploy) { + if (opts.worldAddress == null || opts.alwaysRunPostDeploy) { await postDeploy(config.postDeployScript, worldDeploy.address, rpc, profile); } console.log(chalk.green("Deployment completed in", (Date.now() - startTime) / 1000, "seconds")); From 13cdb4f16c43e633f31c09b214577d268c4243b2 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 13 Oct 2023 04:04:52 -0700 Subject: [PATCH 5/5] Update metal-pots-notice.md --- .changeset/metal-pots-notice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/metal-pots-notice.md b/.changeset/metal-pots-notice.md index a7390dae7a..37e977d7bc 100644 --- a/.changeset/metal-pots-notice.md +++ b/.changeset/metal-pots-notice.md @@ -2,6 +2,6 @@ "@latticexyz/cli": minor --- -Added a `--alwaysPostDeploy` flag to deploys (`deploy`, `test`, `dev-contracts` commands) to always run `PostDeploy.s.sol` script after each deploy. By default, `PostDeploy.s.sol` is only run once after a new world is deployed. +Added a `--alwaysRunPostDeploy` flag to deploys (`deploy`, `test`, `dev-contracts` commands) to always run `PostDeploy.s.sol` script after each deploy. By default, `PostDeploy.s.sol` is only run once after a new world is deployed. This is helpful if you want to continue a deploy that may not have finished (due to an error or otherwise) or to run deploys with an idempotent `PostDeploy.s.sol` script.