create-puzzmo 1.0.4 → 1.0.6

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/src/index.js +8 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-puzzmo",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Create a Puzzmo game project",
5
5
  "type": "module",
6
6
  "bin": "./src/index.js",
package/src/index.js CHANGED
@@ -5,16 +5,21 @@ import { execSync, spawnSync } from "node:child_process"
5
5
  // Forward all args to `puzzmo game create`
6
6
  const args = process.argv.slice(2)
7
7
 
8
+ // Detect the package manager that invoked this script
9
+ const pm = detectPackageManager()
10
+
8
11
  // Check if puzzmo CLI is available
9
12
  try {
10
13
  execSync("puzzmo --help", { stdio: "ignore" })
11
14
  } catch {
12
15
  console.log("Installing @puzzmo/cli...")
13
- const pm = detectPackageManager()
14
- spawnSync(pm === "yarn" ? "yarn" : pm, ["add", "-g", "@puzzmo/cli"], { stdio: "inherit" })
16
+ spawnSync("npm", ["install", "-g", "@puzzmo/cli"], { stdio: "inherit" })
15
17
  }
16
18
 
17
- const result = spawnSync("puzzmo", ["game", "create", ...args], {
19
+ // Pass --pm so the CLI knows which package manager to use in generated files
20
+ const extraArgs = args.includes("--pm") ? [] : ["--pm", pm]
21
+
22
+ const result = spawnSync("puzzmo", ["game", "create", ...args, ...extraArgs], {
18
23
  stdio: "inherit",
19
24
  env: process.env,
20
25
  })