From d844cd441c40264ddc90d023e4354adea617febd Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Mon, 16 Oct 2023 20:32:38 +0100 Subject: [PATCH] feat(cli,create-mud): use forge cache (#1777) --- .changeset/slimy-glasses-tickle.md | 8 ++++++++ e2e/packages/contracts/package.json | 4 ++-- examples/minimal/packages/contracts/package.json | 4 ++-- packages/cli/src/runDeploy.ts | 2 +- packages/store/package.json | 4 ++-- packages/world-modules/package.json | 4 ++-- packages/world/package.json | 4 ++-- templates/phaser/packages/contracts/package.json | 4 ++-- templates/react/packages/contracts/package.json | 4 ++-- templates/threejs/packages/contracts/package.json | 4 ++-- templates/vanilla/packages/contracts/package.json | 4 ++-- 11 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 .changeset/slimy-glasses-tickle.md diff --git a/.changeset/slimy-glasses-tickle.md b/.changeset/slimy-glasses-tickle.md new file mode 100644 index 0000000000..afff6974d1 --- /dev/null +++ b/.changeset/slimy-glasses-tickle.md @@ -0,0 +1,8 @@ +--- +"@latticexyz/cli": patch +"create-mud": patch +--- + +Sped up builds by using more of forge's cache. + +Previously we'd build only what we needed because we would check in ABIs and other build artifacts into git, but that meant that we'd get a lot of forge cache misses. Now that we no longer need these files visible, we can take advantage of forge's caching and greatly speed up builds, especially incremental ones. diff --git a/e2e/packages/contracts/package.json b/e2e/packages/contracts/package.json index e2122de6d0..134bc3f29f 100644 --- a/e2e/packages/contracts/package.json +++ b/e2e/packages/contracts/package.json @@ -5,8 +5,8 @@ "license": "MIT", "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts", - "build:abi": "forge build --skip test script", - "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "mud abi-ts", "build:mud": "mud tablegen && mud worldgen", "clean": "pnpm run clean:abi && pnpm run clean:mud", "clean:abi": "forge clean", diff --git a/examples/minimal/packages/contracts/package.json b/examples/minimal/packages/contracts/package.json index 95c7037b70..0ecba50911 100644 --- a/examples/minimal/packages/contracts/package.json +++ b/examples/minimal/packages/contracts/package.json @@ -5,8 +5,8 @@ "license": "MIT", "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts", - "build:abi": "forge clean && forge build --skip test script", - "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "mud abi-ts", "build:mud": "rimraf src/codegen && mud tablegen && mud worldgen", "deploy:local": "pnpm run build && mud deploy", "deploy:testnet": "pnpm run build && mud deploy --profile=lattice-testnet", diff --git a/packages/cli/src/runDeploy.ts b/packages/cli/src/runDeploy.ts index 8bea78fa72..8031ad2684 100644 --- a/packages/cli/src/runDeploy.ts +++ b/packages/cli/src/runDeploy.ts @@ -61,7 +61,7 @@ export async function runDeploy(opts: DeployOptions): Promise { if (!opts.skipBuild) { const outPath = path.join(srcDir, config.codegenDirectory); await tablegen(config, outPath, remappings); - await forge(["build", "--skip", "test", "script"], { profile }); + await forge(["build"], { profile }); await execa("mud", ["abi-ts"], { stdio: "inherit" }); } diff --git a/packages/store/package.json b/packages/store/package.json index 4c2aa30993..8f94898c8b 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -35,8 +35,8 @@ }, "scripts": { "build": "pnpm run build:tightcoder && pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js", - "build:abi": "forge build --skip test script", - "build:abi-ts": "abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "abi-ts", "build:js": "tsup", "build:mud": "tsx ./ts/scripts/tablegen.ts && tsx ./ts/scripts/generate-test-tables.ts", "build:tightcoder": "tsx ./ts/scripts/generate-tightcoder.ts", diff --git a/packages/world-modules/package.json b/packages/world-modules/package.json index 5eca4dbc3d..f3962221a2 100644 --- a/packages/world-modules/package.json +++ b/packages/world-modules/package.json @@ -15,8 +15,8 @@ }, "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js", - "build:abi": "forge build --skip test script", - "build:abi-ts": "abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "abi-ts", "build:js": "tsup", "build:mud": "tsx ./ts/scripts/tablegen.ts && tsx ./ts/scripts/worldgen.ts", "clean": "pnpm run clean:abi && pnpm run clean:js && pnpm run clean:mud", diff --git a/packages/world/package.json b/packages/world/package.json index 071d7b6646..8e636e2e2e 100644 --- a/packages/world/package.json +++ b/packages/world/package.json @@ -31,8 +31,8 @@ }, "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js", - "build:abi": "forge build --skip test script", - "build:abi-ts": "abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "abi-ts", "build:js": "tsup", "build:mud": "tsx ./ts/scripts/tablegen.ts && tsx ./ts/scripts/worldgen.ts && tsx ./ts/scripts/generate-test-tables.ts", "clean": "pnpm run clean:abi && pnpm run clean:js && pnpm run clean:mud", diff --git a/templates/phaser/packages/contracts/package.json b/templates/phaser/packages/contracts/package.json index fc500fe7c6..580cb610f0 100644 --- a/templates/phaser/packages/contracts/package.json +++ b/templates/phaser/packages/contracts/package.json @@ -5,8 +5,8 @@ "license": "MIT", "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts", - "build:abi": "forge clean && forge build --skip test script", - "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "mud abi-ts", "build:mud": "rimraf src/codegen && mud tablegen && mud worldgen", "deploy:local": "pnpm run build && mud deploy", "deploy:testnet": "pnpm run build && mud deploy --profile=lattice-testnet", diff --git a/templates/react/packages/contracts/package.json b/templates/react/packages/contracts/package.json index fc500fe7c6..580cb610f0 100644 --- a/templates/react/packages/contracts/package.json +++ b/templates/react/packages/contracts/package.json @@ -5,8 +5,8 @@ "license": "MIT", "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts", - "build:abi": "forge clean && forge build --skip test script", - "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "mud abi-ts", "build:mud": "rimraf src/codegen && mud tablegen && mud worldgen", "deploy:local": "pnpm run build && mud deploy", "deploy:testnet": "pnpm run build && mud deploy --profile=lattice-testnet", diff --git a/templates/threejs/packages/contracts/package.json b/templates/threejs/packages/contracts/package.json index c3d56ce47e..9cdc68470f 100644 --- a/templates/threejs/packages/contracts/package.json +++ b/templates/threejs/packages/contracts/package.json @@ -5,8 +5,8 @@ "license": "MIT", "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts", - "build:abi": "forge clean && forge build --skip test script", - "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "mud abi-ts", "build:mud": "rimraf src/codegen && mud tablegen && mud worldgen", "deploy:local": "pnpm run build && mud deploy", "deploy:testnet": "pnpm run build && mud deploy --profile=lattice-testnet", diff --git a/templates/vanilla/packages/contracts/package.json b/templates/vanilla/packages/contracts/package.json index fc500fe7c6..580cb610f0 100644 --- a/templates/vanilla/packages/contracts/package.json +++ b/templates/vanilla/packages/contracts/package.json @@ -5,8 +5,8 @@ "license": "MIT", "scripts": { "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts", - "build:abi": "forge clean && forge build --skip test script", - "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'", + "build:abi": "forge build", + "build:abi-ts": "mud abi-ts", "build:mud": "rimraf src/codegen && mud tablegen && mud worldgen", "deploy:local": "pnpm run build && mud deploy", "deploy:testnet": "pnpm run build && mud deploy --profile=lattice-testnet",