diff --git a/README.md b/README.md index 46cbe76..ee0fbe0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# hugo-extended via NPM [![CI status](https://github.com/jakejarvis/hugo-node/workflows/Run%20tests/badge.svg)](.github/workflows) [![npm](https://img.shields.io/npm/v/hugo-extended?color=red)](https://www.npmjs.com/package/hugo-extended) [![Hugo v0.63.2](https://img.shields.io/badge/Hugo-v0.63.2-orange)](https://github.com/gohugoio/hugo) [![Dependabot](https://api.dependabot.com/badges/status?host=github&repo=jakejarvis/hugo-node)](https://github.com/jakejarvis/hugo-node/pulls?q=is%3Apr+label%3Adependencies) +# Hugo via NPM [![CI status](https://github.com/jakejarvis/hugo-extended/workflows/Run%20tests/badge.svg)](https://github.com/jakejarvis/hugo-extended/actions) [![npm](https://img.shields.io/npm/v/hugo-extended?color=red)](https://www.npmjs.com/package/hugo-extended) [![Hugo v0.63.2](https://img.shields.io/badge/Hugo-v0.63.2-orange)](https://github.com/gohugoio/hugo) [![Dependabot](https://api.dependabot.com/badges/status?host=github&repo=jakejarvis/hugo-extended)](https://github.com/jakejarvis/hugo-extended/pulls?q=is%3Apr+label%3Adependencies) > Plug-and-play binary wrapper for [Hugo Extended](https://gohugo.io/), the awesomest static-site generator. @@ -14,6 +14,36 @@ yarn add hugo-extended --dev ## Usage +See the [Hugo Documentation](https://gohugo.io/documentation/) for additional functionality. + +### package.json + +```json +{ + "scripts": { + "build": "hugo", + "start": "hugo serve", + "create": "hugo new" + } +} +``` + +#### CLI: + +```sh +$(npm bin)/hugo --help +npm run create -- post/my-new-post.md +``` + +or on Windows: + +```bat +for /f "delims=" %F in ('npm bin') do call "%F\hugo" help +npm run create -- post/my-new-post.md +``` + +--- + ### API ```js @@ -29,34 +59,6 @@ execFile(hugo, ['version'], (error, stdout) => { }); ``` -### package.json - -```json -{ - "scripts": { - "build": "hugo", - "start": "hugo serve", - "create": "hugo new" - } -} -``` - -#### CLI - -```sh -$(npm bin)/hugo --help -npm run create -- post/my-new-post.md -``` - -or on Windows: - -```bat -for /f "delims=" %F in ('npm bin') do call "%F\hugo" help -npm run create -- post/my-new-post.md -``` - -See the [Hugo Documentation](https://gohugo.io/documentation/) for additional functionality. - ## Examples - [jakejarvis/jarv.is](https://github.com/jakejarvis/jarv.is) diff --git a/lib/install.js b/lib/install.js index e35fffe..66141a8 100644 --- a/lib/install.js +++ b/lib/install.js @@ -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); }); diff --git a/package.json b/package.json index d0d2559..979d1a8 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.63.2", "hugoVersion": "0.63.2", "description": "Plug-and-play binary wrapper for Hugo Extended, the awesomest static-site generator.", - "homepage": "https://github.com/jakejarvis/hugo-node#readme", + "homepage": "https://github.com/jakejarvis/hugo-extended#readme", "license": "MIT", "author": { "name": "Jake Jarvis", @@ -12,7 +12,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/jakejarvis/hugo-node.git" + "url": "git+https://github.com/jakejarvis/hugo-extended.git" }, "keywords": [ "hugo",