@botwallet/agent-cli 0.1.0-beta.4 → 0.1.0-beta.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 +1 -1
- package/scripts/install.js +29 -1
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -157,7 +157,35 @@ async function install() {
|
|
|
157
157
|
fs.rmSync(tmpDir, { recursive: true });
|
|
158
158
|
|
|
159
159
|
console.log('Botwallet CLI installed successfully!');
|
|
160
|
-
|
|
160
|
+
|
|
161
|
+
try {
|
|
162
|
+
const npmPrefix = execSync('npm prefix -g', { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
163
|
+
const isWindows = process.platform === 'win32';
|
|
164
|
+
const npmBinDir = isWindows ? npmPrefix : path.join(npmPrefix, 'bin');
|
|
165
|
+
|
|
166
|
+
const normalize = (p) => path.resolve(p).replace(/[\\/]+$/, '');
|
|
167
|
+
const caseSensitive = !isWindows;
|
|
168
|
+
const npmBinNorm = normalize(npmBinDir);
|
|
169
|
+
|
|
170
|
+
const pathDirs = (process.env.PATH || '').split(path.delimiter);
|
|
171
|
+
const inPath = pathDirs.some(d => {
|
|
172
|
+
const norm = normalize(d);
|
|
173
|
+
return caseSensitive ? norm === npmBinNorm : norm.toLowerCase() === npmBinNorm.toLowerCase();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (!inPath) {
|
|
177
|
+
const fullCmd = isWindows ? path.join(npmBinDir, 'botwallet.cmd') : path.join(npmBinDir, 'botwallet');
|
|
178
|
+
console.log('');
|
|
179
|
+
console.log(`NOTE: npm global bin directory is not in your PATH.`);
|
|
180
|
+
console.log(`If "botwallet" is not recognized as a command, use the full path:`);
|
|
181
|
+
console.log(` ${fullCmd}`);
|
|
182
|
+
console.log(`To fix permanently, add to your PATH: ${npmBinDir}`);
|
|
183
|
+
} else {
|
|
184
|
+
console.log('Run "botwallet --help" to get started.');
|
|
185
|
+
}
|
|
186
|
+
} catch {
|
|
187
|
+
console.log('Run "botwallet --help" to get started.');
|
|
188
|
+
}
|
|
161
189
|
|
|
162
190
|
} catch (error) {
|
|
163
191
|
console.error('Installation failed:', error.message);
|