Skip to content

Commit 9fca254

Browse files
justin808claude
andcommitted
Add postinstall script to build shakapacker from GitHub branch
When installing shakapacker from a GitHub branch, the TypeScript source needs to be compiled. Added a postinstall script that: 1. Detects if shakapacker was installed from source (has .ts but no .js files) 2. Installs shakapacker's dev dependencies 3. Runs the build script to compile TypeScript to JavaScript This ensures the package is properly built even when installed directly from GitHub instead of npm. Also updated shakapacker reference to use explicit github: prefix for clarity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent a810cca commit 9fca254

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"homepage": "https://github.com/shakacode/react-webpack-rails-tutorial",
1919
"scripts": {
20-
"postinstall": "patch-package",
20+
"postinstall": "patch-package && if [ -f node_modules/shakapacker/package/index.ts ] && [ ! -f node_modules/shakapacker/package/index.js ]; then cd node_modules/shakapacker && yarn install --production=false && yarn build; fi",
2121
"res:clean": "rescript clean",
2222
"res:format": "rescript format -all",
2323
"res:dev": "yarn res:clean && rescript build -w",
@@ -92,7 +92,7 @@
9292
"sass": "^1.58.3",
9393
"sass-loader": "^13.3.2",
9494
"sass-resources-loader": "^2.2.5",
95-
"shakapacker": "shakacode/shakapacker#justin808/early-hints",
95+
"shakapacker": "github:shakacode/shakapacker#justin808/early-hints",
9696
"stimulus": "^3.0.1",
9797
"style-loader": "^3.3.1",
9898
"swc-loader": "^0.2.6",

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9135,7 +9135,7 @@ [email protected]:
91359135
resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz"
91369136
integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==
91379137

9138-
shakapacker@shakacode/shakapacker#justin808/early-hints:
9138+
"shakapacker@github:shakacode/shakapacker#justin808/early-hints":
91399139
version "9.3.0-beta.2"
91409140
resolved "https://codeload.github.com/shakacode/shakapacker/tar.gz/6bf6bf5c21388a402362c516370606529d6cfecd"
91419141
dependencies:

0 commit comments

Comments
 (0)