hugo-bin-extended 0.89.2 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install hugo-bin-extended --save-dev
13
13
  ### API
14
14
 
15
15
  ```js
16
- const { execFile } = require('child_process');
17
- const hugo = require('hugo-bin-extended');
16
+ import { execFile } from 'node:child_process';
17
+ import hugo from 'hugo-bin';
18
18
 
19
19
  execFile(hugo, ['version'], (error, stdout) => {
20
20
  if (error) {
@@ -54,10 +54,6 @@ npm run create -- post/my-new-post.md
54
54
 
55
55
  See the [Hugo Documentation](https://gohugo.io/) for more information.
56
56
 
57
- ## Supported versions
58
-
59
- See [the package.json commit history](https://github.com/MarlonLuan/hugo-bin-extended/commits/master/package.json).
60
-
61
57
  ## Super Inspired By
62
58
 
63
59
  - [mastilver/apex-bin](https://github.com/mastilver/apex-bin)
package/cli.js CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- 'use strict';
4
-
5
- const { spawn } = require('child_process');
6
- const hugo = require('.');
3
+ import { spawn } from 'node:child_process';
4
+ import process from 'node:process';
5
+ import hugo from './index.js';
7
6
 
8
7
  const input = process.argv.slice(2);
9
8
 
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
- 'use strict';
1
+ import process from 'node:process';
2
+ import lib from './lib/index.js';
2
3
 
3
- module.exports = require('./lib')(process.cwd()).path();
4
+ export default lib(process.cwd()).path();
package/lib/index.js CHANGED
@@ -1,11 +1,13 @@
1
- 'use strict';
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import process from 'node:process';
4
+ import { fileURLToPath } from 'node:url';
5
+ import BinWrapper from 'bin-wrapper';
2
6
 
3
- const path = require('path');
4
- const BinWrapper = require('bin-wrapper');
5
- const { hugoVersion } = require('../package.json');
7
+ const { hugoVersion } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
6
8
 
7
9
  const baseUrl = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/`;
8
- const destDir = path.join(__dirname, '../vendor/');
10
+ const destDir = path.join(fileURLToPath(new URL('../vendor', import.meta.url)));
9
11
  const binName = process.platform === 'win32' ? 'hugo.exe' : 'hugo';
10
12
 
11
13
  const extendedBin = new BinWrapper()
@@ -26,6 +28,8 @@ const extendedBin = new BinWrapper()
26
28
  .dest(destDir)
27
29
  .use(binName);
28
30
 
29
- module.exports = () => {
30
- return extendedBin;
31
- };
31
+ function main() {
32
+ return extendedBin
33
+ }
34
+
35
+ export default main;
package/lib/install.js CHANGED
@@ -1,8 +1,7 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const signale = require('signale');
5
- const bin = require('.');
1
+ import path from 'node:path';
2
+ import process from 'node:process';
3
+ import picocolors from 'picocolors';
4
+ import bin from './index.js';
6
5
 
7
6
  function getProjectRoot() {
8
7
  // `projectRoot` on postinstall could be INIT_CWD introduced in npm >= 5.4
@@ -26,8 +25,8 @@ function getProjectRoot() {
26
25
 
27
26
  bin(getProjectRoot()).run(['version'])
28
27
  .then(() => {
29
- signale.success('Hugo binary installed successfully!');
28
+ console.log(picocolors.green('Hugo binary successfully installed!'));
30
29
  })
31
30
  .catch(error => {
32
- signale.fatal(`${error.message}\nHugo binary installation failed!`);
31
+ console.error(picocolors.red(`${error.message}\nHugo binary installation failed!`));
33
32
  });
package/package.json CHANGED
@@ -1,31 +1,39 @@
1
1
  {
2
2
  "name": "hugo-bin-extended",
3
- "version": "0.89.2",
4
- "hugoVersion": "0.89.2",
3
+ "version": "0.91.0",
4
+ "hugoVersion": "0.91.0",
5
5
  "description": "Binary wrapper for Hugo Extended",
6
- "repository": "MarlonLuan/hugo-bin-extended",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/MarlonLuan/hugo-bin-extended.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/MarlonLuan/hugo-bin-extended/issues"
12
+ },
13
+ "homepage": "https://github.com/MarlonLuan/hugo-bin-extended#readme",
7
14
  "author": "MarlonLuan",
8
15
  "license": "MIT",
9
- "main": "index.js",
16
+ "type": "module",
17
+ "exports": "./index.js",
10
18
  "bin": {
11
19
  "hugo": "cli.js"
12
20
  },
13
21
  "dependencies": {
14
22
  "bin-wrapper": "^4.1.0",
15
- "pkg-conf": "^3.1.0",
16
- "rimraf": "^3.0.2",
17
- "signale": "^1.4.0"
23
+ "picocolors": "^1.0.0",
24
+ "pkg-conf": "^4.0.0",
25
+ "rimraf": "^3.0.2"
18
26
  },
19
27
  "devDependencies": {
20
28
  "bin-check": "^4.1.0",
21
- "eslint": "^8.2.0",
22
- "mocha": "^9.1.3"
29
+ "eslint": "^8.4.1",
30
+ "uvu": "^0.5.2"
23
31
  },
24
32
  "scripts": {
25
33
  "lint": "eslint .",
26
- "mocha": "mocha",
27
- "test": "npm run lint && npm run mocha",
28
- "postinstall": "rimraf vendor && node lib/install"
34
+ "uvu": "uvu test",
35
+ "test": "npm run lint && npm run uvu",
36
+ "postinstall": "rimraf vendor && node lib/install.js"
29
37
  },
30
38
  "files": [
31
39
  "lib/*.js",
@@ -33,23 +41,6 @@
33
41
  "index.js"
34
42
  ],
35
43
  "engines": {
36
- "node": ">=12"
37
- },
38
- "eslintConfig": {
39
- "extends": "eslint:recommended",
40
- "env": {
41
- "es6": true,
42
- "node": true
43
- },
44
- "rules": {
45
- "prefer-destructuring": [
46
- "error",
47
- {
48
- "object": true,
49
- "array": false
50
- }
51
- ],
52
- "strict": "error"
53
- }
44
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
54
45
  }
55
46
  }