Skip to content

Commit 29211a7

Browse files
committed
chore(ci): update hugo starter to use mise defined binary
- Updated mise.toml to include Hugo as a required tool. - Added Hugo installation details to the BUILD documentation. - Removed outdated hugo-bin dependency from pnpm-lock.yaml and pnpm-workspace.yaml. - Updated CI validation script to include Hugo in the required tools list. - Adjusted package.json in the Hugo starter to reflect the new installation process. Signed-off-by: Cory Rylan <crylan@nvidia.com>
1 parent 0a6b54e commit 29211a7

10 files changed

Lines changed: 99 additions & 546 deletions

File tree

‎mise.lock‎

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎mise.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pnpm = "11.9.0"
88
vale = "3.15.1"
99
go = "1.26.4"
1010
git-lfs = "3.7.1"
11+
hugo = "0.152.2"
1112

1213
[tasks.clean]
1314
run = [

‎pnpm-lock.yaml‎

Lines changed: 0 additions & 530 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ allowBuilds:
133133
'@parcel/watcher': true
134134
bun: true
135135
esbuild: true
136-
hugo-bin: true
137136
lmdb: true
138137
msgpackr-extract: true
139138
rs-module-lexer: true

‎projects/internals/BUILD.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ The following are the repo wide tools that apply to all source code and projects
121121

122122
-[mise](https://mise.en.dev/)
123123

124-
mise installs and activates the repository toolchain from `mise.toml`, including Node.js, pnpm, Vale, Go, and Git LFS. CI uses the same manifest through the shared setup action.
124+
mise installs and activates the repository toolchain from `mise.toml`, including Node.js, pnpm, Vale, Go, Git LFS, and Hugo. CI uses the same manifest through the shared setup action.
125125

126126
-[pnpm Package Manager](https://pnpm.io/)
127127

‎projects/internals/ci/ci-validate.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import{readFileSync}from'node:fs';
22

33
constread=path=>readFileSync(path,'utf-8');
4-
constrequiredTools=['node','pnpm','vale','go','git-lfs'];
4+
constrequiredTools=['node','pnpm','vale','go','git-lfs','hugo'];
55
constpackageJson=JSON.parse(read('package.json'));
66
consttoolsTable=read('mise.toml').match(/^\[tools]\n([\s\S]*?)(?=^\[|(?![\s\S]))/m)?.[1]??'';
77
consttools=Object.fromEntries(

‎projects/internals/tools/src/project/starters.test.ts‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,45 @@ describe('removeWireitScripts', () => {
118118
expect(result.wireit).toBeUndefined();
119119
});
120120

121+
it('should remove mise from exported wireit scripts',()=>{
122+
constpackageJson={
123+
scripts: {
124+
build: 'wireit',
125+
dev: 'wireit'
126+
},
127+
wireit: {
128+
build: {
129+
command: 'mise exec -- hugo'
130+
},
131+
dev: {
132+
command: 'mise exec -- hugo server'
133+
}
134+
}
135+
};
136+
constresult=removeWireitScripts(packageJson);
137+
138+
expect(result.scripts.build).toBe('hugo');
139+
expect(result.scripts.dev).toBe('hugo server');
140+
expect(result.wireit).toBeUndefined();
141+
});
142+
143+
it('should remove exported wireit scripts without commands',()=>{
144+
constpackageJson={
145+
scripts: {
146+
ci: 'wireit'
147+
},
148+
wireit: {
149+
ci: {
150+
dependencies: ['build']
151+
}
152+
}
153+
};
154+
constresult=removeWireitScripts(packageJson);
155+
156+
expect(result.scripts.ci).toBeUndefined();
157+
expect(result.wireit).toBeUndefined();
158+
});
159+
121160
it('should handle package.json with mixed wireit and regular scripts',()=>{
122161
constpackageJson={
123162
scripts: {

‎projects/internals/tools/src/project/starters.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,19 +245,29 @@ async function exportPackageFromWorkspace(projectDir: string) {
245245
constmanifest=awaitreadProjectManifestOnly(projectDir);
246246
letexportable=awaitcreateExportableManifest(projectDir,manifest,{ catalogs });
247247
exportable=removeWireitScripts(
248-
exportableasunknownas{scripts: Record<string,string>;wireit?: Record<string,{command: string}>}
248+
exportableasunknownas{
249+
scripts: Record<string,string>;
250+
wireit?: Record<string,{command?: string}>;
251+
}
249252
);
250253
returnexportable;
251254
}
252255

253256
exportfunctionremoveWireitScripts(exportable: {
254257
scripts: Record<string,string>;
255-
wireit?: Record<string,{command: string}>;
258+
wireit?: Record<string,{command?: string}>;
256259
}){
257260
Object.keys(exportable.scripts)
258261
.filter(key=>exportable.scripts[key]==='wireit'&&exportable.wireit?.[key])
259262
.forEach(key=>{
260-
exportable.scripts[key]=exportable.wireit![key]!.command;
263+
constcommand=exportable.wireit![key]!.command;
264+
if(!command){
265+
exportable.scripts=Object.fromEntries(
266+
Object.entries(exportable.scripts).filter(([script])=>script!==key)
267+
);
268+
return;
269+
}
270+
exportable.scripts[key]=command.replace(/^miseexec--/,'');
261271

262272
constscriptValue=exportable.scripts[key];
263273
if(scriptValue&&scriptValue.match(/playwright-lock'(.*?)'/g)){

‎projects/starters/hugo/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This starter uses Hugo templates with the prebuilt JavaScript and CSS bundles fr
66

77
## Getting started
88

9-
Install the package dependencies to use the starter's pinned Hugo binary:
9+
Install Hugo before installing the package dependencies. At the Elements repository root, `mise install` installs the pinned version from `mise.toml`. If you downloaded this starter, follow the [Hugo installation guide](https://gohugo.io/installation/).
1010

1111
```shell
1212
npm install

‎projects/starters/hugo/package.json‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,14 @@
1414
"@nvidia-elements/themes": "workspace:*",
1515
"@nvidia-elements/code": "workspace:*"
1616
},
17-
"devDependencies": {
18-
"hugo-bin": "0.149.2"
19-
},
20-
"hugo-bin": {
21-
"version": "0.152.2"
22-
},
2317
"wireit": {
2418
"ci": {
2519
"dependencies": [
2620
"build"
2721
]
2822
},
2923
"build": {
30-
"command": "hugo --baseURL \"${PAGES_BASE_URL:-/}\"",
24+
"command": "mise exec -- hugo --baseURL \"${PAGES_BASE_URL:-/}\"",
3125
"files": [
3226
"../../core/dist/**/*.js",
3327
"../../styles/dist/**/*.css",
@@ -37,7 +31,8 @@
3731
"content/**",
3832
"layouts/**",
3933
"static/**",
40-
"hugo.toml"
34+
"hugo.toml",
35+
"../../../mise.toml"
4136
],
4237
"output": [
4338
"dist/**"
@@ -68,7 +63,7 @@
6863
}
6964
},
7065
"dev": {
71-
"command": "hugo server",
66+
"command": "mise exec -- hugo server",
7267
"service": true
7368
}
7469
}

0 commit comments

Comments
 (0)