create-puzzmo 1.0.4 → 1.0.5
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.
- package/package.json +1 -1
- package/src/index.js +8 -3
package/package.json
CHANGED
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
|
-
|
|
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
|
-
|
|
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
|
})
|