hugo-bin-extended 0.100.2 → 0.104.3
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 +45 -1
- package/lib/index.js +20 -17
- package/lib/install.js +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
npm install hugo-bin-extended --save-dev
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
For usage within corporate networks or behind corporate proxies, the download repository can be overwritten, see [Installation options](#installation-options) for more details.
|
|
12
|
+
|
|
11
13
|
## Usage
|
|
12
14
|
|
|
13
15
|
### API
|
|
14
16
|
|
|
15
17
|
```js
|
|
16
18
|
import { execFile } from 'node:child_process';
|
|
17
|
-
import hugo from 'hugo-bin';
|
|
19
|
+
import hugo from 'hugo-bin-extended';
|
|
18
20
|
|
|
19
21
|
execFile(hugo, ['version'], (error, stdout) => {
|
|
20
22
|
if (error) {
|
|
@@ -54,6 +56,48 @@ npm run create -- post/my-new-post.md
|
|
|
54
56
|
|
|
55
57
|
See the [Hugo Documentation](https://gohugo.io/) for more information.
|
|
56
58
|
|
|
59
|
+
## Installation options
|
|
60
|
+
|
|
61
|
+
hugo-bin-extended supports options to change the variation of Hugo binaries and to overwrite the download repository.
|
|
62
|
+
|
|
63
|
+
Each option can be configured in the `hugo-bin-extended` section of your `package.json`:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"name": "your-package",
|
|
68
|
+
"version": "0.0.1",
|
|
69
|
+
"hugo-bin-extended": {
|
|
70
|
+
"downloadRepo" : "https://some.example.com/artifactory/github-releases"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Also as local or global [.npmrc](https://docs.npmjs.com/files/npmrc) configuration file:
|
|
76
|
+
|
|
77
|
+
```ini
|
|
78
|
+
hugo_bin_extended_download_repo = "https://some.example.com/artifactory/github-releases"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Also as an environment variable:
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
export HUGO_BIN_EXTENDED_DOWNLOAD_REPO="https://some.example.com/artifactory/github-releases"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Note that you have to run `npm install hugo-bin-extended` to re-install hugo-bin-extended itself, if you change any of these options.**
|
|
88
|
+
|
|
89
|
+
### Options
|
|
90
|
+
|
|
91
|
+
#### downloadRepo
|
|
92
|
+
|
|
93
|
+
Default: `"https://github.com"`
|
|
94
|
+
|
|
95
|
+
Set it to your corporate proxy url to download the hugo binary from a different download repository.
|
|
96
|
+
|
|
97
|
+
## Supported versions
|
|
98
|
+
|
|
99
|
+
See [the package.json commit history](MarlonLuan/hugo-bin-extended/commits/main/package.json).
|
|
100
|
+
|
|
57
101
|
## Super Inspired By
|
|
58
102
|
|
|
59
103
|
- [mastilver/apex-bin](https://github.com/mastilver/apex-bin)
|
package/lib/index.js
CHANGED
|
@@ -3,33 +3,36 @@ import path from 'node:path';
|
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import BinWrapper from 'bin-wrapper';
|
|
6
|
+
import { packageConfigSync } from 'pkg-conf';
|
|
6
7
|
|
|
7
8
|
const { hugoVersion } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
|
|
8
9
|
|
|
9
|
-
const baseUrl = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/`;
|
|
10
10
|
const destDir = path.join(fileURLToPath(new URL('../vendor', import.meta.url)));
|
|
11
11
|
const binName = process.platform === 'win32' ? 'hugo.exe' : 'hugo';
|
|
12
12
|
|
|
13
|
-
const extendedBin = new BinWrapper()
|
|
14
|
-
.src(`${
|
|
15
|
-
.src(`${
|
|
16
|
-
.src(`${
|
|
17
|
-
.src(`${
|
|
13
|
+
const extendedBin = (baseDownloadUrl) => new BinWrapper()
|
|
14
|
+
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'arm64')
|
|
15
|
+
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_darwin-universal.tar.gz`, 'darwin', 'x64')
|
|
16
|
+
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_linux-amd64.tar.gz`, 'linux', 'x64')
|
|
17
|
+
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_linux-arm64.tar.gz`, 'linux', 'arm64')
|
|
18
|
+
.src(`${baseDownloadUrl}hugo_extended_${hugoVersion}_windows-amd64.zip`, 'win32', 'x64')
|
|
18
19
|
// Fall back to the normal version on unsupported platforms
|
|
19
|
-
.src(`${
|
|
20
|
-
.src(`${
|
|
21
|
-
.src(`${
|
|
22
|
-
.src(`${
|
|
23
|
-
.src(`${
|
|
24
|
-
.src(`${
|
|
25
|
-
.src(`${baseUrl}hugo_${hugoVersion}_Windows-32bit.zip`, 'win32', 'x86')
|
|
26
|
-
.src(`${baseUrl}hugo_${hugoVersion}_Windows-ARM.zip`, 'win32', 'arm')
|
|
27
|
-
.src(`${baseUrl}hugo_${hugoVersion}_Windows-ARM64.zip`, 'win32', 'arm64')
|
|
20
|
+
.src(`${baseDownloadUrl}hugo_${hugoVersion}_dragonfly-amd64.tar.gz`, 'dragonflybsd', 'x64')
|
|
21
|
+
.src(`${baseDownloadUrl}hugo_${hugoVersion}_freebsd-amd64.tar.gz`, 'freebsd', 'x64')
|
|
22
|
+
.src(`${baseDownloadUrl}hugo_${hugoVersion}_linux-arm.tar.gz`, 'linux', 'arm')
|
|
23
|
+
.src(`${baseDownloadUrl}hugo_${hugoVersion}_netbsd-amd64.tar.gz`, 'netbsd', 'x64')
|
|
24
|
+
.src(`${baseDownloadUrl}hugo_${hugoVersion}_openbsd-amd64.tar.gz`, 'openbsd', 'x64')
|
|
25
|
+
.src(`${baseDownloadUrl}hugo_${hugoVersion}_windows-arm64.zip`, 'win32', 'arm64')
|
|
28
26
|
.dest(destDir)
|
|
29
27
|
.use(binName);
|
|
30
28
|
|
|
31
|
-
function main() {
|
|
32
|
-
|
|
29
|
+
function main(projectRoot) {
|
|
30
|
+
const config = packageConfigSync('hugo-bin-extended', { cwd: projectRoot });
|
|
31
|
+
const downloadRepo = (process.env.HUGO_BIN_EXTENDED_DOWNLOAD_REPO || process.env.npm_config_hugo_bin_extended_download_repo || config.downloadRepo || 'https://github.com');
|
|
32
|
+
|
|
33
|
+
const baseDownloadUrl = `${downloadRepo}/gohugoio/hugo/releases/download/v${hugoVersion}/`;
|
|
34
|
+
|
|
35
|
+
return extendedBin(baseDownloadUrl);
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
export default main;
|
package/lib/install.js
CHANGED
|
@@ -15,7 +15,7 @@ function getProjectRoot() {
|
|
|
15
15
|
const cwd = process.cwd();
|
|
16
16
|
const paths = cwd.split(path.sep);
|
|
17
17
|
// If `process.cwd` ends with 'node_modules/*' then get the dependent root directory,
|
|
18
|
-
// otherwise return the `cwd` (ordinary it will be the postinstall process of hugo-bin itself).
|
|
18
|
+
// otherwise return the `cwd` (ordinary it will be the postinstall process of hugo-bin-extended itself).
|
|
19
19
|
if (paths.length > 1 && paths[paths.length - 2] === 'node_modules') {
|
|
20
20
|
return path.resolve('../../', cwd);
|
|
21
21
|
}
|
|
@@ -25,8 +25,8 @@ function getProjectRoot() {
|
|
|
25
25
|
|
|
26
26
|
bin(getProjectRoot()).run(['version'])
|
|
27
27
|
.then(() => {
|
|
28
|
-
console.log(picocolors.green('Hugo binary successfully installed!'));
|
|
28
|
+
console.log(picocolors.green('Hugo binary extended successfully installed!'));
|
|
29
29
|
})
|
|
30
30
|
.catch(error => {
|
|
31
|
-
console.error(picocolors.red(`${error.message}\nHugo binary installation failed!`));
|
|
31
|
+
console.error(picocolors.red(`${error.message}\nHugo binary extended installation failed!`));
|
|
32
32
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hugo-bin-extended",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"hugoVersion": "0.
|
|
3
|
+
"version": "0.104.3",
|
|
4
|
+
"hugoVersion": "0.104.3",
|
|
5
5
|
"description": "Binary wrapper for Hugo Extended",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"bin-check": "^4.1.0",
|
|
29
|
-
"eslint": "^8.
|
|
30
|
-
"uvu": "^0.5.
|
|
29
|
+
"eslint": "^8.24.0",
|
|
30
|
+
"uvu": "^0.5.6"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"lint": "eslint .",
|