hugo-bin-extended 0.134.2 → 0.135.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 +5 -4
- package/index.js +2 -2
- package/lib/index.js +46 -17
- package/lib/install.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Binary wrapper for [Hugo](https://github.com/gohugoio/hugo)
|
|
4
4
|
|
|
5
|
-
- hugo-bin supports the [Extended Hugo version](https://github.com/gohugoio/hugo/releases/tag/v0.43)
|
|
5
|
+
- hugo-bin-extended supports the [Extended Hugo version](https://github.com/gohugoio/hugo/releases/tag/v0.43)
|
|
6
6
|
- For usage within corporate networks or behind corporate proxies, the download repository can be overwritten
|
|
7
7
|
|
|
8
8
|
See [Installation options](#installation-options) for more details.
|
|
@@ -63,6 +63,9 @@ See the [Hugo Documentation](https://gohugo.io/) for more information.
|
|
|
63
63
|
|
|
64
64
|
## Installation options
|
|
65
65
|
|
|
66
|
+
> [!NOTE]
|
|
67
|
+
> You have to run `npm install hugo-bin-extended` to reinstall `hugo-bin-extended` itself if you change any of these options.
|
|
68
|
+
|
|
66
69
|
hugo-bin-extended supports options to change the variation of Hugo binaries, to overwrite the download repository and the Hugo version.
|
|
67
70
|
|
|
68
71
|
Each option can be configured in one of the following ways:
|
|
@@ -103,8 +106,6 @@ set HUGO_BIN_DOWNLOAD_REPO=https://some.example.com/artifactory/github-releases
|
|
|
103
106
|
set HUGO_BIN_HUGO_VERSION=0.124.1
|
|
104
107
|
```
|
|
105
108
|
|
|
106
|
-
**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.**
|
|
107
|
-
|
|
108
109
|
### Options
|
|
109
110
|
|
|
110
111
|
#### buildTags
|
|
@@ -129,7 +130,7 @@ Set it to your proxy URL to download the hugo binary from a different download r
|
|
|
129
130
|
- Default: the version specified in [package.json](package.json)
|
|
130
131
|
|
|
131
132
|
You can override the Hugo version here. Please note that if any of the URLs have changed upstream, you might not be able to use
|
|
132
|
-
any version and you will probably need to update to a newer hugo-bin version which takes into consideration the new URLs.
|
|
133
|
+
any version and you will probably need to update to a newer hugo-bin-extended version which takes into consideration the new URLs.
|
|
133
134
|
|
|
134
135
|
## Super Inspired By
|
|
135
136
|
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
|
-
import
|
|
2
|
+
import hugoBinExtended from './lib/index.js';
|
|
3
3
|
|
|
4
|
-
const bin = await
|
|
4
|
+
const bin = await hugoBinExtended(process.cwd());
|
|
5
5
|
const hugoPath = bin.path();
|
|
6
6
|
|
|
7
7
|
export default hugoPath;
|
package/lib/index.js
CHANGED
|
@@ -2,43 +2,54 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { debuglog } from 'node:util';
|
|
5
6
|
import BinWrapper from '@xhmikosr/bin-wrapper';
|
|
6
7
|
import { packageConfig } from 'package-config';
|
|
7
8
|
|
|
9
|
+
const debug = debuglog('hugo-bin-extended');
|
|
8
10
|
const pkg = new URL('../package.json', import.meta.url);
|
|
9
11
|
const { hugoVersion: HUGO_VERSION } = JSON.parse(await fs.readFile(pkg, 'utf8'));
|
|
10
12
|
|
|
11
13
|
const destDir = path.join(fileURLToPath(new URL('../vendor/', import.meta.url)));
|
|
12
14
|
const binName = process.platform === 'win32' ? 'hugo.exe' : 'hugo';
|
|
13
15
|
|
|
16
|
+
debug('[global] HUGO_VERSION:', HUGO_VERSION);
|
|
17
|
+
debug('[global] destDir:', destDir);
|
|
18
|
+
debug('[global] binName:', binName);
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* @param {string} baseUrl
|
|
16
22
|
* @param {string} hugoVersion
|
|
17
23
|
*/
|
|
18
24
|
function extendedBin(baseUrl, hugoVersion) {
|
|
25
|
+
debug('[extendedBin] baseUrl:', baseUrl);
|
|
26
|
+
debug('[extendedBin] hugoVersion:', hugoVersion);
|
|
27
|
+
|
|
28
|
+
const baseName = `hugo_${hugoVersion}`;
|
|
29
|
+
const baseNameExtended = `hugo_extended_${hugoVersion}`;
|
|
30
|
+
|
|
19
31
|
return new BinWrapper()
|
|
20
|
-
.src(`${baseUrl}
|
|
21
|
-
.src(`${baseUrl}
|
|
22
|
-
.src(`${baseUrl}
|
|
23
|
-
.src(`${baseUrl}
|
|
24
|
-
.src(`${baseUrl}
|
|
32
|
+
.src(`${baseUrl}${baseNameExtended}_darwin-universal.tar.gz`, 'darwin', 'arm64')
|
|
33
|
+
.src(`${baseUrl}${baseNameExtended}_darwin-universal.tar.gz`, 'darwin', 'x64')
|
|
34
|
+
.src(`${baseUrl}${baseNameExtended}_linux-amd64.tar.gz`, 'linux', 'x64')
|
|
35
|
+
.src(`${baseUrl}${baseNameExtended}_linux-arm64.tar.gz`, 'linux', 'arm64')
|
|
36
|
+
.src(`${baseUrl}${baseNameExtended}_windows-amd64.zip`, 'win32', 'x64')
|
|
25
37
|
// Fall back to the normal version on unsupported platforms
|
|
26
|
-
.src(`${baseUrl}
|
|
27
|
-
.src(`${baseUrl}
|
|
28
|
-
.src(`${baseUrl}
|
|
29
|
-
.src(`${baseUrl}
|
|
30
|
-
.src(`${baseUrl}
|
|
31
|
-
.src(`${baseUrl}
|
|
32
|
-
.src(`${baseUrl}
|
|
38
|
+
.src(`${baseUrl}${baseName}_dragonfly-amd64.tar.gz`, 'dragonflybsd', 'x64')
|
|
39
|
+
.src(`${baseUrl}${baseName}_freebsd-amd64.tar.gz`, 'freebsd', 'x64')
|
|
40
|
+
.src(`${baseUrl}${baseName}_linux-arm.tar.gz`, 'linux', 'arm')
|
|
41
|
+
.src(`${baseUrl}${baseName}_netbsd-amd64.tar.gz`, 'netbsd', 'x64')
|
|
42
|
+
.src(`${baseUrl}${baseName}_openbsd-amd64.tar.gz`, 'openbsd', 'x64')
|
|
43
|
+
.src(`${baseUrl}${baseName}_solaris-amd64.tar.gz`, 'openbsd', 'x64')
|
|
44
|
+
.src(`${baseUrl}${baseName}_windows-arm64.zip`, 'win32', 'arm64')
|
|
33
45
|
.dest(destDir)
|
|
34
46
|
.use(binName);
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
/**
|
|
38
|
-
* @param {
|
|
50
|
+
* @param {import('pkg-conf').Config} config
|
|
39
51
|
*/
|
|
40
|
-
|
|
41
|
-
const config = await packageConfig('hugo-bin-extended', { cwd });
|
|
52
|
+
function getOptions(config) {
|
|
42
53
|
const hugoVersion = [
|
|
43
54
|
process.env.HUGO_BIN_HUGO_VERSION,
|
|
44
55
|
process.env.npm_config_hugo_bin_hugo_version,
|
|
@@ -52,9 +63,27 @@ async function main(cwd) {
|
|
|
52
63
|
|
|
53
64
|
// Strip any leading `v` from hugoVersion because otherwise we'll end up with duplicate `v`s
|
|
54
65
|
const version = hugoVersion[0] === 'v' ? hugoVersion.slice(1) : hugoVersion;
|
|
55
|
-
const baseUrl = `${downloadRepo}/gohugoio/hugo/releases/download/v${version}/`;
|
|
56
66
|
|
|
57
|
-
|
|
67
|
+
debug('[getOptions] hugoVersion:', version);
|
|
68
|
+
debug('[getOptions] downloadRepo:', downloadRepo);
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
hugoVersion: version,
|
|
72
|
+
downloadRepo
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param {string} cwd
|
|
78
|
+
*/
|
|
79
|
+
async function main(cwd) {
|
|
80
|
+
const config = await packageConfig('hugo-bin-extended', { cwd });
|
|
81
|
+
const { hugoVersion, downloadRepo } = getOptions(config);
|
|
82
|
+
const baseUrl = `${downloadRepo}/gohugoio/hugo/releases/download/v${hugoVersion}/`;
|
|
83
|
+
|
|
84
|
+
debug('[main] baseUrl:', baseUrl);
|
|
85
|
+
|
|
86
|
+
return extendedBin(baseUrl, hugoVersion);
|
|
58
87
|
}
|
|
59
88
|
|
|
60
89
|
export default main;
|
package/lib/install.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rm } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import
|
|
4
|
+
import hugoBinExtended from './index.js';
|
|
5
5
|
|
|
6
6
|
function getProjectRoot() {
|
|
7
7
|
// `projectRoot` on postinstall could be INIT_CWD introduced in npm >= 5.4
|
|
@@ -29,7 +29,7 @@ async function main() {
|
|
|
29
29
|
|
|
30
30
|
await rm(vendorDir, { force: true, recursive: true });
|
|
31
31
|
|
|
32
|
-
const bin = await
|
|
32
|
+
const bin = await hugoBinExtended(projectRoot);
|
|
33
33
|
|
|
34
34
|
try {
|
|
35
35
|
await bin.run(['version']);
|