neonblade 0.0.3 → 0.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.
Files changed (2) hide show
  1. package/index.js +29 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -44,12 +44,22 @@ async function main() {
44
44
  fs.mkdirSync(path.dirname(targetPath), { recursive: true })
45
45
  fs.writeFileSync(targetPath, fileRes.data)
46
46
  }
47
+ const packageManager = detectPackageManager(targetAppPath)
47
48
 
48
49
  if (data.dependencies && data.dependencies.length > 0) {
49
- logStep("Installing dependencies...")
50
+ logStep(`Installing dependencies using ${packageManager}...`)
51
+ let installCmd = ""
52
+
53
+ if (packageManager === "pnpm") {
54
+ installCmd = `pnpm add ${data.dependencies.join(" ")}`
55
+ } else if (packageManager === "yarn") {
56
+ installCmd = `yarn add ${data.dependencies.join(" ")}`
57
+ } else if (packageManager === "npm") {
58
+ installCmd = `npm install ${data.dependencies.join(" ")}`
59
+ }
50
60
 
51
61
  execSync(
52
- `pnpm add ${data.dependencies.join(" ")}`,
62
+ installCmd,
53
63
  {
54
64
  stdio: "inherit",
55
65
  cwd: targetAppPath,
@@ -109,4 +119,21 @@ async function fetchComponent(component) {
109
119
  logError(`Component "${component}" not found`)
110
120
  process.exit(1)
111
121
  }
122
+ }
123
+
124
+
125
+ function detectPackageManager(projectPath) {
126
+ if (fs.existsSync(path.join(projectPath, "pnpm-lock.yaml"))) {
127
+ return "pnpm"
128
+ }
129
+
130
+ if (fs.existsSync(path.join(projectPath, "yarn.lock"))) {
131
+ return "yarn"
132
+ }
133
+
134
+ if (fs.existsSync(path.join(projectPath, "package-lock.json"))) {
135
+ return "npm"
136
+ }
137
+
138
+ return "npm" // fallback
112
139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neonblade",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "NeonBlade UI CLI",
5
5
  "bin": {
6
6
  "neonblade": "index.js"