Skip to content

Commit

Permalink
Account for GOAMD64 suffix in directory names in NPM and GEM packages…
Browse files Browse the repository at this point in the history
… [ci skip]
  • Loading branch information
Envek committed Jun 7, 2022
1 parent 855ecce commit fa2403e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packaging/npm-bundled/get-exe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packaging/npm-bundled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 3 additions & 1 deletion packaging/rubygems/bin/lefthook
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit fa2403e

Please sign in to comment.