neutronium 3.3.2 → 3.3.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/cli/index.js +32 -28
- package/package.json +1 -1
package/cli/index.js
CHANGED
|
@@ -243,39 +243,43 @@ switch (command) {
|
|
|
243
243
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
244
244
|
break;
|
|
245
245
|
case 'install':
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const distDir = path.join(process.cwd(), 'dist');
|
|
252
|
-
|
|
253
|
-
if (!fs.existsSync(distDir)) {
|
|
254
|
-
fs.mkdirSync(distDir);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
try {
|
|
258
|
-
execSync(`cd ${distDir} && npm install ${args[0]}`, { stdio: 'inherit' });
|
|
246
|
+
if (!args[0]) {
|
|
247
|
+
console.log('❌ Please specify a package to install');
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
259
250
|
|
|
260
|
-
|
|
261
|
-
const pkgJsonPath = path.join(distDir, 'package.json');
|
|
262
|
-
const pkgLockPath = path.join(distDir, 'package-lock.json');
|
|
251
|
+
const distDir = path.join(process.cwd(), 'dist');
|
|
263
252
|
|
|
264
|
-
if (fs.existsSync(
|
|
265
|
-
fs.
|
|
266
|
-
console.log('🗑️ Removed dist/package.json');
|
|
253
|
+
if (!fs.existsSync(distDir)) {
|
|
254
|
+
fs.mkdirSync(distDir);
|
|
267
255
|
}
|
|
268
256
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
257
|
+
try {
|
|
258
|
+
// Use cwd option instead of cd command
|
|
259
|
+
execSync(`npm install ${args[0]}`, {
|
|
260
|
+
cwd: distDir, // ← This makes npm run in the dist folder
|
|
261
|
+
stdio: 'inherit'
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// Delete package.json and package-lock.json if they exist
|
|
265
|
+
const pkgJsonPath = path.join(distDir, 'package.json');
|
|
266
|
+
const pkgLockPath = path.join(distDir, 'package-lock.json');
|
|
267
|
+
|
|
268
|
+
if (fs.existsSync(pkgJsonPath)) {
|
|
269
|
+
fs.unlinkSync(pkgJsonPath);
|
|
270
|
+
console.log('🗑️ Removed dist/package.json');
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (fs.existsSync(pkgLockPath)) {
|
|
274
|
+
fs.unlinkSync(pkgLockPath);
|
|
275
|
+
console.log('🗑️ Removed dist/package-lock.json');
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
console.log(`✅ Installed ${args[0]} in dist/node_modules`);
|
|
279
|
+
} catch (err) {
|
|
280
|
+
console.error('❌ Installation failed:', err.message);
|
|
272
281
|
}
|
|
273
|
-
|
|
274
|
-
console.log(`✅ Installed ${args[0]} in dist/node_modules`);
|
|
275
|
-
} catch (err) {
|
|
276
|
-
console.error('❌ Installation failed:', err.message);
|
|
277
|
-
}
|
|
278
|
-
break;
|
|
282
|
+
break;
|
|
279
283
|
case "apply-favicon":
|
|
280
284
|
if (!args[0]) {
|
|
281
285
|
console.error('❌ Please provide a URL for favicon');
|