fnva 0.0.28 → 0.0.29
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/platforms/fnva +0 -0
- package/platforms/fnva.exe +0 -0
- package/scripts/install-shell-integration.js +31 -32
package/package.json
CHANGED
package/platforms/fnva
CHANGED
|
Binary file
|
package/platforms/fnva.exe
CHANGED
|
Binary file
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// Shell integration installer for fnva (npm postinstall helper).
|
|
4
|
-
// Generates a
|
|
5
|
-
// `fnva` binary and applies environment switch scripts.
|
|
4
|
+
// Generates a minimal shell function that invokes the real fnva binary.
|
|
6
5
|
|
|
7
6
|
const fs = require('fs');
|
|
8
7
|
const path = require('path');
|
|
@@ -64,13 +63,28 @@ function fnva {
|
|
|
64
63
|
`;
|
|
65
64
|
}
|
|
66
65
|
|
|
66
|
+
function resolveBinaryPath() {
|
|
67
|
+
// Prefer real binary, avoid this function name
|
|
68
|
+
if (process.platform === 'win32') {
|
|
69
|
+
return process.argv[0];
|
|
70
|
+
}
|
|
71
|
+
let bin = '';
|
|
72
|
+
try {
|
|
73
|
+
const which = require('child_process').spawnSync('which', ['fnva'], { encoding: 'utf8' });
|
|
74
|
+
if (which.status === 0) {
|
|
75
|
+
bin = (which.stdout || '').trim();
|
|
76
|
+
}
|
|
77
|
+
} catch {}
|
|
78
|
+
return bin;
|
|
79
|
+
}
|
|
80
|
+
|
|
67
81
|
function getBashFunction() {
|
|
68
82
|
return `
|
|
69
83
|
# fnva auto integration (added by npm install)
|
|
70
84
|
fnva() {
|
|
71
85
|
local __fnva_bin
|
|
72
86
|
__fnva_bin="$(command -v fnva | head -n 1)"
|
|
73
|
-
if [[ -z "$__fnva_bin" ]]; then
|
|
87
|
+
if [[ -z "$__fnva_bin" || ! -x "$__fnva_bin" ]]; then
|
|
74
88
|
echo "fnva: binary not found in PATH" >&2
|
|
75
89
|
return 127
|
|
76
90
|
fi
|
|
@@ -140,13 +154,13 @@ function installShellIntegration() {
|
|
|
140
154
|
const configPath = getShellConfigPath(shell);
|
|
141
155
|
|
|
142
156
|
if (!configPath) {
|
|
143
|
-
console.log(
|
|
157
|
+
console.log(`Unsupported shell: ${shell}`);
|
|
144
158
|
console.log('Please configure fnva manually (see README).');
|
|
145
159
|
return false;
|
|
146
160
|
}
|
|
147
161
|
|
|
148
162
|
if (isFunctionInstalled(configPath)) {
|
|
149
|
-
console.log(
|
|
163
|
+
console.log(`fnva shell integration already present: ${configPath}`);
|
|
150
164
|
return true;
|
|
151
165
|
}
|
|
152
166
|
|
|
@@ -165,25 +179,11 @@ function installShellIntegration() {
|
|
|
165
179
|
fs.writeFileSync(configPath, functionCode);
|
|
166
180
|
}
|
|
167
181
|
|
|
168
|
-
console.log(
|
|
169
|
-
console.log('
|
|
170
|
-
switch (shell) {
|
|
171
|
-
case 'powershell':
|
|
172
|
-
console.log(' . $PROFILE');
|
|
173
|
-
break;
|
|
174
|
-
case 'bash':
|
|
175
|
-
console.log(' source ~/.bashrc');
|
|
176
|
-
break;
|
|
177
|
-
case 'zsh':
|
|
178
|
-
console.log(' source ~/.zshrc');
|
|
179
|
-
break;
|
|
180
|
-
case 'fish':
|
|
181
|
-
console.log(' source ~/.config/fish/config.fish');
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
182
|
+
console.log(`fnva shell integration installed at: ${configPath}`);
|
|
183
|
+
console.log('Reload your shell config after install.');
|
|
184
184
|
return true;
|
|
185
185
|
} catch (error) {
|
|
186
|
-
console.log(
|
|
186
|
+
console.log(`Install failed: ${error.message}`);
|
|
187
187
|
console.log('Please configure fnva manually (see README).');
|
|
188
188
|
return false;
|
|
189
189
|
}
|
|
@@ -191,13 +191,13 @@ function installShellIntegration() {
|
|
|
191
191
|
|
|
192
192
|
function promptInstallation() {
|
|
193
193
|
if (process.env.FNVA_SKIP_SHELL_SETUP === '1') {
|
|
194
|
-
console.log('
|
|
194
|
+
console.log('Skipping shell integration (FNVA_SKIP_SHELL_SETUP=1)');
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
const shell = detectShell();
|
|
199
|
-
console.log(
|
|
200
|
-
console.log('
|
|
199
|
+
console.log(`Detected shell: ${shell}`);
|
|
200
|
+
console.log('Install fnva shell integration? (y/N)');
|
|
201
201
|
|
|
202
202
|
const readline = require('readline');
|
|
203
203
|
const rl = readline.createInterface({
|
|
@@ -210,21 +210,20 @@ function promptInstallation() {
|
|
|
210
210
|
if (normalized === 'y' || normalized === 'yes') {
|
|
211
211
|
installShellIntegration();
|
|
212
212
|
} else {
|
|
213
|
-
console.log('
|
|
213
|
+
console.log('Skipped shell integration.');
|
|
214
214
|
}
|
|
215
215
|
rl.close();
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
function main() {
|
|
220
|
-
console.log('
|
|
221
|
-
console.log(
|
|
222
|
-
console.log(
|
|
220
|
+
console.log('fnva shell integration installer');
|
|
221
|
+
console.log(`Node.js version: ${process.version}`);
|
|
222
|
+
console.log(`CWD: ${process.cwd()}`);
|
|
223
223
|
|
|
224
224
|
if (process.argv.includes('--auto') || process.argv.includes('--yes')) {
|
|
225
|
-
console.log('🤖 Auto mode: installing...');
|
|
226
225
|
const result = installShellIntegration();
|
|
227
|
-
console.log(
|
|
226
|
+
console.log(`Install result: ${result ? 'success' : 'failed'}`);
|
|
228
227
|
} else {
|
|
229
228
|
promptInstallation();
|
|
230
229
|
}
|
|
@@ -240,4 +239,4 @@ module.exports = {
|
|
|
240
239
|
getShellFunction,
|
|
241
240
|
isFunctionInstalled,
|
|
242
241
|
installShellIntegration,
|
|
243
|
-
};
|
|
242
|
+
};
|