Version: 1.0.01.1.01.2.01.2.11.3.01.3.11.3.51.4.01.5.01.5.11.5.21.5.31.5.41.5.51.5.61.5.71.5.81.5.91.5.101.5.111.5.121.5.131.5.141.5.151.5.161.5.171.5.181.5.192.0.0-rc.02.1.0-rc.02.1.0-rc.12.1.02.1.12.1.22.1.32.1.42.2.02.2.12.2.22.2.32.2.42.2.52.3.02.4.02.4.12.5.02.6.02.6.12.7.0-rc.02.7.02.7.1-rc.02.7.12.7.2-rc.02.7.2-rc.12.7.22.7.3-rc.02.7.3-rc.12.7.3-rc.22.7.32.8.02.8.12.8.2-rc.02.8.22.8.32.8.4-rc.02.8.43.0.0-rc.03.0.0-rc.13.0.0-rc.23.0.0-rc.33.0.0-rc.43.0.0-rc.53.0.0-rc.63.0.0-rc.73.0.03.0.1-rc.03.0.1-rc.13.0.13.0.2-rc.03.0.2-rc.13.0.2-rc.23.0.23.0.3-rc.03.0.33.0.4-rc.03.0.43.0.5-rc.03.0.5-rc.13.0.5-rc.23.0.53.0.6-rc.03.0.6
#!/usr/bin/env zx
const {
CI = 'false',
INIT_CWD = '',
} = process.env;
if (CI !== 'true') {
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`;
}