create-huenei-frontend 0.1.2 → 0.1.3

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/dist/index.js +22 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24,14 +24,29 @@ function commandExists(cmd) {
24
24
  function installPnpm() {
25
25
  const platform = process.platform;
26
26
  console.log("📦 Installing pnpm...");
27
- if (platform === "win32") {
28
- execSync("corepack enable", { stdio: "inherit" });
29
- execSync("corepack prepare pnpm@latest --activate", { stdio: "inherit" });
30
- return;
27
+ try {
28
+ // 1. Intentar con corepack si existe (Node >=16.13)
29
+ if (commandExists("corepack")) {
30
+ execSync("corepack enable", { stdio: "inherit" });
31
+ execSync("corepack prepare pnpm@latest --activate", {
32
+ stdio: "inherit",
33
+ });
34
+ return;
35
+ }
36
+ // 2. Fallback por sistema operativo
37
+ if (platform === "win32") {
38
+ // Windows sin corepack → PowerShell installer
39
+ execSync('powershell -NoProfile -ExecutionPolicy Bypass -Command "iwr https://get.pnpm.io/install.ps1 -useb | iex"', { stdio: "inherit" });
40
+ return;
41
+ }
42
+ // macOS / Linux → shell script
43
+ execSync("curl -fsSL https://get.pnpm.io/install.sh | sh -", {
44
+ stdio: "inherit",
45
+ });
46
+ }
47
+ catch (err) {
48
+ throw new Error("Failed to install pnpm automatically. Please install it manually from https://pnpm.io/installation");
31
49
  }
32
- execSync("curl -fsSL https://get.pnpm.io/install.sh | sh -", {
33
- stdio: "inherit",
34
- });
35
50
  }
36
51
  async function main() {
37
52
  let targetDir = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-huenei-frontend",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-huenei-frontend": "./bin/create-huenei-frontend.js"