diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d69736b..aeb89c1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,8 +19,6 @@ jobs: npm test env: CI: true - - name: Check Hugo version - run: node cli.js env - name: Publish! run: npm publish --access public env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 45fd47e..e03f133 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,5 +22,3 @@ jobs: npm test env: CI: true - - name: Check Hugo version - run: node cli.js env diff --git a/lib/index.js b/lib/index.js index 06dddad..37854b8 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,13 +1,13 @@ 'use strict'; const path = require('path'); -const BinWrapper = require('bin-wrapper'); +const binWrapper = require('bin-wrapper'); const { hugoVersion } = require('../package.json'); const baseUrl = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/`; // Default to extended Hugo, fall back to vanilla Hugo on unsupported platforms -const extendedBin = new BinWrapper() +const extendedBin = new binWrapper() .src(`${baseUrl}hugo_extended_${hugoVersion}_Linux-64bit.tar.gz`, 'linux', 'x64') .src(`${baseUrl}hugo_extended_${hugoVersion}_macOS-64bit.tar.gz`, 'darwin', 'x64') .src(`${baseUrl}hugo_extended_${hugoVersion}_Windows-64bit.zip`, 'win32', 'x64') diff --git a/test/index.js b/test/index.js index f097b57..9ad0c58 100644 --- a/test/index.js +++ b/test/index.js @@ -5,11 +5,18 @@ const assert = require('assert'); const binCheck = require('bin-check'); const hugoBin = require('..'); +const { execFile } = require('child_process'); -describe('hugo-bin', () => { - it('should return path to binary and work', () => { - return binCheck(hugoBin, ['version']).then(works => { - assert(works); - }); +it('Hugo exists and runs?', () => { + return binCheck(hugoBin, ['version']).then(works => { + assert(works); + + // Print additional build environment variables if check successful + if (works) { + execFile(hugoBin, ['env'], (error, stdout) => { + if (error) throw error; + console.log(stdout); + }); + } }); });