gitlocker 1.0.6 → 1.0.7
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/THIRD_PARTY_NOTICES.md +1 -1
- package/bin/gitlocker.js +45 -45
- package/package.json +4 -4
package/THIRD_PARTY_NOTICES.md
CHANGED
package/bin/gitlocker.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { spawnSync } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
const os = require('os');
|
|
5
6
|
const path = require('path');
|
|
6
7
|
|
|
@@ -11,79 +12,78 @@ function getPlatformPackage() {
|
|
|
11
12
|
if (platform === 'win32') {
|
|
12
13
|
if (arch === 'x64') {
|
|
13
14
|
return '@git-braints/cli-win32-x64';
|
|
14
|
-
} else {
|
|
15
|
-
console.error(`[GitLocker] Unsupported architecture on Windows: ${arch}. GitLocker currently only supports Windows x64.`);
|
|
16
|
-
process.exit(1);
|
|
17
15
|
}
|
|
16
|
+
console.error(`[GitLocker] Unsupported architecture on Windows: ${arch}. GitLocker currently only supports Windows x64.`);
|
|
17
|
+
process.exit(1);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (platform === 'linux') {
|
|
21
21
|
if (arch === 'x64') {
|
|
22
22
|
return '@git-braints/cli-linux-x64';
|
|
23
|
-
} else {
|
|
24
|
-
console.error(`[GitLocker] Unsupported architecture on Linux: ${arch}. GitLocker currently only supports Linux x64.`);
|
|
25
|
-
process.exit(1);
|
|
26
23
|
}
|
|
24
|
+
console.error(`[GitLocker] Unsupported architecture on Linux: ${arch}. GitLocker currently only supports Linux x64.`);
|
|
25
|
+
process.exit(1);
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
if (platform === 'darwin') {
|
|
30
29
|
if (arch === 'arm64') {
|
|
31
30
|
return '@git-braints/cli-darwin-arm64';
|
|
32
|
-
} else {
|
|
33
|
-
console.error(`[GitLocker] Unsupported architecture on macOS: ${arch}. GitLocker currently only supports macOS arm64.`);
|
|
34
|
-
process.exit(1);
|
|
35
31
|
}
|
|
32
|
+
console.error(`[GitLocker] Unsupported architecture on macOS: ${arch}. GitLocker currently only supports macOS arm64.`);
|
|
33
|
+
process.exit(1);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
console.error(`[GitLocker] Unsupported platform: ${platform}.`);
|
|
39
|
-
console.error(
|
|
40
|
-
console.error(
|
|
37
|
+
console.error('GitLocker npm distribution currently only supports Windows (win32-x64), Linux (linux-x64) and macOS (darwin-arm64).');
|
|
38
|
+
console.error('For other platforms, compile GitLocker from source or download GitHub Release archives.');
|
|
41
39
|
process.exit(1);
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
const packageName = getPlatformPackage();
|
|
46
|
-
|
|
47
|
-
// 获取子包中二进制的绝对路径
|
|
48
|
-
let packageDir;
|
|
42
|
+
function resolvePackageDir(packageName) {
|
|
49
43
|
try {
|
|
50
|
-
|
|
44
|
+
return path.dirname(require.resolve(`${packageName}/package.json`));
|
|
51
45
|
} catch (resolveErr) {
|
|
52
46
|
console.error(`[GitLocker] Error: Platform binary package "${packageName}" is not found.`);
|
|
53
|
-
console.error(
|
|
54
|
-
console.error(
|
|
55
|
-
console.error(
|
|
47
|
+
console.error('This may occur if optional dependencies were skipped during installation.');
|
|
48
|
+
console.error('Reinstall with optional dependencies enabled:');
|
|
49
|
+
console.error(' npm install -g gitlocker --include=optional');
|
|
56
50
|
process.exit(1);
|
|
57
51
|
}
|
|
52
|
+
}
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
const packageName = getPlatformPackage();
|
|
55
|
+
const packageDir = resolvePackageDir(packageName);
|
|
56
|
+
const binaryName = os.platform() === 'win32' ? 'gitl.exe' : 'gitl';
|
|
57
|
+
const binaryPath = path.join(packageDir, binaryName);
|
|
62
58
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
if (!fs.existsSync(binaryPath)) {
|
|
60
|
+
console.error(`[GitLocker] Error: Native binary not found at "${binaryPath}".`);
|
|
61
|
+
console.error('The platform package installed, but gitl was missing from it.');
|
|
62
|
+
console.error('On Windows, Windows Defender may quarantine gitl.exe after npm extract.');
|
|
63
|
+
console.error('Restore the file from quarantine, or reinstall:');
|
|
64
|
+
console.error(' npm uninstall -g gitlocker && npm install -g gitlocker@latest');
|
|
65
|
+
console.error('You can also run the signed GitHub Release archive for your platform.');
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// 忽略可能的权限变更失败
|
|
75
|
-
}
|
|
69
|
+
if (os.platform() !== 'win32') {
|
|
70
|
+
try {
|
|
71
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
72
|
+
} catch (chmodErr) {
|
|
73
|
+
// The publish step already marks the Unix binary executable.
|
|
76
74
|
}
|
|
75
|
+
}
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
console.error(
|
|
77
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
78
|
+
stdio: 'inherit'
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (result.error) {
|
|
82
|
+
console.error(`[GitLocker] Failed to start "${binaryPath}": ${result.error.message}`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
if (result.signal) {
|
|
86
|
+
console.error(`[GitLocker] Native CLI terminated by signal ${result.signal}.`);
|
|
88
87
|
process.exit(1);
|
|
89
88
|
}
|
|
89
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gitlocker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Git repository encryption with pluggable key providers for Windows, Linux, and macOS",
|
|
5
5
|
"homepage": "https://gitbraints.com/products/gitlocker",
|
|
6
6
|
"repository": {
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"author": "GitBraints",
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"optionalDependencies": {
|
|
46
|
-
"@git-braints/cli-darwin-arm64": "1.0.
|
|
47
|
-
"@git-braints/cli-linux-x64": "1.0.
|
|
48
|
-
"@git-braints/cli-win32-x64": "1.0.
|
|
46
|
+
"@git-braints/cli-darwin-arm64": "1.0.7",
|
|
47
|
+
"@git-braints/cli-linux-x64": "1.0.7",
|
|
48
|
+
"@git-braints/cli-win32-x64": "1.0.7"
|
|
49
49
|
}
|
|
50
50
|
}
|