@mark1russell7/conventions 0.20.0 → 0.21.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/build/cli.js +1 -1
- package/build/index.d.ts +38 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/{run-B1RdSRV_.js → run-sEUuSlqi.js} +143 -4
- package/build/run-sEUuSlqi.js.map +1 -0
- package/package.json +1 -1
- package/build/run-B1RdSRV_.js.map +0 -1
package/build/cli.js
CHANGED
package/build/index.d.ts
CHANGED
|
@@ -361,6 +361,43 @@ export declare const HOME_EXPORTS: Readonly<Record<string, {
|
|
|
361
361
|
readonly version: string;
|
|
362
362
|
readonly names: readonly string[];
|
|
363
363
|
}>>;
|
|
364
|
+
interface WorkflowInput {
|
|
365
|
+
readonly name: string;
|
|
366
|
+
readonly type: string;
|
|
367
|
+
readonly description: string;
|
|
368
|
+
/** The default value, as YAML text. An empty text is no default. */
|
|
369
|
+
readonly default: string;
|
|
370
|
+
readonly required: boolean;
|
|
371
|
+
}
|
|
372
|
+
/** A step of a job. */
|
|
373
|
+
interface WorkflowStep {
|
|
374
|
+
/** The name of the step, or else its action, its id or its first command. */
|
|
375
|
+
readonly label: string;
|
|
376
|
+
/** The condition of the step (`if`), or an empty text. */
|
|
377
|
+
readonly if: string;
|
|
378
|
+
/** The action of the step (`uses`), with no pin, or an empty text. */
|
|
379
|
+
readonly uses: string;
|
|
380
|
+
}
|
|
381
|
+
/** A job of a workflow. */
|
|
382
|
+
interface WorkflowJob {
|
|
383
|
+
readonly id: string;
|
|
384
|
+
readonly if: string;
|
|
385
|
+
readonly needs: readonly string[];
|
|
386
|
+
readonly steps: readonly WorkflowStep[];
|
|
387
|
+
}
|
|
388
|
+
/** A shared workflow of the repository. */
|
|
389
|
+
interface Workflow {
|
|
390
|
+
/** The file name, for example `reusable-pages.yml`. */
|
|
391
|
+
readonly file: string;
|
|
392
|
+
/** The value of `name`. */
|
|
393
|
+
readonly name: string;
|
|
394
|
+
/** The first lines of the comment at the top of the file. */
|
|
395
|
+
readonly summary: string;
|
|
396
|
+
readonly inputs: readonly WorkflowInput[];
|
|
397
|
+
readonly jobs: readonly WorkflowJob[];
|
|
398
|
+
}
|
|
399
|
+
/** This function reads a shared workflow file. The file name goes into the result. */
|
|
400
|
+
export declare function readWorkflow(file: string, text: string): Workflow;
|
|
364
401
|
/** The result of one rule. */
|
|
365
402
|
interface RuleResult {
|
|
366
403
|
readonly id: string;
|
|
@@ -456,5 +493,5 @@ export declare function workspaceGlobs(root: string): string[] | undefined;
|
|
|
456
493
|
* The result has absolute paths, in the order of the code units.
|
|
457
494
|
*/
|
|
458
495
|
export declare function packageFolders(root: string, globs?: readonly string[] | undefined): string[];
|
|
459
|
-
export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeAnswer, HomeFetch, HomeState, Manifest, OptionSpec, OptionValue, Options, PackageInfo, PagesCall, PathFilter, RegistryAnswer, RegistryLookup, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult };
|
|
496
|
+
export type { AuditSource, Break, CheckOptions, CheckResult, CliIo, ConventionsConfig, Edit, FixResult, Home, HomeAnswer, HomeFetch, HomeState, Manifest, OptionSpec, OptionValue, Options, PackageInfo, PagesCall, PathFilter, RegistryAnswer, RegistryLookup, Rule, RuleConfig, RuleContext, RuleOutcome, RuleResult, Workflow, WorkflowInput, WorkflowJob, WorkflowStep };
|
|
460
497
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/unreleased-change.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,UAAU;;;UAIJ;;WAEN;;WAEA,aAAa;;WAEb,mBAAmB;;WAEnB,KAAK,SAAS;;WAEd;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;UAGvC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;EAC1C,MAAM,SAAS,aAAa,SAAS,UAAU;;;qBAIpC;;wBAGG,aAAa,UAAU,UAAU;;wBAOjC,OAAO,cAAc,gBAAgB;;wBAOrC,QAAQ,cAAc,eAAe;;qBAMxC,WAAY,gBAAgB;;qBAG5B,YAAa;;wBAGV,WAAW,cAAc;;;;;;wBASzB,WAAW;;wBA2BX,UAAU;;wBAUV,OAAO,cAAc;;qBAOxB,UAAW,aAAa;;;;;wBAMrB,aAAa,SAAS,KAAK,oDAAoD;;UCrM9E;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;UAIH;;WAEN;;WAEA,OAAO,SAAS,eAAe;;;wBAW1B,eAAe,MAAM,OAAO;;;;;;;wBAU5B,YAAY,gBAAgB,gBAAgB,SAAS;;qBCnCxD;qBA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pBZ,SAAS,0BAA0B;qBAKtC,cAAc;;wBCmDX,gBAAgB;;;;;wBAmChB,UACd,SAAS,SAAS,0BAClB,cACA,OAAM;qBAkRK,YAAY;qBC/VZ,cAAc;;qBC3Bd;;qBAGA;qBA6DA,aAAa;;;;;KC9Dd;WAA4B;WAAsC,QAAQ,SAAS;;WAAuC;;;KAG1H,kBAAkB,0BAA0B,qBAAqB,oBAAoB;;qBAGpF;;qBAGA;;qBAkBA;;;;;qBAyBA,WAAW;;wBAmGR,qBAAqB,SAAQ,iBAA6B;qBA2G7D,kBAAkB;qBCvQlB,mBAAmB;;qBCqBnB,gBAAgB;;qBC3BhB,cAAc,SAAS;WAA0B;WAA0B;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-trigger.ts","../src/map.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/rules/no-local-paths.ts","../src/rules/pages-site.ts","../src/rules/pinned-git-deps.ts","../src/rules/release-files.ts","../src/rules/required-scripts.ts","../src/rules/roadmap-parses.ts","../src/rules/runner-budget.ts","../src/rules/shared-docs.ts","../src/rules/source-main.ts","../src/rules/tests-required.ts","../src/rules/tsconfig-test.ts","../src/rules/typed-files.ts","../src/rules/typed-scripts.ts","../src/rules/trust-policy.ts","../src/rules/unreleased-change.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/home-exports.ts","../src/workflow.ts","../src/run.ts","../src/workspace.ts"],"mappings":";UASiB;WACN;WACA;WACA;;;UAIM;;WAEN;;WAEA;WACA;;WAEA;;WAEA,iBAAiB;;;;;;UAOX;;WAEN;;WAEA;;WAEA;;;wBAIK,YAAY,cAAc,cAAc;;KAQ5C;;KAGA,UAAU,SAAS,eAAe;;UAG7B;WACN;WACA,SAAS;WACT;;;KAIC,WAAW,SAAS;;UAGf;;WAEN;;WAEA;;WAEA;;WAEA;WACA,U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;;WAEA;;WAEA;WACA,iBAAiB;WACjB,eAAe;;;wBAgGV,aAAa,cAAc,eAAe;;UClLzC;WACN;WACA;WACA;;WAEA;WACA,iBAAiB;;WAEjB;;WAEA;;;UAIM;WACN,gBAAgB;;WAEhB;;;UAIM;;WAEN;;WAEA;;WAEA;WACA,MAAM,SAAS;;WAEf,iBAAiB;;;wBAaZ,WAAW,cAAc,iBAAgB,SAAiB;;wBAO1D,cAAc,cAAc,QAAQ,mBAAmB,UAAS,KAAK,gCAAqC;;wBAwB1G,UAAU,SAAS,eAAe;;UA2CjC;;WAEN;;WAEA;;WAEA,QAAQ;;;;;;;wBAWH,OAAO,SAAS,eAAe;;wBAyC/B,aAAa,QAAQ;;wBA0BrB,gBAAgB,QAAQ;;wBAsBxB,YAAY,QAAQ;;wBAYpB,UAAU,QAAQ,+BAA+B,iBAAgB;;UAkBhE;WACN;WACA,KAAK,SAAS;WACd,SAAS;WACT,SAAS;;;qBAIP;;wBA6BG,OAAO,yBAAyB,IAAI;;;;;;wBC1RpC,aAAa,eAAe;;;;;wBAsD5B,YAAY,cAAc;;;;;;wBA8B1B,eAAe;;;;;;;wBAwCf,eAAe,cAAc"}
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { xt as ACTIONS_COMMIT, Y as DEFAULT_ALLOWED,
|
|
1
|
+
export { xt as ACTIONS_COMMIT, Y as DEFAULT_ALLOWED, kt as DEPENDENCY_FIELDS, pt as HOMES, bt as HOME_EXPORTS, X as HOME_PATTERNS, M as HOME_TIMEOUT_MS, y as IGNORE_AFTER, nt as LICENSE_TEXTS, mt as MAP_RULE, p as NPM_REGISTRY, K as PAGES_WORKFLOWS, $ as REAL_COMPARE, d as RULES, m as SHIPPED_FIELDS, Dt as STRICT_OPTIONS, b as TRAIN_SCOPES, h as UNSHIPPED_FILES, t as USAGE, n as annotations, rt as authorOf, N as blockHash, At as cleanPath, jt as codePackages, C as configsOfScript, St as convertGate, r as createContext, Ot as cuePreset, ct as declaredName, Kt as defaultOptions, ht as findHomes, i as formatResult, Ct as gateTrigger, P as githubFetch, Ht as globFolders, Ut as globToRegExp, Mt as hasFile, et as hasImportMetaMain, D as hasTests, lt as homePackage, Nt as inFolder, U as isGitSpecifier, W as isPinned, k as isSourcePath, Pt as keyLine, it as licenseFile, at as licenseFileOf, Ft as lineOf, a as listRules, tt as mainCheck, gt as mapMarkdown, _t as mapText, It as matchesAny, vt as mergeHomes, ut as messageOf, ot as mitText, Q as noBuildOutput, Z as noLocalPaths, g as npmLookup, Wt as packageFolders, q as pagesCalls, J as pagesSite, qt as parseConfig, Lt as parseJsonc, A as pathsOf, G as pinnedGitDeps, wt as prPathFilters, o as readConfig, Rt as readJsonc, yt as readOverlay, Et as readWorkflow, H as releaseFiles, zt as replaceLine, dt as repoOf, st as repositoryIsPublic, I as repositoryOfRemote, V as requiredScripts, z as roadmapOfLine, B as roadmapParses, s as runChecks, c as runCli, l as runFix, Bt as runGit, L as runnerBudget, R as scheduleMinute, w as scriptsOf, F as sharedDocsRule, ft as signaturesOf, j as sourceMain, Vt as specifiersOf, u as summaryMarkdown, Tt as summaryName, E as testsRequired, x as trustPolicy, O as tsconfigTest, T as typedFiles, S as typedScripts, _ as unreleasedChange, v as unreleasedChangeRule, Gt as workspaceGlobs, f as workspaceProtocol } from "./run-sEUuSlqi.js";
|
|
@@ -1300,7 +1300,8 @@ const cuePreset = {
|
|
|
1300
1300
|
// src/workflow.ts
|
|
1301
1301
|
/**
|
|
1302
1302
|
* A small reader of GitHub workflow files, by the indent of the lines. The rules that read workflows share it. It
|
|
1303
|
-
* knows the block form
|
|
1303
|
+
* knows the block form, the inline values of keys and the block scalars (`|` and `>`) that the workflows of the template
|
|
1304
|
+
* use. `readWorkflow` gives the parts of a shared workflow that the site of the template shows.
|
|
1304
1305
|
*/
|
|
1305
1306
|
/** A workflow file. */
|
|
1306
1307
|
const WORKFLOW$1 = /^\.github\/workflows\/[^/]+\.ya?ml$/;
|
|
@@ -1309,7 +1310,7 @@ const indentOf$1 = (line) => line.length - line.trimStart().length;
|
|
|
1309
1310
|
const workflowLines = (text) => text.split(/\r?\n/).map((line) => line.trimStart().startsWith("#") ? "" : line);
|
|
1310
1311
|
/** This function removes a comment at the end of a value, and the quotes around it. */
|
|
1311
1312
|
function valueOf$1(raw) {
|
|
1312
|
-
const comment = raw.
|
|
1313
|
+
const comment = raw.search(/\s#/);
|
|
1313
1314
|
let value = (comment >= 0 ? raw.slice(0, comment) : raw).trim();
|
|
1314
1315
|
const quote = value.charAt(0);
|
|
1315
1316
|
if (value.length >= 2 && (quote === "\"" || quote === "'") && value.endsWith(quote)) value = value.slice(1, -1).trim();
|
|
@@ -1349,6 +1350,144 @@ function childKeys(lines, index) {
|
|
|
1349
1350
|
for (let i = index + 1; i < blockEnd(lines, index); i++) if ((lines[i] ?? "").trim() !== "" && indentOf$1(lines[i] ?? "") === indent) keys.push(i);
|
|
1350
1351
|
return keys;
|
|
1351
1352
|
}
|
|
1353
|
+
/** This function gives the text of a block scalar (`|`, `|-`, `>`, `>-`) under the line `index`. */
|
|
1354
|
+
function scalar(lines, index, style) {
|
|
1355
|
+
const body = lines.slice(index + 1, blockEnd(lines, index));
|
|
1356
|
+
const indent = Math.min(...body.filter((l) => l.trim() !== "").map(indentOf$1));
|
|
1357
|
+
const text = body.map((l) => l.slice(indent).trimEnd());
|
|
1358
|
+
return (style.startsWith(">") ? text.join(" ").replace(/\s+/g, " ") : text.join("\n")).trim();
|
|
1359
|
+
}
|
|
1360
|
+
/** This function gives the keys of the lines `start` to `end` at the indent `indent`. A first line can start with `- `. */
|
|
1361
|
+
function entries(lines, start, end, indent) {
|
|
1362
|
+
const map = /* @__PURE__ */ new Map();
|
|
1363
|
+
for (let i = start; i < end; i++) {
|
|
1364
|
+
const line = lines[i] ?? "";
|
|
1365
|
+
if (line.trim() === "") continue;
|
|
1366
|
+
let text = line;
|
|
1367
|
+
if (i === start && line.trimStart().startsWith("- ")) text = " ".repeat(indentOf$1(line) + 2) + line.trimStart().slice(2);
|
|
1368
|
+
if (indentOf$1(text) !== indent) continue;
|
|
1369
|
+
const match = /^\s*("[^"]+"|'[^']+'|[^\s:][^:]*):(?:\s(.*))?$/.exec(text);
|
|
1370
|
+
if (!match?.[1]) continue;
|
|
1371
|
+
const key = match[1].replace(/^["']|["']$/g, "");
|
|
1372
|
+
const raw = valueOf$1((match[2] ?? "").trim());
|
|
1373
|
+
map.set(key, {
|
|
1374
|
+
line: i,
|
|
1375
|
+
value: /^[|>][-+]?$/.test(raw) ? scalar(lines, i, raw) : raw
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
return map;
|
|
1379
|
+
}
|
|
1380
|
+
/** This function gives the keys of the block under the line `index`. */
|
|
1381
|
+
function childrenOf(lines, index) {
|
|
1382
|
+
const end = blockEnd(lines, index);
|
|
1383
|
+
const first = lines.slice(index + 1, end).find((l) => l.trim() !== "");
|
|
1384
|
+
return first === void 0 ? /* @__PURE__ */ new Map() : entries(lines, index + 1, end, indentOf$1(first));
|
|
1385
|
+
}
|
|
1386
|
+
/** This function gives the first line of each item of the list under the line `index`. */
|
|
1387
|
+
function itemsOf(lines, index) {
|
|
1388
|
+
const end = blockEnd(lines, index);
|
|
1389
|
+
const items = [];
|
|
1390
|
+
let indent;
|
|
1391
|
+
for (let i = index + 1; i < end; i++) {
|
|
1392
|
+
const line = lines[i] ?? "";
|
|
1393
|
+
if (!line.trimStart().startsWith("- ") && line.trim() !== "-") continue;
|
|
1394
|
+
indent ??= indentOf$1(line);
|
|
1395
|
+
if (indentOf$1(line) === indent) items.push(i);
|
|
1396
|
+
}
|
|
1397
|
+
return items;
|
|
1398
|
+
}
|
|
1399
|
+
/** This function gives the values of a list: an inline list (`[a, b]`), one value, or a block list. */
|
|
1400
|
+
function listOf(lines, entry) {
|
|
1401
|
+
if (entry === void 0) return [];
|
|
1402
|
+
const inline = entry.value.trim();
|
|
1403
|
+
if (inline.startsWith("[")) return inline.slice(1, -1).split(",").map(valueOf$1).filter(Boolean);
|
|
1404
|
+
if (inline !== "") return [inline];
|
|
1405
|
+
return itemsOf(lines, entry.line).map((i) => valueOf$1((lines[i] ?? "").trimStart().slice(2)));
|
|
1406
|
+
}
|
|
1407
|
+
/** This function gives an action of a `uses` value with no pin: `actions/checkout@<sha> # v7` gives `actions/checkout`. */
|
|
1408
|
+
const actionOf = (uses) => uses.split("@", 1)[0] ?? uses;
|
|
1409
|
+
/** This function gives the label of a step: its name, else its action, its id or its first command. */
|
|
1410
|
+
function stepLabel(step) {
|
|
1411
|
+
const name = step.get("name")?.value;
|
|
1412
|
+
if (name) return name;
|
|
1413
|
+
const uses = step.get("uses")?.value;
|
|
1414
|
+
if (uses) return actionOf(uses);
|
|
1415
|
+
const run = step.get("run")?.value.split("\n")[0];
|
|
1416
|
+
if (run) return run;
|
|
1417
|
+
return step.get("id")?.value ?? "step";
|
|
1418
|
+
}
|
|
1419
|
+
/** This function gives the summary of a workflow: the first paragraph of the comment at the top of the file. */
|
|
1420
|
+
function summaryOf(lines) {
|
|
1421
|
+
const words = [];
|
|
1422
|
+
for (const line of lines) {
|
|
1423
|
+
if (!line.startsWith("#")) break;
|
|
1424
|
+
const text = line.replace(/^#\s?/, "").trim();
|
|
1425
|
+
if (text === "") {
|
|
1426
|
+
if (words.length > 0) break;
|
|
1427
|
+
continue;
|
|
1428
|
+
}
|
|
1429
|
+
words.push(text);
|
|
1430
|
+
}
|
|
1431
|
+
return words.join(" ");
|
|
1432
|
+
}
|
|
1433
|
+
/** This function reads a shared workflow file. The file name goes into the result. */
|
|
1434
|
+
function readWorkflow(file, text) {
|
|
1435
|
+
const raw = text.split(/\r?\n/);
|
|
1436
|
+
const lines = raw.map((line) => line.trimStart().startsWith("#") ? "" : line);
|
|
1437
|
+
const top = entries(lines, 0, lines.length, 0);
|
|
1438
|
+
const on = top.get("on");
|
|
1439
|
+
const call = on ? childrenOf(lines, on.line).get("workflow_call") : void 0;
|
|
1440
|
+
const inputsEntry = call ? childrenOf(lines, call.line).get("inputs") : void 0;
|
|
1441
|
+
const inputs = [];
|
|
1442
|
+
if (inputsEntry) for (const [name, entry] of childrenOf(lines, inputsEntry.line)) {
|
|
1443
|
+
const keys = childrenOf(lines, entry.line);
|
|
1444
|
+
inputs.push({
|
|
1445
|
+
name,
|
|
1446
|
+
type: keys.get("type")?.value ?? "string",
|
|
1447
|
+
description: keys.get("description")?.value ?? "",
|
|
1448
|
+
default: keys.get("default")?.value ?? "",
|
|
1449
|
+
required: keys.get("required")?.value === "true"
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
const jobs = [];
|
|
1453
|
+
const jobsEntry = top.get("jobs");
|
|
1454
|
+
if (jobsEntry) for (const [id, entry] of childrenOf(lines, jobsEntry.line)) {
|
|
1455
|
+
const keys = childrenOf(lines, entry.line);
|
|
1456
|
+
const stepsEntry = keys.get("steps");
|
|
1457
|
+
const steps = [];
|
|
1458
|
+
if (stepsEntry) {
|
|
1459
|
+
const items = itemsOf(lines, stepsEntry.line);
|
|
1460
|
+
const last = blockEnd(lines, stepsEntry.line);
|
|
1461
|
+
items.forEach((start, n) => {
|
|
1462
|
+
const step = entries(lines, start, items[n + 1] ?? last, indentOf$1(lines[start] ?? "") + 2);
|
|
1463
|
+
steps.push({
|
|
1464
|
+
label: stepLabel(step),
|
|
1465
|
+
if: step.get("if")?.value ?? "",
|
|
1466
|
+
uses: actionOf(step.get("uses")?.value ?? "")
|
|
1467
|
+
});
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
const uses = keys.get("uses")?.value;
|
|
1471
|
+
if (steps.length === 0 && uses) steps.push({
|
|
1472
|
+
label: `calls ${actionOf(uses)}`,
|
|
1473
|
+
if: "",
|
|
1474
|
+
uses: actionOf(uses)
|
|
1475
|
+
});
|
|
1476
|
+
jobs.push({
|
|
1477
|
+
id,
|
|
1478
|
+
if: keys.get("if")?.value ?? "",
|
|
1479
|
+
needs: listOf(lines, keys.get("needs")),
|
|
1480
|
+
steps
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
return {
|
|
1484
|
+
file,
|
|
1485
|
+
name: top.get("name")?.value ?? file,
|
|
1486
|
+
summary: summaryOf(raw),
|
|
1487
|
+
inputs,
|
|
1488
|
+
jobs
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1352
1491
|
// src/rules/gate-trigger.ts
|
|
1353
1492
|
/**
|
|
1354
1493
|
* The rule `gate-trigger`: a workflow that runs on pull requests starts on each pull request, with no path filter. The
|
|
@@ -10654,6 +10793,6 @@ function runMap(args, io) {
|
|
|
10654
10793
|
else io.stdout(mapText(found));
|
|
10655
10794
|
return 0;
|
|
10656
10795
|
}
|
|
10657
|
-
export { REAL_COMPARE as $, pathsOf as A,
|
|
10796
|
+
export { REAL_COMPARE as $, pathsOf as A, cleanPath as At, roadmapParses as B, runGit as Bt, configsOfScript as C, gateTrigger as Ct, hasTests as D, STRICT_OPTIONS as Dt, testsRequired as E, readWorkflow as Et, sharedDocsRule as F, lineOf as Ft, pinnedGitDeps as G, workspaceGlobs as Gt, releaseFiles as H, globFolders as Ht, repositoryOfRemote as I, matchesAny as It, pagesSite as J, PAGES_WORKFLOWS as K, defaultOptions as Kt, runnerBudget as L, parseJsonc as Lt, HOME_TIMEOUT_MS as M, hasFile as Mt, blockHash as N, inFolder as Nt, tsconfigTest as O, cuePreset as Ot, githubFetch as P, keyLine as Pt, noBuildOutput as Q, scheduleMinute as R, readJsonc as Rt, typedScripts as S, convertGate as St, typedFiles as T, summaryName as Tt, isGitSpecifier as U, globToRegExp as Ut, requiredScripts as V, specifiersOf as Vt, isPinned as W, packageFolders as Wt, HOME_PATTERNS as X, DEFAULT_ALLOWED as Y, noLocalPaths as Z, unreleasedChange as _, mapText as _t, listRules as a, licenseFileOf as at, TRAIN_SCOPES as b, HOME_EXPORTS as bt, runCli as c, declaredName as ct, RULES as d, repoOf as dt, hasImportMetaMain as et, workspaceProtocol as f, signaturesOf as ft, npmLookup as g, mapMarkdown as gt, UNSHIPPED_FILES as h, findHomes as ht, formatResult as i, licenseFile as it, sourceMain as j, codePackages as jt, isSourcePath as k, DEPENDENCY_FIELDS as kt, runFix as l, homePackage as lt, SHIPPED_FIELDS as m, MAP_RULE as mt, annotations as n, LICENSE_TEXTS as nt, readConfig as o, mitText as ot, NPM_REGISTRY as p, HOMES as pt, pagesCalls as q, parseConfig as qt, createContext as r, authorOf as rt, runChecks as s, repositoryIsPublic as st, USAGE as t, mainCheck as tt, summaryMarkdown as u, messageOf as ut, unreleasedChangeRule as v, mergeHomes as vt, scriptsOf as w, prPathFilters as wt, trustPolicy as x, ACTIONS_COMMIT as xt, IGNORE_AFTER as y, readOverlay as yt, roadmapOfLine as z, replaceLine as zt };
|
|
10658
10797
|
|
|
10659
|
-
//# sourceMappingURL=run-
|
|
10798
|
+
//# sourceMappingURL=run-sEUuSlqi.js.map
|