fnva 0.0.16 → 0.0.18
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/bin/fnva.js +14 -2
- package/package.json +1 -1
- package/platforms/fnva +0 -0
- package/platforms/fnva.exe +0 -0
- package/scripts/build-all.sh +7 -1
- package/scripts/build-local.sh +9 -3
- package/scripts/install-shell-integration.js +19 -4
- package/scripts/prepare-publish.sh +30 -0
package/bin/fnva.js
CHANGED
|
@@ -431,7 +431,13 @@ function run() {
|
|
|
431
431
|
});
|
|
432
432
|
|
|
433
433
|
if (result.error) {
|
|
434
|
-
|
|
434
|
+
if (result.error.code === 'EACCES' && process.platform !== 'win32') {
|
|
435
|
+
console.error(`❌ Permission denied. The fnva binary is not executable.`);
|
|
436
|
+
console.error(`💡 To fix this, run: sudo chmod +x "${binaryPath}"`);
|
|
437
|
+
console.error(` Or reinstall: npm install -g fnva --force`);
|
|
438
|
+
} else {
|
|
439
|
+
console.error(`Failed to execute fnva: ${result.error.message}`);
|
|
440
|
+
}
|
|
435
441
|
process.exit(result.status ?? 1);
|
|
436
442
|
}
|
|
437
443
|
|
|
@@ -541,7 +547,13 @@ function run() {
|
|
|
541
547
|
});
|
|
542
548
|
|
|
543
549
|
if (result.error) {
|
|
544
|
-
|
|
550
|
+
if (result.error.code === 'EACCES' && process.platform !== 'win32') {
|
|
551
|
+
console.error(`❌ Permission denied. The fnva binary is not executable.`);
|
|
552
|
+
console.error(`💡 To fix this, run: sudo chmod +x "${binaryPath}"`);
|
|
553
|
+
console.error(` Or reinstall: npm install -g fnva --force`);
|
|
554
|
+
} else {
|
|
555
|
+
console.error(`Failed to execute fnva: ${result.error.message}`);
|
|
556
|
+
}
|
|
545
557
|
process.exit(result.status ?? 1);
|
|
546
558
|
}
|
|
547
559
|
|
package/package.json
CHANGED
package/platforms/fnva
CHANGED
|
Binary file
|
package/platforms/fnva.exe
CHANGED
|
Binary file
|
package/scripts/build-all.sh
CHANGED
|
@@ -67,7 +67,13 @@ build_target() {
|
|
|
67
67
|
if [ -f "$source_binary" ]; then
|
|
68
68
|
cp "$source_binary" "$output_dir/$binary_name"
|
|
69
69
|
echo "✓ 成功构建: $output_dir/$binary_name"
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
# 设置可执行权限(非Windows平台)
|
|
72
|
+
if [[ "$binary_name" != "*.exe" ]]; then
|
|
73
|
+
chmod +x "$output_dir/$binary_name"
|
|
74
|
+
echo "✓ 已设置可执行权限"
|
|
75
|
+
fi
|
|
76
|
+
|
|
71
77
|
# 可选:压缩二进制文件(使用 strip)
|
|
72
78
|
if command -v strip &> /dev/null && [[ "$binary_name" != "*.exe" ]]; then
|
|
73
79
|
strip "$output_dir/$binary_name"
|
package/scripts/build-local.sh
CHANGED
|
@@ -65,14 +65,20 @@ SOURCE_BINARY="$PROJECT_ROOT/target/$TARGET/release/$BINARY_NAME"
|
|
|
65
65
|
if [ -f "$SOURCE_BINARY" ]; then
|
|
66
66
|
cp "$SOURCE_BINARY" "$OUTPUT_DIR/$BINARY_NAME"
|
|
67
67
|
echo "✓ 成功构建: $OUTPUT_DIR/$BINARY_NAME"
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
# 设置可执行权限(仅非Windows平台)
|
|
70
|
+
if [[ "$BINARY_NAME" != "*.exe" ]]; then
|
|
71
|
+
chmod +x "$OUTPUT_DIR/$BINARY_NAME"
|
|
72
|
+
echo "✓ 已设置可执行权限"
|
|
73
|
+
fi
|
|
74
|
+
|
|
69
75
|
# 优化二进制文件大小
|
|
70
76
|
if command -v strip &> /dev/null; then
|
|
71
77
|
strip "$OUTPUT_DIR/$BINARY_NAME"
|
|
72
78
|
echo "✓ 已优化二进制文件大小"
|
|
73
79
|
fi
|
|
74
|
-
|
|
75
|
-
#
|
|
80
|
+
|
|
81
|
+
# 显示文件大小和权限
|
|
76
82
|
ls -lh "$OUTPUT_DIR/$BINARY_NAME"
|
|
77
83
|
else
|
|
78
84
|
echo "✗ 错误: 未找到构建产物: $SOURCE_BINARY"
|
|
@@ -32,15 +32,30 @@ function getPowerShellFunction() {
|
|
|
32
32
|
# fnva 自动化函数 - 由 npm 安装自动添加
|
|
33
33
|
function fnva {
|
|
34
34
|
if ($args.Count -ge 2 -and ($args[0] -eq "java" -or $args[0] -eq "llm" -or $args[0] -eq "cc") -and ($args[1] -eq "use")) {
|
|
35
|
-
$tempFile =
|
|
35
|
+
$tempFile = Join-Path $env:TEMP ("fnva_script_" + (Get-Random) + ".ps1")
|
|
36
36
|
|
|
37
37
|
$env:FNVAAUTOMODE = "1"
|
|
38
38
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
# 捕获 fnva 输出并保存到临时文件
|
|
40
|
+
$output = cmd.exe /c "set FNVA_AUTO_MODE=%FNVAAUTOMODE% && fnva $args" 2>&1
|
|
41
|
+
|
|
42
|
+
# 如果输出包含 PowerShell 脚本内容,保存并执行
|
|
43
|
+
if ($output -match '\$env:' -or $output -match 'Write-Host') {
|
|
44
|
+
$output | Out-File -FilePath $tempFile -Encoding UTF8
|
|
45
|
+
try {
|
|
46
|
+
& $tempFile
|
|
47
|
+
} catch {
|
|
48
|
+
Write-Host "执行脚本时出错: $_" -ForegroundColor Red
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
# 如果不是脚本内容,直接输出
|
|
52
|
+
$output
|
|
53
|
+
}
|
|
41
54
|
} finally {
|
|
42
55
|
$env:FNVAAUTOMODE = ""
|
|
43
|
-
|
|
56
|
+
if (Test-Path $tempFile) {
|
|
57
|
+
Remove-Item $tempFile -ErrorAction SilentlyContinue
|
|
58
|
+
}
|
|
44
59
|
}
|
|
45
60
|
} else {
|
|
46
61
|
$env:FNVAAUTOMODE = "1"
|
|
@@ -37,6 +37,36 @@ else
|
|
|
37
37
|
exit 1
|
|
38
38
|
fi
|
|
39
39
|
|
|
40
|
+
# 本地环境: 验证二进制文件的可执行权限
|
|
41
|
+
echo "验证二进制文件权限..."
|
|
42
|
+
PERMISSION_ERROR_COUNT=0
|
|
43
|
+
for platform_dir in platforms/*/; do
|
|
44
|
+
if [ -d "$platform_dir" ]; then
|
|
45
|
+
BINARY_NAME="fnva"
|
|
46
|
+
if [[ "$platform_dir" == *"win32"* ]]; then
|
|
47
|
+
BINARY_NAME="fnva.exe"
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
BINARY_PATH="$platform_dir/$BINARY_NAME"
|
|
51
|
+
if [ -f "$BINARY_PATH" ]; then
|
|
52
|
+
# 检查是否有可执行权限(非Windows文件)
|
|
53
|
+
if [[ "$BINARY_NAME" != "*.exe" ]] && [ ! -x "$BINARY_PATH" ]; then
|
|
54
|
+
echo "⚠️ 警告: $BINARY_PATH 缺少可执行权限"
|
|
55
|
+
PERMISSION_ERROR_COUNT=$((PERMISSION_ERROR_COUNT + 1))
|
|
56
|
+
else
|
|
57
|
+
echo "✓ $BINARY_PATH 权限正确"
|
|
58
|
+
fi
|
|
59
|
+
fi
|
|
60
|
+
fi
|
|
61
|
+
done
|
|
62
|
+
|
|
63
|
+
if [ $PERMISSION_ERROR_COUNT -gt 0 ]; then
|
|
64
|
+
echo "错误: 发现 $PERMISSION_ERROR_COUNT 个二进制文件缺少可执行权限"
|
|
65
|
+
echo "请运行以下命令修复权限:"
|
|
66
|
+
echo " find platforms -name 'fnva' -type f -exec chmod +x {} \\;"
|
|
67
|
+
exit 1
|
|
68
|
+
fi
|
|
69
|
+
|
|
40
70
|
# 本地环境: 提示用户确认
|
|
41
71
|
read -p "确认发布版本 $VERSION? (y/N) " -n 1 -r
|
|
42
72
|
echo
|