neex 0.7.42 → 0.7.43
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,iBAgEjF"}
|
|
@@ -7,14 +7,21 @@ 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
|
+
// 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
|
+
// Install the plugin with better error handling
|
|
15
21
|
(0, child_process_1.execSync)(`npm install ${pluginName}`, {
|
|
16
|
-
stdio: '
|
|
17
|
-
cwd: projectPath
|
|
22
|
+
stdio: 'pipe',
|
|
23
|
+
cwd: projectPath,
|
|
24
|
+
encoding: 'utf8'
|
|
18
25
|
});
|
|
19
26
|
// Handle specific plugins
|
|
20
27
|
if (pluginName === 'neex-admin') {
|
|
@@ -52,7 +59,13 @@ async function addPlugin(pluginName, options = {}) {
|
|
|
52
59
|
}
|
|
53
60
|
}
|
|
54
61
|
catch (error) {
|
|
55
|
-
console.error(chalk_1.default.red(`❌ Failed to install ${pluginName}
|
|
62
|
+
console.error(chalk_1.default.red(`❌ Failed to install ${pluginName}`));
|
|
63
|
+
if (error instanceof Error) {
|
|
64
|
+
console.error(chalk_1.default.red(error.message));
|
|
65
|
+
}
|
|
66
|
+
// Try manual installation suggestion
|
|
67
|
+
console.log(chalk_1.default.yellow('💡 Try manual installation:'));
|
|
68
|
+
console.log(chalk_1.default.dim(` npm install ${pluginName}`));
|
|
56
69
|
process.exit(1);
|
|
57
70
|
}
|
|
58
71
|
}
|
package/package.json
CHANGED