@goodfoot/git-mesh 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/.gitkeep +0 -0
- package/package.json +29 -0
- package/scripts/postinstall.js +76 -0
package/bin/.gitkeep
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@goodfoot/git-mesh",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"bin": "bin/git-mesh",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"postinstall": "node scripts/postinstall.js",
|
|
7
|
+
"build": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/build cargo build --release",
|
|
8
|
+
"build:local": "mkdir -p \"$HOME/.local/bin\" && env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/build cargo build --release && install -m 0755 target/build/release/git-mesh \"$HOME/.local/bin/git-mesh\"",
|
|
9
|
+
"build:clean": "rm -rf target/build target/lint target/test target/typecheck && env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/build cargo build --release",
|
|
10
|
+
"test": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/test cargo test --quiet -- --test-threads=1",
|
|
11
|
+
"lint": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/lint cargo clippy --quiet -- -D warnings",
|
|
12
|
+
"typecheck": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/typecheck cargo check --quiet"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"bin/",
|
|
16
|
+
"scripts/postinstall.js"
|
|
17
|
+
],
|
|
18
|
+
"optionalDependencies": {
|
|
19
|
+
"@goodfoot/git-mesh-darwin-arm64": "1.0.0",
|
|
20
|
+
"@goodfoot/git-mesh-darwin-x64": "1.0.0",
|
|
21
|
+
"@goodfoot/git-mesh-linux-arm64": "1.0.0",
|
|
22
|
+
"@goodfoot/git-mesh-linux-x64": "1.0.0",
|
|
23
|
+
"@goodfoot/git-mesh-win32-x64": "1.0.0"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/goodfoot-io/git-mesh.git"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const PLATFORM_MAP = {
|
|
7
|
+
linux: 'linux',
|
|
8
|
+
darwin: 'darwin',
|
|
9
|
+
win32: 'win32'
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const ARCH_MAP = {
|
|
13
|
+
x64: 'x64',
|
|
14
|
+
arm64: 'arm64'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function fail(message, error) {
|
|
18
|
+
console.error(message);
|
|
19
|
+
if (error) {
|
|
20
|
+
console.error(error.message);
|
|
21
|
+
}
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main() {
|
|
26
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
27
|
+
const arch = ARCH_MAP[process.arch];
|
|
28
|
+
|
|
29
|
+
if (!platform || !arch) {
|
|
30
|
+
fail(`@goodfoot/git-mesh: No prebuilt binary available for ${process.platform}-${process.arch}.`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const packageName = `@goodfoot/git-mesh-${platform}-${arch}`;
|
|
34
|
+
const sourceBinaryName = process.platform === 'win32' ? 'git-mesh.exe' : 'git-mesh';
|
|
35
|
+
|
|
36
|
+
let packageDir;
|
|
37
|
+
try {
|
|
38
|
+
packageDir = path.dirname(require.resolve(`${packageName}/package.json`));
|
|
39
|
+
} catch (error) {
|
|
40
|
+
fail(`@goodfoot/git-mesh: Required platform package ${packageName} not found.`, error);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const sourceBinary = path.join(packageDir, 'bin', sourceBinaryName);
|
|
44
|
+
if (!fs.existsSync(sourceBinary)) {
|
|
45
|
+
fail(`@goodfoot/git-mesh: Binary not found in ${packageName}. The package may not have been published correctly.`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const binGitMesh = path.join(__dirname, '..', 'bin', 'git-mesh');
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
fs.unlinkSync(binGitMesh);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
if (error.code !== 'ENOENT') {
|
|
54
|
+
fail(`@goodfoot/git-mesh: Could not remove existing binary at ${binGitMesh}.`, error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Try symlink first, fall back to copy
|
|
59
|
+
try {
|
|
60
|
+
fs.symlinkSync(sourceBinary, binGitMesh);
|
|
61
|
+
} catch (symlinkError) {
|
|
62
|
+
try {
|
|
63
|
+
fs.copyFileSync(sourceBinary, binGitMesh);
|
|
64
|
+
fs.chmodSync(binGitMesh, 0o755);
|
|
65
|
+
} catch (copyError) {
|
|
66
|
+
fail(
|
|
67
|
+
`@goodfoot/git-mesh: Could not install binary from ${sourceBinary} to ${binGitMesh}.`,
|
|
68
|
+
new Error(`symlink failed: ${symlinkError.message}\ncopy failed: ${copyError.message}`)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.log(`@goodfoot/git-mesh: Installed git-mesh from ${packageName}`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
main();
|