From fa2403ec9424b78c2699b60b6444b80d59aae6af Mon Sep 17 00:00:00 2001 From: Andrey Novikov Date: Tue, 7 Jun 2022 21:19:20 +0300 Subject: [PATCH] Account for GOAMD64 suffix in directory names in NPM and GEM packages [ci skip] --- packaging/npm-bundled/get-exe.js | 4 +++- packaging/npm-bundled/package.json | 2 +- packaging/rubygems/bin/lefthook | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packaging/npm-bundled/get-exe.js b/packaging/npm-bundled/get-exe.js index 217578ba..a3a8de0a 100644 --- a/packaging/npm-bundled/get-exe.js +++ b/packaging/npm-bundled/get-exe.js @@ -13,9 +13,11 @@ function getExePath() { // Detect architecture // https://nodejs.org/api/process.html#process_process_arch let goArch = process.arch; + let suffix = ''; switch (process.arch) { case 'x64': { goArch = 'amd64'; + suffix = '_v1'; // GOAMD64 break; } case 'x32': @@ -28,7 +30,7 @@ function getExePath() { const dir = path.join(__dirname, 'bin'); const executable = path.join( dir, - `lefthook_${goOS}_${goArch}`, + `lefthook_${goOS}_${goArch}${suffix}`, `lefthook${extension}` ); return executable; diff --git a/packaging/npm-bundled/package.json b/packaging/npm-bundled/package.json index 617b833c..67d8d8b7 100644 --- a/packaging/npm-bundled/package.json +++ b/packaging/npm-bundled/package.json @@ -29,7 +29,7 @@ "ia32" ], "scripts": { - "version": "git clean -fd bin/ && (cd ../../dist/ && find . -executable -type f -exec cp --parents \\{\\} ../packaging/npm-bundled/bin/ \\;) && cp -f ../../README.md ./", + "version": "git clean -fdX bin/ && (cd ../../dist/ && find . -maxdepth 2 -executable -type f -exec cp --parents \\{\\} ../packaging/npm-bundled/bin/ \\;) && cp -f ../../README.md ./", "postinstall": "node postinstall.js" } } diff --git a/packaging/rubygems/bin/lefthook b/packaging/rubygems/bin/lefthook index c9fba64f..47647d67 100755 --- a/packaging/rubygems/bin/lefthook +++ b/packaging/rubygems/bin/lefthook @@ -20,7 +20,9 @@ os = else raise "Unknown OS: #{platform.os}" end -binary = "lefthook_#{os}_#{arch}/lefthook" +suffix = arch == "amd64" ? "_v1" : "" # GOAMD64 + +binary = "lefthook_#{os}_#{arch}#{suffix}/lefthook" binary = "#{binary}.exe" if os == "windows" args = $*.map { |x| x.include?(' ') ? "'" + x + "'" : x }