-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpostinstall.mjs
More file actions
27 lines (23 loc) · 680 Bytes
/
postinstall.mjs
File metadata and controls
27 lines (23 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env zx
const {
CI = 'false',
INIT_CWD = '',
} = process.env;
if (CI !== 'true') {
const {
name: moduleName,
} = JSON.parse(await fs.readFile('./package.json', { encoding: 'utf-8' }));
if (
!INIT_CWD.endsWith(`node_modules/${moduleName}`) &&
INIT_CWD.endsWith(moduleName)
) {
/**
* NOTE: To skip running `simple-git-hooks` in CI environment.
* But `npm x -y -- simple-git-hooks@latest` does not work as expected so splitting it into
* a 2-step process: install without saving as dependency then execute it.
*/
await $`npm i --no-save simple-git-hooks`
await $`simple-git-hooks`;
await $`npm dedupe`;
}
}