neex 0.7.42 → 0.7.44
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-commands.d.ts","sourceRoot":"","sources":["../../../src/commands/add-commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-commands.d.ts","sourceRoot":"","sources":["../../../src/commands/add-commands.ts"],"names":[],"mappings":"AAKA,wBAAsB,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,iBA6EjF"}
|
|
@@ -7,12 +7,30 @@ exports.addPlugin = addPlugin;
|
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
11
|
async function addPlugin(pluginName, options = {}) {
|
|
11
12
|
const projectPath = options.cwd || process.cwd();
|
|
12
13
|
console.log(chalk_1.default.blue(`📦 Installing ${pluginName}...`));
|
|
13
14
|
try {
|
|
14
|
-
//
|
|
15
|
-
(
|
|
15
|
+
// Check if package.json exists
|
|
16
|
+
const packageJsonPath = path_1.default.join(projectPath, 'package.json');
|
|
17
|
+
if (!fs_1.default.existsSync(packageJsonPath)) {
|
|
18
|
+
throw new Error('package.json not found. Make sure you are in a valid project directory.');
|
|
19
|
+
}
|
|
20
|
+
// Detect package manager and install
|
|
21
|
+
let installCommand = `npm install ${pluginName}`;
|
|
22
|
+
// Check if bun.lock exists (prefer bun)
|
|
23
|
+
if (fs_1.default.existsSync(path_1.default.join(projectPath, 'bun.lock'))) {
|
|
24
|
+
installCommand = `bun add ${pluginName}`;
|
|
25
|
+
}
|
|
26
|
+
else if (fs_1.default.existsSync(path_1.default.join(projectPath, 'pnpm-lock.yaml'))) {
|
|
27
|
+
installCommand = `pnpm add ${pluginName}`;
|
|
28
|
+
}
|
|
29
|
+
else if (fs_1.default.existsSync(path_1.default.join(projectPath, 'yarn.lock'))) {
|
|
30
|
+
installCommand = `yarn add ${pluginName}`;
|
|
31
|
+
}
|
|
32
|
+
console.log(chalk_1.default.dim(`Running: ${installCommand}`));
|
|
33
|
+
(0, child_process_1.execSync)(installCommand, {
|
|
16
34
|
stdio: 'inherit',
|
|
17
35
|
cwd: projectPath
|
|
18
36
|
});
|
|
@@ -52,7 +70,14 @@ async function addPlugin(pluginName, options = {}) {
|
|
|
52
70
|
}
|
|
53
71
|
}
|
|
54
72
|
catch (error) {
|
|
55
|
-
console.error(chalk_1.default.red(`❌ Failed to install ${pluginName}
|
|
73
|
+
console.error(chalk_1.default.red(`❌ Failed to install ${pluginName}`));
|
|
74
|
+
if (error instanceof Error) {
|
|
75
|
+
console.error(chalk_1.default.red(error.message));
|
|
76
|
+
}
|
|
77
|
+
// Try manual installation suggestion
|
|
78
|
+
console.log(chalk_1.default.yellow('💡 Try manual installation:'));
|
|
79
|
+
console.log(chalk_1.default.dim(` bun add ${pluginName}`));
|
|
80
|
+
console.log(chalk_1.default.dim(` # or npm install ${pluginName}`));
|
|
56
81
|
process.exit(1);
|
|
57
82
|
}
|
|
58
83
|
}
|
package/package.json
CHANGED