@imksh/create 1.0.3 → 1.0.4

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.3",
3
+ "version": "1.0.4",
4
4
  "description": "A production-ready create for scaffolding modern applications.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,24 +1,34 @@
1
- import { execa } from 'execa';
1
+ import { execa } from "execa";
2
+ import ora from "ora";
2
3
 
3
4
  export async function installPackages(targetDir) {
4
- // Detect package manager based on process.env.npm_config_user_agent
5
- let pm = 'npm';
6
- const userAgent = process.env.npm_config_user_agent;
7
-
8
- if (userAgent) {
9
- if (userAgent.startsWith('yarn')) {
10
- pm = 'yarn';
11
- } else if (userAgent.startsWith('pnpm')) {
12
- pm = 'pnpm';
5
+ const spinner = ora("Installing dependencies...").start();
6
+
7
+ try {
8
+ let packageManager = "npm";
9
+
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";
13
16
  }
14
- }
15
17
 
16
- // Handle mern template differently (it might need install in root, or client/server separately)
17
- // Our mern template will be designed such that 'npm install' at root installs everything
18
- // using workspaces or postinstall scripts.
19
-
20
- await execa(pm, ['install'], {
21
- cwd: targetDir,
22
- stdio: 'ignore'
23
- });
24
- }
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.");
28
+
29
+ console.error("\nInstallation Error:");
30
+ console.error(error.shortMessage || error.message);
31
+
32
+ throw error;
33
+ }
34
+ }