hugo-extended 0.160.1 → 0.161.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/dist/cli.mjs +1 -3
- package/dist/generated/types.mjs +1 -1
- package/dist/hugo.mjs +14 -5
- package/dist/lib/args.mjs +1 -3
- package/dist/lib/env.mjs +51 -2
- package/dist/lib/install.mjs +1 -3
- package/dist/lib/utils.mjs +10 -3
- package/package.json +11 -11
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import hugo_default from "./hugo.mjs";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
|
|
5
4
|
//#region src/cli.ts
|
|
6
5
|
process.on("unhandledRejection", (reason) => {
|
|
7
6
|
console.error("Unhandled promise rejection:", reason);
|
|
@@ -23,6 +22,5 @@ process.on("unhandledRejection", (reason) => {
|
|
|
23
22
|
process.exitCode = 1;
|
|
24
23
|
}
|
|
25
24
|
})();
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
|
-
export {
|
|
26
|
+
export {};
|
package/dist/generated/types.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
package/dist/hugo.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { ENV_VAR_DOCS, getEnvConfig } from "./lib/env.mjs";
|
|
|
3
3
|
import { doesBinExist, getBinPath, logger } from "./lib/utils.mjs";
|
|
4
4
|
import install from "./lib/install.mjs";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
|
-
|
|
7
6
|
//#region src/hugo.ts
|
|
8
7
|
/**
|
|
9
8
|
* Gets the path to the Hugo binary, automatically installing it if it's missing.
|
|
@@ -183,25 +182,33 @@ async function execWithOutput(command, positionalArgsOrOptions, options) {
|
|
|
183
182
|
* ```
|
|
184
183
|
*/
|
|
185
184
|
const hugo = {
|
|
185
|
+
/** Build your site */
|
|
186
186
|
build: (options) => exec("build", options),
|
|
187
|
+
/** Generate shell completion scripts */
|
|
187
188
|
completion: {
|
|
188
189
|
bash: (options) => exec("completion bash", options),
|
|
189
190
|
fish: (options) => exec("completion fish", options),
|
|
190
191
|
powershell: (options) => exec("completion powershell", options),
|
|
191
192
|
zsh: (options) => exec("completion zsh", options)
|
|
192
193
|
},
|
|
194
|
+
/** Print Hugo configuration */
|
|
193
195
|
config: (options) => exec("config", options),
|
|
196
|
+
/** Convert content to different formats */
|
|
194
197
|
convert: {
|
|
195
198
|
toJSON: (options) => exec("convert toJSON", options),
|
|
196
199
|
toTOML: (options) => exec("convert toTOML", options),
|
|
197
200
|
toYAML: (options) => exec("convert toYAML", options)
|
|
198
201
|
},
|
|
202
|
+
/** Print Hugo environment info */
|
|
199
203
|
env: (options) => exec("env", options),
|
|
204
|
+
/** Generate documentation */
|
|
200
205
|
gen: {
|
|
201
206
|
doc: (options) => exec("gen doc", options),
|
|
202
207
|
man: (options) => exec("gen man", options)
|
|
203
208
|
},
|
|
209
|
+
/** Import your site from others */
|
|
204
210
|
import: { jekyll: (options) => exec("import jekyll", options) },
|
|
211
|
+
/** List various types of content */
|
|
205
212
|
list: {
|
|
206
213
|
all: (options) => exec("list all", options),
|
|
207
214
|
drafts: (options) => exec("list drafts", options),
|
|
@@ -209,6 +216,7 @@ const hugo = {
|
|
|
209
216
|
future: (options) => exec("list future", options),
|
|
210
217
|
published: (options) => exec("list published", options)
|
|
211
218
|
},
|
|
219
|
+
/** Module operations */
|
|
212
220
|
mod: {
|
|
213
221
|
clean: (options) => exec("mod clean", options),
|
|
214
222
|
get: (options) => exec("mod get", options),
|
|
@@ -219,6 +227,7 @@ const hugo = {
|
|
|
219
227
|
vendor: (options) => exec("mod vendor", options),
|
|
220
228
|
verify: (options) => exec("mod verify", options)
|
|
221
229
|
},
|
|
230
|
+
/** Create new content */
|
|
222
231
|
new: Object.assign((pathOrOptions, options) => {
|
|
223
232
|
if (typeof pathOrOptions === "string") return exec("new", [pathOrOptions], options);
|
|
224
233
|
return exec("new", pathOrOptions);
|
|
@@ -236,11 +245,11 @@ const hugo = {
|
|
|
236
245
|
return exec("new theme", nameOrOptions);
|
|
237
246
|
}
|
|
238
247
|
}),
|
|
248
|
+
/** Start the Hugo development server */
|
|
239
249
|
server: (options) => exec("server", options),
|
|
250
|
+
/** Print the Hugo version */
|
|
240
251
|
version: (options) => exec("version", options)
|
|
241
252
|
};
|
|
242
|
-
|
|
243
|
-
var hugo_default = Object.assign(hugoCompat, hugo);
|
|
244
|
-
|
|
253
|
+
var hugo_default = Object.assign(getHugoBinary, hugo);
|
|
245
254
|
//#endregion
|
|
246
|
-
export { ENV_VAR_DOCS, hugo_default as default, exec, execWithOutput, getEnvConfig, getHugoBinary, hugo };
|
|
255
|
+
export { ENV_VAR_DOCS, hugo_default as default, exec, execWithOutput, getEnvConfig, getHugoBinary, hugo };
|
package/dist/lib/args.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
4
|
//#region src/lib/args.ts
|
|
6
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
6
|
let cachedSpec = null;
|
|
@@ -121,6 +120,5 @@ function inferKind(value) {
|
|
|
121
120
|
}
|
|
122
121
|
return "string";
|
|
123
122
|
}
|
|
124
|
-
|
|
125
123
|
//#endregion
|
|
126
|
-
export { buildArgs };
|
|
124
|
+
export { buildArgs };
|
package/dist/lib/env.mjs
CHANGED
|
@@ -42,6 +42,15 @@ function getFirstDefined(names) {
|
|
|
42
42
|
* All supported environment variable configurations.
|
|
43
43
|
*/
|
|
44
44
|
const ENV_VARS = {
|
|
45
|
+
/**
|
|
46
|
+
* Override the Hugo version to install.
|
|
47
|
+
* When set, ignores the version from package.json.
|
|
48
|
+
*
|
|
49
|
+
* Intentionally not aliased to HUGO_VERSION to avoid confusion and
|
|
50
|
+
* conflicts with Netlify, etc.
|
|
51
|
+
*
|
|
52
|
+
* @example HUGO_OVERRIDE_VERSION=0.139.0 npm install hugo-extended
|
|
53
|
+
*/
|
|
45
54
|
overrideVersion: {
|
|
46
55
|
name: "HUGO_OVERRIDE_VERSION",
|
|
47
56
|
aliases: [],
|
|
@@ -49,6 +58,12 @@ const ENV_VARS = {
|
|
|
49
58
|
parse: parseVersion,
|
|
50
59
|
defaultValue: void 0
|
|
51
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* Force installation of vanilla Hugo instead of Extended.
|
|
63
|
+
* Useful when SCSS/SASS features aren't needed or to reduce binary size.
|
|
64
|
+
*
|
|
65
|
+
* @example HUGO_NO_EXTENDED=1 npm install hugo-extended
|
|
66
|
+
*/
|
|
52
67
|
forceStandard: {
|
|
53
68
|
name: "HUGO_NO_EXTENDED",
|
|
54
69
|
aliases: ["HUGO_FORCE_STANDARD"],
|
|
@@ -56,6 +71,13 @@ const ENV_VARS = {
|
|
|
56
71
|
parse: parseBoolean,
|
|
57
72
|
defaultValue: false
|
|
58
73
|
},
|
|
74
|
+
/**
|
|
75
|
+
* Skip the postinstall Hugo binary download entirely.
|
|
76
|
+
* Useful for CI caching, Docker layer optimization, or when Hugo is
|
|
77
|
+
* already installed system-wide.
|
|
78
|
+
*
|
|
79
|
+
* @example HUGO_SKIP_DOWNLOAD=1 npm ci
|
|
80
|
+
*/
|
|
59
81
|
skipInstall: {
|
|
60
82
|
name: "HUGO_SKIP_DOWNLOAD",
|
|
61
83
|
aliases: [],
|
|
@@ -63,6 +85,12 @@ const ENV_VARS = {
|
|
|
63
85
|
parse: parseBoolean,
|
|
64
86
|
defaultValue: false
|
|
65
87
|
},
|
|
88
|
+
/**
|
|
89
|
+
* Use a pre-existing Hugo binary instead of the bundled one.
|
|
90
|
+
* When set, the package will use this path for all Hugo operations.
|
|
91
|
+
*
|
|
92
|
+
* @example HUGO_BIN_PATH=/usr/local/bin/hugo npm start
|
|
93
|
+
*/
|
|
66
94
|
binPath: {
|
|
67
95
|
name: "HUGO_BIN_PATH",
|
|
68
96
|
aliases: [],
|
|
@@ -70,6 +98,16 @@ const ENV_VARS = {
|
|
|
70
98
|
parse: parseString,
|
|
71
99
|
defaultValue: void 0
|
|
72
100
|
},
|
|
101
|
+
/**
|
|
102
|
+
* Override the base URL for downloading Hugo releases.
|
|
103
|
+
* Useful for air-gapped environments, corporate mirrors, or faster
|
|
104
|
+
* regional mirrors.
|
|
105
|
+
*
|
|
106
|
+
* The URL should be the base path where release files are hosted.
|
|
107
|
+
* The version and filename will be appended automatically.
|
|
108
|
+
*
|
|
109
|
+
* @example HUGO_MIRROR_BASE_URL=https://mirror.example.com/hugo npm install
|
|
110
|
+
*/
|
|
73
111
|
downloadBaseUrl: {
|
|
74
112
|
name: "HUGO_MIRROR_BASE_URL",
|
|
75
113
|
aliases: [],
|
|
@@ -77,6 +115,12 @@ const ENV_VARS = {
|
|
|
77
115
|
parse: parseString,
|
|
78
116
|
defaultValue: void 0
|
|
79
117
|
},
|
|
118
|
+
/**
|
|
119
|
+
* Skip SHA-256 checksum verification of downloaded files.
|
|
120
|
+
* Use with caution - only recommended for trusted mirrors or development.
|
|
121
|
+
*
|
|
122
|
+
* @example HUGO_SKIP_CHECKSUM=1 npm install hugo-extended
|
|
123
|
+
*/
|
|
80
124
|
skipChecksum: {
|
|
81
125
|
name: "HUGO_SKIP_CHECKSUM",
|
|
82
126
|
aliases: ["HUGO_SKIP_VERIFY"],
|
|
@@ -84,6 +128,12 @@ const ENV_VARS = {
|
|
|
84
128
|
parse: parseBoolean,
|
|
85
129
|
defaultValue: false
|
|
86
130
|
},
|
|
131
|
+
/**
|
|
132
|
+
* Suppress installation progress output.
|
|
133
|
+
* Useful for cleaner CI logs or scripted automation.
|
|
134
|
+
*
|
|
135
|
+
* @example HUGO_QUIET=1 npm install hugo-extended
|
|
136
|
+
*/
|
|
87
137
|
quiet: {
|
|
88
138
|
name: "HUGO_QUIET",
|
|
89
139
|
aliases: ["HUGO_SILENT"],
|
|
@@ -133,6 +183,5 @@ const ENV_VAR_DOCS = Object.entries(ENV_VARS).map(([key, config]) => ({
|
|
|
133
183
|
type: config.defaultValue === void 0 ? "string" : typeof config.defaultValue === "boolean" ? "boolean" : "string",
|
|
134
184
|
default: config.defaultValue
|
|
135
185
|
}));
|
|
136
|
-
|
|
137
186
|
//#endregion
|
|
138
|
-
export { ENV_VAR_DOCS, getEnvConfig };
|
|
187
|
+
export { ENV_VAR_DOCS, getEnvConfig };
|
package/dist/lib/install.mjs
CHANGED
|
@@ -10,7 +10,6 @@ import { Readable } from "node:stream";
|
|
|
10
10
|
import { pipeline } from "node:stream/promises";
|
|
11
11
|
import AdmZip from "adm-zip";
|
|
12
12
|
import * as tar from "tar";
|
|
13
|
-
|
|
14
13
|
//#region src/lib/install.ts
|
|
15
14
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
15
|
/**
|
|
@@ -184,6 +183,5 @@ async function install() {
|
|
|
184
183
|
throw error;
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
|
-
|
|
188
186
|
//#endregion
|
|
189
|
-
export { install as default, extractPkg, getArchiveType, parseChecksumFile };
|
|
187
|
+
export { install as default, extractPkg, getArchiveType, parseChecksumFile };
|
package/dist/lib/utils.mjs
CHANGED
|
@@ -3,7 +3,6 @@ import { execFileSync } from "node:child_process";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
|
|
7
6
|
//#region src/lib/utils.ts
|
|
8
7
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
8
|
/**
|
|
@@ -176,16 +175,24 @@ function isExtended(releaseFile) {
|
|
|
176
175
|
* Logger utility that respects the HUGO_QUIET setting.
|
|
177
176
|
*/
|
|
178
177
|
const logger = {
|
|
178
|
+
/**
|
|
179
|
+
* Log an info message (respects HUGO_QUIET).
|
|
180
|
+
*/
|
|
179
181
|
info: (message) => {
|
|
180
182
|
if (!getEnvConfig().quiet) console.info(message);
|
|
181
183
|
},
|
|
184
|
+
/**
|
|
185
|
+
* Log a warning message (respects HUGO_QUIET).
|
|
186
|
+
*/
|
|
182
187
|
warn: (message) => {
|
|
183
188
|
if (!getEnvConfig().quiet) console.warn(`⚠ ${message}`);
|
|
184
189
|
},
|
|
190
|
+
/**
|
|
191
|
+
* Log an error message (always shown, even in quiet mode).
|
|
192
|
+
*/
|
|
185
193
|
error: (message) => {
|
|
186
194
|
console.error(`✖ ${message}`);
|
|
187
195
|
}
|
|
188
196
|
};
|
|
189
|
-
|
|
190
197
|
//#endregion
|
|
191
|
-
export { compareVersions, doesBinExist, getBinFilename, getBinPath, getBinVersion, getChecksumFilename, getPkgVersion, getReleaseFilename, getReleaseUrl, isExtended, logger, usesMacOSPkg };
|
|
198
|
+
export { compareVersions, doesBinExist, getBinFilename, getBinPath, getBinVersion, getChecksumFilename, getPkgVersion, getReleaseFilename, getReleaseUrl, isExtended, logger, usesMacOSPkg };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hugo-extended",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.161.0",
|
|
4
4
|
"description": "✏️ Plug-and-play binary wrapper for Hugo Extended, the awesomest static-site generator.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
"prepublishOnly": "npm run generate-types && npm run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"adm-zip": "^0.5.
|
|
62
|
-
"tar": "^7.5.
|
|
61
|
+
"adm-zip": "^0.5.17",
|
|
62
|
+
"tar": "^7.5.13"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@biomejs/biome": "^2.4.
|
|
66
|
-
"@types/adm-zip": "^0.5.
|
|
67
|
-
"@types/node": "^25.
|
|
65
|
+
"@biomejs/biome": "^2.4.13",
|
|
66
|
+
"@types/adm-zip": "^0.5.8",
|
|
67
|
+
"@types/node": "^25.6.0",
|
|
68
68
|
"@types/tar": "^6.1.13",
|
|
69
|
-
"@vitest/coverage-v8": "^4.
|
|
70
|
-
"tinyexec": "^1.
|
|
71
|
-
"tsdown": "^0.
|
|
72
|
-
"typescript": "^
|
|
73
|
-
"vitest": "^4.
|
|
69
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
70
|
+
"tinyexec": "^1.1.1",
|
|
71
|
+
"tsdown": "^0.21.10",
|
|
72
|
+
"typescript": "^6.0.3",
|
|
73
|
+
"vitest": "^4.1.5"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=18.17"
|