gitlocker 1.0.0
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/gitlocker.js +45 -0
- package/package.json +29 -0
package/bin/gitlocker.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
function getPlatformPackage() {
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const arch = os.arch();
|
|
10
|
+
|
|
11
|
+
if (platform === 'win32') {
|
|
12
|
+
if (arch === 'x64') {
|
|
13
|
+
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
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.error(`[GitLocker] Unsupported platform: ${platform}.`);
|
|
21
|
+
console.error(`GitLocker npm distribution currently only supports Windows (win32-x64) in this build.`);
|
|
22
|
+
console.error(`For other platforms, please compile GitLocker from source or download from GitHub Releases.`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const packageName = getPlatformPackage();
|
|
28
|
+
|
|
29
|
+
// 获取子包中二进制的绝对路径
|
|
30
|
+
const packageDir = path.dirname(require.resolve(`${packageName}/package.json`));
|
|
31
|
+
const binaryName = 'gitl.exe';
|
|
32
|
+
const binaryPath = path.join(packageDir, binaryName);
|
|
33
|
+
|
|
34
|
+
// 透传执行
|
|
35
|
+
const args = process.argv.slice(2);
|
|
36
|
+
const result = spawnSync(binaryPath, args, {
|
|
37
|
+
stdio: 'inherit',
|
|
38
|
+
windowsHide: true
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
process.exit(result.status ?? 0);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.error('[GitLocker] Failed to run native CLI:', err.message);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gitlocker",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Git repository encryption with pluggable key providers",
|
|
5
|
+
"main": "bin/gitlocker.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"gitlocker": "./bin/gitlocker.js",
|
|
8
|
+
"gitl": "./bin/gitlocker.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=16.0.0"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"git",
|
|
19
|
+
"encryption",
|
|
20
|
+
"security",
|
|
21
|
+
"git-crypt",
|
|
22
|
+
"gitlocker"
|
|
23
|
+
],
|
|
24
|
+
"author": "GitBraints",
|
|
25
|
+
"license": "AGPL-3.0-only",
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"@git-braints/cli-win32-x64": "1.0.0"
|
|
28
|
+
}
|
|
29
|
+
}
|