-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split NPM package to two: bundled and installer (#273)
Bundled NPM package was here before, installer was implemented in #188
- Loading branch information
Showing
21 changed files
with
150 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env node | ||
|
||
var spawn = require('child_process').spawn; | ||
const { getExePath } = require('../get-exe'); | ||
|
||
var command_args = process.argv.slice(2); | ||
|
||
var child = spawn( | ||
getExePath(), | ||
command_args, | ||
{ stdio: "inherit" }); | ||
|
||
child.on('close', function (code) { | ||
if (code !== 0) { | ||
process.exit(1); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const path = require("path") | ||
|
||
function getExePath() { | ||
// Detect OS | ||
// https://nodejs.org/api/process.html#process_process_platform | ||
let goOS = process.platform; | ||
let extension = ''; | ||
if (['win32', 'cygwin'].includes(process.platform)) { | ||
goOS = 'windows'; | ||
extension = '.exe'; | ||
} | ||
|
||
// Detect architecture | ||
// https://nodejs.org/api/process.html#process_process_arch | ||
let goArch = process.arch; | ||
switch (process.arch) { | ||
case 'x64': { | ||
goArch = 'amd64'; | ||
break; | ||
} | ||
case 'x32': | ||
case 'ia32': { | ||
goArch = '386'; | ||
break; | ||
} | ||
} | ||
|
||
const dir = path.join(__dirname, 'bin'); | ||
const executable = path.join( | ||
dir, | ||
`lefthook_${goOS}_${goArch}`, | ||
`lefthook${extension}` | ||
); | ||
return executable; | ||
} | ||
exports.getExePath = getExePath; |
Oops, something went wrong.