create-catalyst-app-internal 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/cli.cjs +19 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-catalyst-app-internal",
3
3
  "bin": "scripts/cli.cjs",
4
- "version": "0.1.8",
4
+ "version": "0.1.9",
5
5
  "description": "cli package to scaffold Catalyst application",
6
6
  "dependencies": {
7
7
  "commander": "^8.2.0",
package/scripts/cli.cjs CHANGED
@@ -249,15 +249,29 @@ program
249
249
  program.parse(process.argv)
250
250
 
251
251
  function runMcpSetup(mcpDir, cwd = process.cwd()) {
252
+ const pkgPath = path.join(mcpDir, "package.json")
253
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
254
+ pkg.dependencies["better-sqlite3"] = "^12.8.0"
255
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2))
256
+
252
257
  const mcpNodeModules = path.join(mcpDir, "node_modules")
253
- if (!fs.existsSync(mcpNodeModules)) {
254
- const pkgPath = path.join(mcpDir, "package.json")
255
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
256
- pkg.dependencies["better-sqlite3"] = "^12.8.0"
257
- fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2))
258
+ let needsInstall = !fs.existsSync(mcpNodeModules)
259
+
260
+ if (!needsInstall) {
261
+ try {
262
+ execSync(`node -e "require('better-sqlite3')"`, { cwd: mcpDir, stdio: "pipe" })
263
+ } catch {
264
+ console.log(cyan("Detected incompatible better-sqlite3 build. Reinstalling..."))
265
+ fs.rmSync(mcpNodeModules, { recursive: true, force: true })
266
+ needsInstall = true
267
+ }
268
+ }
269
+
270
+ if (needsInstall) {
258
271
  console.log(cyan("Installing mcp_v2 dependencies..."))
259
272
  execSync("npm install", { cwd: mcpDir, stdio: "inherit" })
260
273
  }
274
+
261
275
  execSync(`node ${path.join(mcpDir, "setup.js")}`, { cwd, stdio: "inherit" })
262
276
  }
263
277