@imksh/create 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imksh/create",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A production-ready create for scaffolding modern applications.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,34 +1,25 @@
1
1
  import { execa } from "execa";
2
- import ora from "ora";
2
+ import { execSync } from "node:child_process";
3
3
 
4
4
  export async function installPackages(targetDir) {
5
- const spinner = ora("Installing dependencies...").start();
5
+ let packageManager = "npm";
6
6
 
7
- try {
8
- let packageManager = "npm";
7
+ const userAgent = process.env.npm_config_user_agent || "";
9
8
 
10
- const userAgent = process.env.npm_config_user_agent || "";
11
-
12
- if (userAgent.startsWith("pnpm")) {
13
- packageManager = "pnpm";
14
- } else if (userAgent.startsWith("yarn")) {
15
- packageManager = "yarn";
16
- }
17
-
18
- await execa(packageManager, ["install"], {
19
- cwd: targetDir,
20
- stdio: "inherit",
21
- env: process.env,
22
- preferLocal: false,
23
- });
24
-
25
- spinner.succeed("Dependencies installed successfully.");
26
- } catch (error) {
27
- spinner.fail("Failed to install dependencies.");
9
+ if (userAgent.startsWith("pnpm")) {
10
+ packageManager = "pnpm";
11
+ } else if (userAgent.startsWith("yarn")) {
12
+ packageManager = "yarn";
13
+ }
28
14
 
29
- console.error("\nInstallation Error:");
30
- console.error(error.shortMessage || error.message);
15
+ // Resolve absolute path to package manager
16
+ const executable = execSync(`which ${packageManager}`)
17
+ .toString()
18
+ .trim();
31
19
 
32
- throw error;
33
- }
20
+ await execa(executable, ["install"], {
21
+ cwd: targetDir,
22
+ stdio: "inherit",
23
+ env: process.env,
24
+ });
34
25
  }