Skip to content

Commit 1296da4

Browse files
committed
Implement --die-on
1 parent 458dbc2 commit 1296da4

File tree

3 files changed

+39
-15
lines changed

3 files changed

+39
-15
lines changed

generators/bikeshed.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,14 @@ const generateFilename = (url: string) =>
5757
/**
5858
* Invokes bikeshed on a URL with the given options.
5959
* @param input HTTPS URL or file path to process
60-
* @param options Additional CLI arguments
60+
* @param modeOptions Additional CLI arguments specified after the mode
61+
* @param globalOptions Additional CLI arguments specified before the mode
6162
*/
6263
async function invokeBikeshed(
6364
input: string,
6465
mode: BikeshedType,
65-
options: string[] = [],
66+
modeOptions: string[] = [],
67+
globalOptions: string[] = [],
6668
) {
6769
if (!bikeshedVersion) {
6870
throw new SpecGeneratorError(
@@ -81,17 +83,16 @@ async function invokeBikeshed(
8183
[
8284
"--print=json",
8385
"--no-update",
86+
...globalOptions,
8487
mode,
8588
input,
8689
outputPath,
87-
...options,
90+
...modeOptions,
8891
],
8992
{ timeout: 30000 },
9093
);
9194
const pid = bikeshedProcess.pid;
92-
console.log(
93-
`[bikeshed(${pid})] generating ${mode} ${input}${options.length ? ` (${options})` : ""}`,
94-
);
95+
console.log(`[bikeshed(${pid})] generating ${mode} ${input}`);
9596

9697
const stdoutChunks: string[] = [];
9798
bikeshedProcess.stdout.on("data", (data) => stdoutChunks.push(data));
@@ -200,7 +201,12 @@ const generateSpec = async (input: string, params: URLSearchParams) => {
200201
for (const [key, value] of params.entries()) {
201202
if (key.startsWith("md-")) metadataOverrides.push(`--${key}=${value}`);
202203
}
203-
return invokeBikeshed(input, "spec", metadataOverrides);
204+
return invokeBikeshed(
205+
input,
206+
"spec",
207+
metadataOverrides,
208+
params.has("die-on") ? [`--die-on=${params.get("die-on")}`] : [],
209+
);
204210
};
205211

206212
/** Runs `bikeshed issues-list`, fetching from remote server if a URL is specified. */

partials/layout.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
input {
3535
background: #eee;
3636
border: 1px solid #999;
37-
line-height: 1.5;
3837
padding: 0.2rem;
39-
margin-bottom: 0.5em;
4038
}
4139

4240
fieldset {
@@ -62,6 +60,8 @@
6260
}
6361

6462
.either input {
63+
line-height: 1.5;
64+
margin-bottom: 0.5em;
6565
width: 100%;
6666
}
6767

views/bikeshed.html

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
body:has(#type-spec:checked) .issues-only {
66
display: none;
77
}
8+
9+
fieldset div:not(:first-of-type, :last-of-type) {
10+
margin: 1em 0;
11+
}
12+
13+
fieldset div label:first-child {
14+
display: inline-block;
15+
width: 12em;
16+
}
817
</style>
918
{% endblock %}
1019
{% block %}
@@ -16,19 +25,28 @@
1625
<label for="type-{{ item[0] }}">{{ item[1] }}</label>
1726
{% endfor %}
1827
</fieldset>
19-
<fieldset class="spec-only">
20-
<legend>Spec options</legend>
28+
<fieldset>
29+
<legend>Options</legend>
2130
<div>
31+
<label for="die-on">Die on</label>
32+
<select name="die-on" id="die-on">
33+
<option value="nothing">Nothing (force)</option>
34+
<option value="fatal" selected>Fatal</option>
35+
<option value="link-error">Link error</option>
36+
<option value="warning">Warning</option>
37+
<option value="lint">Lint</option>
38+
<option value="message">Message</option>
39+
<option value="everything">Everything</option>
40+
</select>
41+
</div>
42+
<div class="spec-only">
2243
<label for="date">Date (defaults to <code>now</code>)</label>
2344
<input name="md-date" id="date">
2445
</div>
25-
<div>
46+
<div class="spec-only">
2647
<input type="checkbox" name="md-prepare-for-tr" value="yes" id="tr">
2748
<label for="tr">Prepare for TR</label>
2849
</div>
29-
<div>
30-
31-
</div>
3250
</fieldset>
3351
<div class="either">
3452
<fieldset>

0 commit comments

Comments
 (0)