-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Add install command to 'lefthook' npm package (#310)
* feature: Add install script to lefthook NPM package Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com> * fix: Require path in install.js Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com> * fix: Print error too Signed-off-by: Valentin Kiselev <mrexox@evilmartians.com>
- Loading branch information
Showing
12 changed files
with
150 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const path = require("path") | ||
const { spawnSync } = require("child_process") | ||
|
||
function install() { | ||
if (process.env.CI) { | ||
return | ||
} | ||
|
||
const lefthook = path.join(__dirname, "bin", "lefthook") | ||
|
||
spawnSync(lefthook, ["install", "-f"], { | ||
cwd: process.env.INIT_CWD || process.cwd(), | ||
stdio: "inherit", | ||
}) | ||
} | ||
|
||
try { | ||
install() | ||
} catch(e) { | ||
console.warn("'lefthook install' command failed. Try running it manually.\n" + e) | ||
} |
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 |
---|---|---|
|
@@ -15,5 +15,8 @@ | |
], | ||
"cpu": [ | ||
"arm64" | ||
] | ||
], | ||
"scripts": { | ||
"install": "node install.js" | ||
} | ||
} |
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,21 @@ | ||
const path = require("path") | ||
const { spawnSync } = require("child_process") | ||
|
||
function install() { | ||
if (process.env.CI) { | ||
return | ||
} | ||
|
||
const lefthook = path.join(__dirname, "bin", "lefthook") | ||
|
||
spawnSync(lefthook, ["install", "-f"], { | ||
cwd: process.env.INIT_CWD || process.cwd(), | ||
stdio: "inherit", | ||
}) | ||
} | ||
|
||
try { | ||
install() | ||
} catch(e) { | ||
console.warn("'lefthook install' command failed. Try running it manually.\n" + e) | ||
} |
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 |
---|---|---|
|
@@ -15,5 +15,8 @@ | |
], | ||
"cpu": [ | ||
"x64" | ||
] | ||
], | ||
"scripts": { | ||
"install": "node install.js" | ||
} | ||
} |
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,21 @@ | ||
const path = require("path") | ||
const { spawnSync } = require("child_process") | ||
|
||
function install() { | ||
if (process.env.CI) { | ||
return | ||
} | ||
|
||
const lefthook = path.join(__dirname, "bin", "lefthook") | ||
|
||
spawnSync(lefthook, ["install", "-f"], { | ||
cwd: process.env.INIT_CWD || process.cwd(), | ||
stdio: "inherit", | ||
}) | ||
} | ||
|
||
try { | ||
install() | ||
} catch(e) { | ||
console.warn("'lefthook install' command failed. Try running it manually.\n" + e) | ||
} |
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 |
---|---|---|
|
@@ -15,5 +15,8 @@ | |
], | ||
"cpu": [ | ||
"arm64" | ||
] | ||
], | ||
"scripts": { | ||
"install": "node install.js" | ||
} | ||
} |
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,21 @@ | ||
const path = require("path") | ||
const { spawnSync } = require("child_process") | ||
|
||
function install() { | ||
if (process.env.CI) { | ||
return | ||
} | ||
|
||
const lefthook = path.join(__dirname, "bin", "lefthook") | ||
|
||
spawnSync(lefthook, ["install", "-f"], { | ||
cwd: process.env.INIT_CWD || process.cwd(), | ||
stdio: "inherit", | ||
}) | ||
} | ||
|
||
try { | ||
install() | ||
} catch(e) { | ||
console.warn("'lefthook install' command failed. Try running it manually.\n" + e) | ||
} |
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 |
---|---|---|
|
@@ -15,5 +15,8 @@ | |
], | ||
"cpu": [ | ||
"x64" | ||
] | ||
], | ||
"scripts": { | ||
"install": "node install.js" | ||
} | ||
} |
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,21 @@ | ||
const path = require("path") | ||
const { spawnSync } = require("child_process") | ||
|
||
function install() { | ||
if (process.env.CI) { | ||
return | ||
} | ||
|
||
const lefthook = path.join(__dirname, "bin", "lefthook.exe") | ||
|
||
spawnSync(lefthook, ["install", "-f"], { | ||
cwd: process.env.INIT_CWD || process.cwd(), | ||
stdio: "inherit", | ||
}) | ||
} | ||
|
||
try { | ||
install() | ||
} catch(e) { | ||
console.warn("'lefthook install' command failed. Try running it manually.\n" + e) | ||
} |
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 |
---|---|---|
|
@@ -15,5 +15,8 @@ | |
], | ||
"cpu": [ | ||
"arm64" | ||
] | ||
], | ||
"scripts": { | ||
"install": "node install.js" | ||
} | ||
} |
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,21 @@ | ||
const path = require("path") | ||
const { spawnSync } = require("child_process") | ||
|
||
function install() { | ||
if (process.env.CI) { | ||
return | ||
} | ||
|
||
const lefthook = path.join(__dirname, "bin", "lefthook.exe") | ||
|
||
spawnSync(lefthook, ["install", "-f"], { | ||
cwd: process.env.INIT_CWD || process.cwd(), | ||
stdio: "inherit", | ||
}) | ||
} | ||
|
||
try { | ||
install() | ||
} catch(e) { | ||
console.warn("'lefthook install' command failed. Try running it manually.\n" + e) | ||
} |
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 |
---|---|---|
|
@@ -15,5 +15,8 @@ | |
], | ||
"cpu": [ | ||
"x64" | ||
] | ||
], | ||
"scripts": { | ||
"install": "node install.js" | ||
} | ||
} |