1
mirror of https://github.com/jakejarvis/hugo-extended.git synced 2025-07-03 13:26:38 -04:00

moved repository from hugo-node to hugo-extended

This commit is contained in:
2020-02-01 18:57:00 -05:00
parent 9b1434b0b2
commit f6b20c2dee
3 changed files with 36 additions and 36 deletions

View File

@ -7,18 +7,16 @@ function getProjectRoot() {
// `projectRoot` on postinstall could be INIT_CWD introduced in npm >= 5.4
// see: https://github.com/npm/npm/issues/16990
const initCwd = process.env.INIT_CWD;
if (initCwd) {
if (initCwd)
return initCwd;
}
// Fallback of getting INIT_CWD
const cwd = process.cwd();
const paths = cwd.split(path.sep);
// If `process.cwd` ends with 'node_modules/*' then get the dependent root directory,
// otherwise return the `cwd` (ordinary it will be the postinstall process of hugo-bin itself).
if (paths.length > 1 && paths[paths.length - 2] === 'node_modules') {
if (paths.length > 1 && paths[paths.length - 2] === 'node_modules')
return path.resolve('../../', cwd);
}
return cwd;
}
@ -28,5 +26,5 @@ bin(getProjectRoot()).run(['version'])
console.log('✔ Hugo installed successfully!');
})
.catch(error => {
console.error(error + '✖ ERROR: Hugo installation failed. :(');
console.error('✖ ERROR: Hugo installation failed. :(\n', error);
});