@imksh/create 1.0.3 → 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.3",
3
+ "version": "1.0.5",
4
4
  "description": "A production-ready create for scaffolding modern applications.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,24 +1,25 @@
1
- import { execa } from 'execa';
1
+ import { execa } from "execa";
2
+ import { execSync } from "node:child_process";
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;
5
+ let packageManager = "npm";
7
6
 
8
- if (userAgent) {
9
- if (userAgent.startsWith('yarn')) {
10
- pm = 'yarn';
11
- } else if (userAgent.startsWith('pnpm')) {
12
- pm = 'pnpm';
13
- }
7
+ const userAgent = process.env.npm_config_user_agent || "";
8
+
9
+ if (userAgent.startsWith("pnpm")) {
10
+ packageManager = "pnpm";
11
+ } else if (userAgent.startsWith("yarn")) {
12
+ packageManager = "yarn";
14
13
  }
15
14
 
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'], {
15
+ // Resolve absolute path to package manager
16
+ const executable = execSync(`which ${packageManager}`)
17
+ .toString()
18
+ .trim();
19
+
20
+ await execa(executable, ["install"], {
21
21
  cwd: targetDir,
22
- stdio: 'ignore'
22
+ stdio: "inherit",
23
+ env: process.env,
23
24
  });
24
- }
25
+ }