Skip to content

Commit

Permalink
feat(cli): remove forge clean from deploy (#1759)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Oct 13, 2023
1 parent 6ca1874 commit e667ee8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-carrots-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/cli": minor
---

CLI `deploy`, `test`, `dev-contracts` no longer run `forge clean` before each deploy. We previously cleaned to ensure no outdated artifacts were checked into git (ABIs, typechain types, etc.). Now that all artifacts are gitignored, we can let forge use its cache again.
1 change: 0 additions & 1 deletion packages/cli/src/commands/dev-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const commandModule: CommandModule<typeof devOptions, InferredOptionTypes<typeof
const deploy = await runDeploy({
configPath,
rpc,
clean: true,
skipBuild: false,
printConfig: false,
profile: undefined,
Expand Down
11 changes: 1 addition & 10 deletions packages/cli/src/runDeploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from "node:path";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { InferredOptionTypes, Options } from "yargs";
import { deploy } from "./deploy/deploy";
import { createWalletClient, http, Hex } from "viem";
Expand All @@ -19,11 +19,6 @@ import { tablegen } from "@latticexyz/store/codegen";

export const deployOptions = {
configPath: { type: "string", desc: "Path to the config file" },
clean: {
type: "boolean",
desc: "Remove the build forge artifacts and cache directories before building",
default: false,
},
printConfig: { type: "boolean", desc: "Print the resolved config" },
profile: { type: "string", desc: "The foundry profile to use" },
saveDeployment: { type: "boolean", desc: "Save the deployment info to a file", default: true },
Expand Down Expand Up @@ -58,10 +53,6 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
)
);

if (opts.clean) {
await forge(["clean"], { profile });
}

// Run forge build
if (!opts.skipBuild) {
const outPath = path.join(srcDir, config.codegenDirectory);
Expand Down

0 comments on commit e667ee8

Please sign in to comment.