Skip to content

Commit

Permalink
Remove npx from postinstall script
Browse files Browse the repository at this point in the history
  • Loading branch information
A.A.Abroskin committed Jul 12, 2019
1 parent 67e70ae commit 8b55d91
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .npm/postinstall.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
require("process");
const { spawn } = require("child_process");
const { join } = require("path");

const isCI = process.env.CI;
if (!isCI) {
process.chdir(process.env.INIT_CWD);

result = spawn("npx", ["lefthook", "install"]);
if (process.platform === 'darwin') {
binary = 'lefthook-mac';
} else if (process.platform === 'linux') {
binary = 'lefthook-linux';
} else if (process.platform === 'win32') {
binary = 'lefthook-win.exe';
} else {
console.log("Unsupported OS");
process.exit(0);
}

result.stdout.on("data", data => {
console.log(`${data}`);
});
binpath = join(process.cwd(), 'node_modules', '@arkweid', 'lefthook', 'bin', binary);

result = spawn(binpath, ["install", "-f"], { stdio: [process.stdin, process.stdout, process.stderr] });
}

0 comments on commit 8b55d91

Please sign in to comment.