Skip to content

Commit

Permalink
build: fix install/build bootstrapping issue with linked libs (#3086)
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Aug 28, 2024
1 parent c0bb0da commit 84c9ef4
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
7 changes: 0 additions & 7 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ runs:
- name: Setup prerequisites
uses: ./.github/actions/setup-prerequisites

# pnpm no longer runs this before the actual install (https://github.com/pnpm/pnpm/issues/3760)
# but we need to create some placeholder files like bins so that the install step can find them and put references to them in the right spot
# this resolves some chicken-and-egg problems with using workspace bins before they're created (install -> build -> install)
- name: Run prepare scripts
shell: bash
run: pnpm recursive run prepare

- name: Install node dependencies
shell: bash
run: pnpm install --frozen-lockfile
Expand Down
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ FROM base AS mud
COPY . /app
WORKDIR /app

# pnpm no longer runs prepare before the actual install (https://github.com/pnpm/pnpm/issues/3760)
# but we need to create some placeholder files like bins so that the install step can find them and put references to them in the right spot
# this resolves some chicken-and-egg problems with using workspace bins before they're created (install -> build -> install)
RUN pnpm recursive run prepare
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN NODE_OPTIONS=--max-old-space-size=4096 pnpm run -r build

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "module",
"scripts": {
"all-build": "for dir in packages/store packages/world packages/world-modules packages/cli test/mock-game-contracts e2e/packages/contracts examples/*/packages/contracts examples/multiple-namespaces templates/*/packages/contracts; do (cd \"$dir\" && pwd && pnpm build); done",
"all-install": "pnpm recursive run prepare && for dir in . docs e2e examples/* templates/*; do (cd \"$dir\" && pwd && pnpm install); done",
"all-install": "for dir in . docs e2e examples/* templates/*; do (cd \"$dir\" && pwd && pnpm install); done",
"bench": "pnpm run --recursive bench",
"build": "turbo run build",
"changelog:generate": "tsx scripts/changelog.ts",
Expand Down
4 changes: 4 additions & 0 deletions packages/abi-ts/bin/abi-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

// workaround for https://github.com/pnpm/pnpm/issues/1801
import "../dist/abi-ts.js";
4 changes: 2 additions & 2 deletions packages/abi-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
}
},
"bin": {
"abi-ts": "./dist/abi-ts.js"
"abi-ts": "./bin/abi-ts.js"
},
"files": [
"bin",
"dist"
],
"scripts": {
"build": "tsup",
"clean": "shx rm -rf dist",
"dev": "tsup --watch",
"prepare": "npx shx mkdir -p ./dist && npx shx touch ./dist/abi-ts.js",
"test": "vitest typecheck --run --passWithNoTests && vitest --run --passWithNoTests",
"test:ci": "pnpm run test"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/bin/mud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

// workaround for https://github.com/pnpm/pnpm/issues/1801
import "../dist/mud.js";
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
}
},
"bin": {
"mud": "./dist/mud.js"
"mud": "./bin/mud.js"
},
"files": [
"bin",
"dist"
],
"scripts": {
Expand All @@ -34,7 +35,6 @@
"clean:test-tables": "shx rm -rf src/codegen",
"dev": "tsup --watch",
"lint": "eslint . --ext .ts",
"prepare": "npx shx mkdir -p ./dist && npx shx touch ./dist/mud.js",
"test": "tsc --noEmit && forge test",
"test:ci": "pnpm run test"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/gas-report/bin/gas-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

// workaround for https://github.com/pnpm/pnpm/issues/1801
import "../dist/gas-report.js";
4 changes: 2 additions & 2 deletions packages/gas-report/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
}
},
"bin": {
"gas-report": "./dist/gas-report.js"
"gas-report": "./bin/gas-report.js"
},
"files": [
"bin",
"dist",
"out",
"src"
Expand All @@ -31,7 +32,6 @@
"build": "tsup",
"clean": "shx rm -rf dist",
"dev": "tsup --watch",
"prepare": "npx shx mkdir -p ./dist && npx shx touch ./dist/gas-report.js",
"test": "vitest typecheck --run --passWithNoTests && vitest --run --passWithNoTests && forge test",
"test:ci": "pnpm run test"
},
Expand Down

0 comments on commit 84c9ef4

Please sign in to comment.