@goodfoot/git-mesh 1.0.77 → 1.0.78

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.
@@ -0,0 +1,6 @@
1
+ @goodfoot/git-mesh placeholder. scripts/postinstall.js replaces this file
2
+ with the native binary for your platform. The name ends in .exe and the
3
+ first line intentionally has NO "#!" shebang so npm/yarn/pnpm cmd-shim
4
+ generates a direct-exec wrapper that runs on Windows; Unix ignores the
5
+ .exe suffix and execs by mode bit. If you are seeing this text, the
6
+ postinstall step did not run.
package/man/git-mesh.1 CHANGED
@@ -1,6 +1,6 @@
1
1
  .ie \n(.g .ds Aq \(aq
2
2
  .el .ds Aq '
3
- .TH git-mesh 1 "git-mesh 1.0.77"
3
+ .TH git-mesh 1 "git-mesh 1.0.78"
4
4
  .ie \n(.g .ds Aq \(aq
5
5
  .el .ds Aq '
6
6
  .SH NAME
@@ -141,7 +141,7 @@ Print this message or the help of the given subcommand(s)
141
141
  .ie \n(.g .ds Aq \(aq
142
142
  .el .ds Aq '
143
143
  .SH VERSION
144
- v1.0.77
144
+ v1.0.78
145
145
  .SH EXAMPLES
146
146
  Anchor a new mesh alongside a code change:
147
147
  .PP
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@goodfoot/git-mesh",
3
- "version": "1.0.77",
4
- "bin": "bin/git-mesh",
3
+ "version": "1.0.78",
4
+ "bin": "bin/git-mesh.exe",
5
5
  "man": [
6
6
  "man/git-mesh.1"
7
7
  ],
@@ -18,16 +18,16 @@
18
18
  "udeps": "bash scripts/cleanup-stale-target.sh && env CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-./target-cache}/udeps\" cargo +nightly udeps"
19
19
  },
20
20
  "files": [
21
- "bin/",
21
+ "bin/git-mesh.exe",
22
22
  "man/",
23
23
  "scripts/postinstall.js"
24
24
  ],
25
25
  "optionalDependencies": {
26
- "@goodfoot/git-mesh-darwin-arm64": "1.0.77",
27
- "@goodfoot/git-mesh-darwin-x64": "1.0.77",
28
- "@goodfoot/git-mesh-linux-arm64": "1.0.77",
29
- "@goodfoot/git-mesh-linux-x64": "1.0.77",
30
- "@goodfoot/git-mesh-win32-x64": "1.0.77"
26
+ "@goodfoot/git-mesh-darwin-arm64": "1.0.78",
27
+ "@goodfoot/git-mesh-darwin-x64": "1.0.78",
28
+ "@goodfoot/git-mesh-linux-arm64": "1.0.78",
29
+ "@goodfoot/git-mesh-linux-x64": "1.0.78",
30
+ "@goodfoot/git-mesh-win32-x64": "1.0.78"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
@@ -99,35 +99,44 @@ function main() {
99
99
  buildFromSource(sourceBinary, sourceBinaryName);
100
100
  }
101
101
 
102
- // Install the native binary at the single `bin` path npm wrapped. The
103
- // committed placeholder has no shebang, so npm/yarn/pnpm generated
104
- // direct-exec wrappers pointing here; replacing it in place makes them run
105
- // the real binary. Extensionless on every platform Windows CreateProcess
106
- // executes a valid PE by explicit path regardless of extension.
107
- const binGitMesh = path.join(__dirname, '..', 'bin', 'git-mesh');
108
-
102
+ // Always write to bin/git-mesh.exe the package.json `bin` field points
103
+ // here on every platform. The `.exe` extension plus a no-shebang stub makes
104
+ // npm's cmd-shim (generated at install time, before this postinstall) emit
105
+ // a direct exec on Windows; Unix executes by mode bit + ELF/Mach-O header
106
+ // and ignores the `.exe` suffix entirely. No resident Node process — the
107
+ // `git-mesh` command execs the native binary directly. Same pattern as
108
+ // Bun's and Claude Code's npm packages.
109
+ const binGitMesh = path.join(__dirname, '..', 'bin', 'git-mesh.exe');
110
+
111
+ // Hardlink first (instant, zero extra disk for the ~16MB binary; src and
112
+ // dest are both under node_modules so same-filesystem is the common case),
113
+ // then fall back to copy across devices / on link-permission errors.
109
114
  try {
110
- fs.unlinkSync(binGitMesh);
111
- } catch (error) {
112
- if (error.code !== 'ENOENT') {
113
- fail(`@goodfoot/git-mesh: Could not remove existing binary at ${binGitMesh}.`, error);
114
- }
115
- }
116
-
117
- // Try symlink first, fall back to copy
118
- try {
119
- fs.symlinkSync(sourceBinary, binGitMesh);
120
- } catch (symlinkError) {
121
- try {
115
+ fs.linkSync(sourceBinary, binGitMesh);
116
+ } catch (linkError) {
117
+ if (linkError.code === 'EEXIST') {
118
+ try {
119
+ fs.unlinkSync(binGitMesh);
120
+ fs.linkSync(sourceBinary, binGitMesh);
121
+ } catch {
122
+ fs.copyFileSync(sourceBinary, binGitMesh);
123
+ }
124
+ } else if (linkError.code === 'EXDEV' || linkError.code === 'EPERM') {
122
125
  fs.copyFileSync(sourceBinary, binGitMesh);
123
- fs.chmodSync(binGitMesh, 0o755);
124
- } catch (copyError) {
125
- fail(
126
- `@goodfoot/git-mesh: Could not install binary from ${sourceBinary} to ${binGitMesh}.`,
127
- new Error(`symlink failed: ${symlinkError.message}\ncopy failed: ${copyError.message}`)
128
- );
126
+ } else {
127
+ try {
128
+ fs.copyFileSync(sourceBinary, binGitMesh);
129
+ } catch (copyError) {
130
+ fail(
131
+ `@goodfoot/git-mesh: Could not install binary from ${sourceBinary} to ${binGitMesh}.`,
132
+ new Error(`link failed: ${linkError.message}\ncopy failed: ${copyError.message}`)
133
+ );
134
+ }
129
135
  }
130
136
  }
137
+ if (process.platform !== 'win32') {
138
+ fs.chmodSync(binGitMesh, 0o755);
139
+ }
131
140
 
132
141
  console.log(`@goodfoot/git-mesh: Installed git-mesh from ${packageName}`);
133
142
  }
package/bin/.gitkeep DELETED
File without changes
package/bin/git-mesh DELETED
@@ -1,5 +0,0 @@
1
- @goodfoot/git-mesh placeholder. This file is replaced by scripts/postinstall.js
2
- with the native binary for your platform. Its first line intentionally has NO
3
- "#!" shebang so npm/yarn/pnpm cmd-shim generates direct-exec .cmd/.ps1/sh
4
- wrappers (no /bin/sh, no node) that run the native binary installed here.
5
- If you are seeing this text executed, the postinstall step did not run.