@mark1russell7/conventions 0.47.2 → 0.47.4
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 -2
- package/build/cli.js +2 -2
- package/build/cli.js.map +1 -1
- package/build/index.d.ts +28 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/{run-BLJCc6nt.js → run-PzdziLsV.js} +103 -26
- package/build/run-PzdziLsV.js.map +1 -0
- package/package.json +1 -1
- package/build/run-BLJCc6nt.js.map +0 -1
package/README.md
CHANGED
|
@@ -179,6 +179,7 @@ An unknown rule, an unknown option, or an exception or a changed option without
|
|
|
179
179
|
| `--no-base` | Do not use a default base. |
|
|
180
180
|
| `--json` | Write the result as JSON. |
|
|
181
181
|
| `pre-push <remote> [<url>]` | Examine the new commits of a push with the private name list. The git hook `pre-push` starts it. |
|
|
182
|
+
| `pre-push --base <ref> [--head <ref>]` | Examine the commits of `<base>..<head>` (the default head is `HEAD`) and the text of the pull request of the run, with the same rules. The shared CI starts it. |
|
|
182
183
|
| `hook install` | Write the git hook `pre-push`. In CI, or outside a git repository, the command does nothing. |
|
|
183
184
|
|
|
184
185
|
A run that `workflow_dispatch` starts has no pull request in its event file. A person can start the gates of a pull request in this way. For such a run, the shared CI finds the pull request of the branch, and gives two environment variables to the check:
|
|
@@ -248,7 +249,9 @@ A break shows the commit, the place and the index of the name in the list. An ex
|
|
|
248
249
|
|
|
249
250
|
When no list and no pattern is set, the command writes one line that starts with `conventions pre-push: No read`, and the push continues. A push with no read is not a pass. The push stops when the command cannot read the list that a setting names. It also stops when the list is not JSON, does not agree with the schema, or has a bad regular expression. The line of the stop gives the reason and the index of the entry, not its values.
|
|
250
251
|
|
|
251
|
-
The check of CI continues to read the environment variable `CONVENTIONS_PRIVATE_PATTERNS` in the rule `no-local-paths`.
|
|
252
|
+
The check of CI continues to read the environment variable `CONVENTIONS_PRIVATE_PATTERNS` in the rule `no-local-paths`. In CI (`CI` or `GITHUB_ACTIONS` is set) with no private pattern, the rule cannot look for private names. Its result then shows `NO READ` and the reason, and GitHub shows a warning. The JSON result has the field `noRead`. The status of the rule does not change, so the rule still fails on a home folder. A local check shows no such note.
|
|
253
|
+
|
|
254
|
+
With `--base <ref>`, the command is the check of a change in CI. It examines each commit of `<base>..<head>` with the same rules as the hook. It also examines the title and the body of the pull request of the run, as the rule `no-local-paths` reads them. It reads no standard input. A break fails the check with the exit code 1, and the text tells that the check fails, not that the push stops. The step "Private names of the change" of the shared CI starts it with the list of the secret `CONVENTIONS_PRIVATE_NAMES` (`CI.md` of the template).
|
|
252
255
|
|
|
253
256
|
## The map of homes
|
|
254
257
|
|
|
@@ -318,4 +321,4 @@ The package also exports the functions of the tool:
|
|
|
318
321
|
- `lineNameHits(list, line, place)` and `nameMatches(line, names)` give each name of a line, one hit for each name. A scan that counts the names uses them. The gate takes the first hit.
|
|
319
322
|
- `privateNamesFiles(env, git)`, `privateNamesFile(env, git)`, `privatePatterns(env)` and `invalidPatternBreaks(patterns)` read the settings and the patterns. `privateNamesFiles` gives each path, and `privateNamesFile` gives one.
|
|
320
323
|
- `mergePrivateNames(lists)` merges the lists in order. It throws a `PrivateNameListError` when two lists have the same id.
|
|
321
|
-
- `prePush(options, io)` is the command `pre-push`,
|
|
324
|
+
- `prePush(options, io)` is the command `pre-push`. With the option `base`, it is the check of a change in CI. `installHook(options, io)` is the command `hook install`. `PRE_PUSH_HOOK` is the text of the hook.
|
package/build/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as runCli } from "./run-
|
|
2
|
+
import { c as runCli } from "./run-PzdziLsV.js";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
// src/cli.ts
|
|
5
5
|
try {
|
|
6
6
|
const args = process.argv.slice(2);
|
|
7
|
-
const stdin = args[0] === "pre-push" && process.stdin.isTTY !== true ? readFileSync(0, "utf8") : void 0;
|
|
7
|
+
const stdin = args[0] === "pre-push" && !args.includes("--base") && process.stdin.isTTY !== true ? readFileSync(0, "utf8") : void 0;
|
|
8
8
|
process.exitCode = runCli(args, {
|
|
9
9
|
cwd: process.cwd(),
|
|
10
10
|
env: process.env,
|
package/build/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// The bin `conventions`. The work is in run.ts, so a test can start the same CLI in a fixture folder.\nimport { readFileSync } from \"node:fs\";\nimport { runCli } from \"./run.ts\";\n\ntry {\n const args = process.argv.slice(2);\n // Only the git hook pre-push gives a standard input: the refs of the push. A terminal gives none\n const stdin = args[0] === \"pre-push\" && process.stdin.isTTY !== true ? readFileSync(0, \"utf8\") : undefined;\n process.exitCode = runCli(args, {\n cwd: process.cwd(),\n env: process.env,\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n ...(stdin === undefined ? {} : { stdin }),\n });\n} catch (error) {\n process.stderr.write(`conventions: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n}\n"],"mappings":";;;;AAKA,IAAI;CACF,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// The bin `conventions`. The work is in run.ts, so a test can start the same CLI in a fixture folder.\nimport { readFileSync } from \"node:fs\";\nimport { runCli } from \"./run.ts\";\n\ntry {\n const args = process.argv.slice(2);\n // Only the git hook pre-push gives a standard input: the refs of the push. A terminal gives none, and the check of a\n // change in CI (--base) reads none\n const stdin = args[0] === \"pre-push\" && !args.includes(\"--base\") && process.stdin.isTTY !== true ? readFileSync(0, \"utf8\") : undefined;\n process.exitCode = runCli(args, {\n cwd: process.cwd(),\n env: process.env,\n stdout: (text) => process.stdout.write(text),\n stderr: (text) => process.stderr.write(text),\n ...(stdin === undefined ? {} : { stdin }),\n });\n} catch (error) {\n process.stderr.write(`conventions: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}\\n`);\n process.exitCode = 1;\n}\n"],"mappings":";;;;AAKA,IAAI;CACF,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;CAGjC,MAAM,QAAQ,KAAK,OAAO,cAAc,CAAC,KAAK,SAAS,QAAQ,KAAK,QAAQ,MAAM,UAAU,OAAO,aAAa,GAAG,MAAM,IAAI,KAAA;CAC7H,QAAQ,WAAW,OAAO,MAAM;EAC9B,KAAK,QAAQ,IAAI;EACjB,KAAK,QAAQ;EACb,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;EAC3C,SAAS,SAAS,QAAQ,OAAO,MAAM,IAAI;EAC3C,GAAI,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM;CACzC,CAAC;AACH,SAAS,OAAO;CACd,QAAQ,OAAO,MAAM,gBAAgB,iBAAiB,QAAS,MAAM,SAAS,MAAM,UAAW,OAAO,KAAK,EAAE,GAAG;CAChH,QAAQ,WAAW;AACrB"}
|
package/build/index.d.ts
CHANGED
|
@@ -123,6 +123,12 @@ interface Rule {
|
|
|
123
123
|
*/
|
|
124
124
|
readonly failsFrom?: string;
|
|
125
125
|
check(context: RuleContext, options: Options): RuleOutcome;
|
|
126
|
+
/**
|
|
127
|
+
* This function gives the reason when the rule cannot read a part of its cases, for example a private source that CI
|
|
128
|
+
* does not give. It gives undefined when the rule reads each part. The check then shows "no read" and the reason with
|
|
129
|
+
* the result, so a part with no read does not show as a pass. The status of the rule does not change.
|
|
130
|
+
*/
|
|
131
|
+
noRead?(context: RuleContext, options: Options): string | undefined;
|
|
126
132
|
}
|
|
127
133
|
/** The fields of `package.json` that hold dependencies. */
|
|
128
134
|
export declare const DEPENDENCY_FIELDS: readonly ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
|
|
@@ -790,6 +796,11 @@ interface RuleResult {
|
|
|
790
796
|
readonly ignored: number;
|
|
791
797
|
/** The reason of `off`, of `ignore`, of `skipped`, or the message of `error`. */
|
|
792
798
|
readonly note?: string;
|
|
799
|
+
/**
|
|
800
|
+
* The reason why the rule did not read a part of its cases (`Rule.noRead`). The output then shows "no read" with the
|
|
801
|
+
* status, so the part does not show as a pass. The status does not change.
|
|
802
|
+
*/
|
|
803
|
+
readonly noRead?: string;
|
|
793
804
|
}
|
|
794
805
|
/** The result of `runChecks`. */
|
|
795
806
|
interface CheckResult {
|
|
@@ -838,7 +849,8 @@ export declare function formatResult(result: CheckResult): string;
|
|
|
838
849
|
export declare function summaryMarkdown(result: CheckResult): string;
|
|
839
850
|
/**
|
|
840
851
|
* This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request.
|
|
841
|
-
* A break of a rule that only warns gives a `::warning` command.
|
|
852
|
+
* A break of a rule that only warns gives a `::warning` command. A rule with no read of a part gives a `::warning` command
|
|
853
|
+
* with the reason.
|
|
842
854
|
*/
|
|
843
855
|
export declare function annotations(result: CheckResult): string;
|
|
844
856
|
/** This function gives the text of `--list`: each rule, its reason, its fix, its options, its state and its audit sources. */
|
|
@@ -867,8 +879,18 @@ interface PrePushOptions {
|
|
|
867
879
|
* With no URL, the command asks `git remote get-url`.
|
|
868
880
|
*/
|
|
869
881
|
readonly url?: string;
|
|
870
|
-
/**
|
|
882
|
+
/**
|
|
883
|
+
* The standard input of the hook: a line `<local ref> <local sha> <remote ref> <remote sha>` for each ref of the push.
|
|
884
|
+
* The command does not read it when `base` has a value.
|
|
885
|
+
*/
|
|
871
886
|
readonly input: string;
|
|
887
|
+
/**
|
|
888
|
+
* The base commit of a change, for a check in CI. With a base, the command examines each commit of `base..head`, not
|
|
889
|
+
* the refs of `input`. It also examines the title and the body of the pull request of the run (`pullRequestOfRun`).
|
|
890
|
+
*/
|
|
891
|
+
readonly base?: string;
|
|
892
|
+
/** The last commit of the change of `base`. The default is `HEAD`. */
|
|
893
|
+
readonly head?: string;
|
|
872
894
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
873
895
|
/** The root of the working tree. A relative path of the private name list starts at the root. */
|
|
874
896
|
readonly root: string;
|
|
@@ -882,6 +904,10 @@ interface PrePushOptions {
|
|
|
882
904
|
* that it adds or changes, and each line that it adds. It writes the breaks to `stderr`, and gives the exit code: 1 on a
|
|
883
905
|
* break, 0 on a pass. With no private name list and no private pattern, it writes the line `NO_READ_LINE` and gives 0.
|
|
884
906
|
* The settings can name more than one list (`privateNamesFiles`). The command then examines the merge of the lists.
|
|
907
|
+
*
|
|
908
|
+
* With the option `base`, the command is the check of a change in CI. It examines each commit of `base..head` with
|
|
909
|
+
* the same rules, and the title and the body of the pull request of the run. A message then tells that the check fails,
|
|
910
|
+
* not that the push stops.
|
|
885
911
|
*/
|
|
886
912
|
export declare function prePush(options: PrePushOptions, io: Pick<CliIo, "stderr">): number;
|
|
887
913
|
/** The marker line of the hook that `conventions hook install` writes. The command rewrites only a hook with this line. */
|
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-after-cancel.ts","../src/rules/gate-trigger.ts","../src/rules/security-one-job.ts","../src/rules/setup-cue.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.ts","../src/map.ts","../src/rules/home-module.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/coverage-provider.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/private-names.ts","../src/rules/no-local-paths.ts","../src/rules/pack-no-buildinfo.ts","../src/rules/publish-text-safe.ts","../src/rules/exports-require.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/site-check-in-ci.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/job-fails.ts","../src/rules/playwright-install.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.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/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.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;;WAEA;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;qBAG3C;;UAGI;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;;;;;WAKjC;;;;;;;WAOA;EACT,MAAM,SAAS,aAAa,SAAS,UAAU;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/rule.ts","../src/config.ts","../src/rules/cue-preset.ts","../src/rules/gate-after-cancel.ts","../src/rules/gate-trigger.ts","../src/rules/security-one-job.ts","../src/rules/setup-cue.ts","../src/rules/shared-ci.ts","../src/rules/service-run-main.ts","../src/map.ts","../src/rules/home-module.ts","../src/rules/home-package.ts","../src/rules/license-file.ts","../src/rules/coverage-provider.ts","../src/rules/main-check.ts","../src/rules/no-build-output.ts","../src/private-names.ts","../src/rules/no-local-paths.ts","../src/rules/pack-no-buildinfo.ts","../src/rules/publish-text-safe.ts","../src/rules/exports-require.ts","../src/rules/api-report-script.ts","../src/rules/pages-after-release.ts","../src/rules/pages-site.ts","../src/rules/site-check-in-ci.ts","../src/rules/pinned-git-deps.ts","../src/rules/pipe-fails.ts","../src/rules/job-fails.ts","../src/rules/playwright-install.ts","../src/rules/push-main-only.ts","../src/rules/unreleased-change.ts","../src/rules/published-minor.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/version-title.ts","../src/rules/workflow-parses.ts","../src/rules/workspace-protocol.ts","../src/rules/index.ts","../src/run.ts","../src/pre-push.ts","../src/home-exports.ts","../src/workflow.ts","../src/release-text.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;;WAEA;;EAET;;EAEA,IAAI;;;KAIM,uBAAuB;WAAqB;;;qBAG3C;;UAGI;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,kBAAkB;;WAElB,SAAS,SAAS,eAAe;;;;;WAKjC;;;;;;;WAOA;EACT,MAAM,SAAS,aAAa,SAAS,UAAU;;;;;;EAM/C,QAAQ,SAAS,aAAa,SAAS;;;qBAO5B;;wBAGG,aAAa,UAAU,UAAU;;wBA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;WAET;;;qBAIE;;wBAwEG,OAAO,yBAAyB,IAAI;;qBChXvC;;UAGI;;WAEN;;;;;WAKA;;;;;WAKA;;;;;WAKA;;WAEA;WACA,KAAK,SAAS;;WAEd;;WAEA,MAAM;;WAEN,YAAY;;;;;;;;;;;;wBA0MP,QAAQ,SAAS,gBAAgB,IAAI,KAAK;;qBA6G7C;;;;;;;;qBAgCA;;UAgBI;;WAEN;WACA,KAAK,SAAS;;WAEd,MAAM;;;;;;;wBAQD,YAAY,SAAS,aAAa,IAAI,KAAK;;qBCxa9C,cAAc,SAAS;WAA0B;WAA0B;;UCuIvE;WACN;WACA;WACA;;WAEA;WACA;;;UAIM;;WAEN;;WAEA;;WAEA;;;UAIM;WACN;WACA;WACA;WACA,gBAAgB;;;UAIV;;WAEN;;WAEA;;WAEA;;WAEA;WACA,iBAAiB;WACjB,eAAe;;;wBAgGV,aAAa,cAAc,eAAe;;;;;;;wBAmD1C,WAAW,cAAc,eAAe;;;;;;;;qBC1T3C;;wBAGG,QAAQ,cAAc,iBAAiB;;;;;;;;wBAavC,iBAAiB,kBAAkB,iBAAiB;;wBA+BpD,OAAO,cAAc;;;;;wBAQrB,aAAa,cAAc,iBAAiB"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as unreleasedChangeRule, $n as hasFile, $t as licenseFileOf, A as typedFiles, An as callsSharedCi, At as privateNamesFiles, B as roadmapParses, Bn as convertGate, Bt as mergePrivateNames, C as versionTitle, Cn as runCalls, Ct as HOME_PATTERNS, D as typedScripts, Dn as SHARED_ACTIONS, Dt as invalidPatternBreaks, E as trustPolicy, En as tsconfigTest, Et as PRIVATE_PATTERNS_VARIABLE, F as HOME_TIMEOUT_MS, Fn as SECURITY_TIMEOUT_MINUTES, Ft as firstNameMatch, G as publishedMinor, Gn as readAction, Gt as REAL_COMPARE, H as releaseFiles, Hn as prPathFilters, Ht as parsePrivateNames, I as blockHash, In as securityCallers, It as isAllowedHit, J as NPM_REGISTRY, Jn as cuePreset, Jt as coverageProvider, K as publishedMinorRule, Kn as readWorkflow, Kt as hasImportMetaMain, L as githubFetch, Ln as securityOneJob, Lt as isCommonUse, M as isSourcePath, Mn as setupCue, Mt as privateTextBreaks, N as pathsOf, Nn as SECURITY_SCAN_COMMIT, Nt as PRIVATE_NAME_LIST, O as configsOfScript, On as SHARED_CI, Ot as noLocalPaths, P as sourceMain, Pn as SECURITY_SCAN_INPUTS, Pt as PrivateNameListError, Q as unreleasedChange, Qn as codePackages, Qt as licenseFile, R as sharedDocsRule, Rn as withOneJob, Rt as lineNameHit, S as setVersions, Sn as SERVICE_PACKAGE, St as DEFAULT_ALLOWED, T as TRAIN_SCOPES, Tn as hasTests, Tt as PRIVATE_NAMES_FILE_VARIABLE, U as lockedVersions, Un as summaryName, Ut as pathNameHit, V as requiredScripts, Vn as gateTrigger, Vt as nameMatches, W as minorOf, Wn as gateAfterCancel, Wt as noBuildOutput, X as UNSHIPPED_FILES, Xn as RULE_WARN_DAYS, Xt as LICENSE_TEXTS, Y as SHIPPED_FIELDS, Yn as DEPENDENCY_FIELDS, Yt as apiReportScript, Z as npmLookup, Zn as cleanPath, Zt as authorOf, _ as workspaceProtocol, _n as mapText, _t as pagesCalls, a as listRules, an as modulesOf, ar as readJsonc, at as swallowsTests, b as yamlFaults, bn as npmNames, bt as publishTextSafe, c as runCli, cn as messageOf, cr as specifiersOf, ct as isPinned, d as HOOK_MARKER, dn as signaturesOf, dt as pagesAfterRelease, en as mitText, er as inFolder, et as playwrightInstall, f as NO_READ_LINE, fn as HOME_EXPORTS, ft as repositoryOfRemote, g as RULES, gn as mapMarkdown, gt as PAGES_WORKFLOWS, h as prePush, hn as findHomes, ht as pushMainOnly, i as formatResult, in as moduleUses, ir as parseJsonc, it as startsTests, j as testsRequired, jn as sharedCi, jt as privatePatterns, k as scriptsOf, kn as SHARED_WORKFLOWS, kt as privateNamesFile, l as runFix, ln as repoOf, lr as defaultOptions, lt as pinnedGitDeps, m as installHook, mn as MAP_RULE, mt as scheduleMinute, n as annotations, nn as homeModule, nr as lineOf, nt as jobFails, o as readConfig, on as declaredName, or as replaceLine, ot as pipeFails, p as PRE_PUSH_HOOK, pn as HOMES, pt as runnerBudget, q as reachOf, qn as STRICT_OPTIONS, qt as mainCheck, r as createContext, rn as moduleMessage, rr as matchesAny, rt as parseAdvisory, s as runChecks, sn as homePackage, sr as runGit, st as isGitSpecifier, t as USAGE, tn as repositoryIsPublic, tr as keyLine, tt as hiddenFailures, u as summaryMarkdown, un as reposOf, ur as parseConfig, ut as siteCheckInCi, v as GITHUB_YAML, vn as mergeHomes, vt as pagesSite, w as IGNORE_AFTER, wn as serviceRunMain, wt as PRIVATE_NAMES_FILE_CONFIG, x as namedVersions, xn as readOverlay, xt as packNoBuildinfo, y as workflowParses, yn as npmDrift, yt as exportsRequire, z as roadmapOfLine, zn as ACTIONS_COMMIT, zt as lineNameHits } from "./run-
|
|
1
|
+
import { $ as unreleasedChangeRule, $n as hasFile, $t as licenseFileOf, A as typedFiles, An as callsSharedCi, At as privateNamesFiles, B as roadmapParses, Bn as convertGate, Bt as mergePrivateNames, C as versionTitle, Cn as runCalls, Ct as HOME_PATTERNS, D as typedScripts, Dn as SHARED_ACTIONS, Dt as invalidPatternBreaks, E as trustPolicy, En as tsconfigTest, Et as PRIVATE_PATTERNS_VARIABLE, F as HOME_TIMEOUT_MS, Fn as SECURITY_TIMEOUT_MINUTES, Ft as firstNameMatch, G as publishedMinor, Gn as readAction, Gt as REAL_COMPARE, H as releaseFiles, Hn as prPathFilters, Ht as parsePrivateNames, I as blockHash, In as securityCallers, It as isAllowedHit, J as NPM_REGISTRY, Jn as cuePreset, Jt as coverageProvider, K as publishedMinorRule, Kn as readWorkflow, Kt as hasImportMetaMain, L as githubFetch, Ln as securityOneJob, Lt as isCommonUse, M as isSourcePath, Mn as setupCue, Mt as privateTextBreaks, N as pathsOf, Nn as SECURITY_SCAN_COMMIT, Nt as PRIVATE_NAME_LIST, O as configsOfScript, On as SHARED_CI, Ot as noLocalPaths, P as sourceMain, Pn as SECURITY_SCAN_INPUTS, Pt as PrivateNameListError, Q as unreleasedChange, Qn as codePackages, Qt as licenseFile, R as sharedDocsRule, Rn as withOneJob, Rt as lineNameHit, S as setVersions, Sn as SERVICE_PACKAGE, St as DEFAULT_ALLOWED, T as TRAIN_SCOPES, Tn as hasTests, Tt as PRIVATE_NAMES_FILE_VARIABLE, U as lockedVersions, Un as summaryName, Ut as pathNameHit, V as requiredScripts, Vn as gateTrigger, Vt as nameMatches, W as minorOf, Wn as gateAfterCancel, Wt as noBuildOutput, X as UNSHIPPED_FILES, Xn as RULE_WARN_DAYS, Xt as LICENSE_TEXTS, Y as SHIPPED_FIELDS, Yn as DEPENDENCY_FIELDS, Yt as apiReportScript, Z as npmLookup, Zn as cleanPath, Zt as authorOf, _ as workspaceProtocol, _n as mapText, _t as pagesCalls, a as listRules, an as modulesOf, ar as readJsonc, at as swallowsTests, b as yamlFaults, bn as npmNames, bt as publishTextSafe, c as runCli, cn as messageOf, cr as specifiersOf, ct as isPinned, d as HOOK_MARKER, dn as signaturesOf, dt as pagesAfterRelease, en as mitText, er as inFolder, et as playwrightInstall, f as NO_READ_LINE, fn as HOME_EXPORTS, ft as repositoryOfRemote, g as RULES, gn as mapMarkdown, gt as PAGES_WORKFLOWS, h as prePush, hn as findHomes, ht as pushMainOnly, i as formatResult, in as moduleUses, ir as parseJsonc, it as startsTests, j as testsRequired, jn as sharedCi, jt as privatePatterns, k as scriptsOf, kn as SHARED_WORKFLOWS, kt as privateNamesFile, l as runFix, ln as repoOf, lr as defaultOptions, lt as pinnedGitDeps, m as installHook, mn as MAP_RULE, mt as scheduleMinute, n as annotations, nn as homeModule, nr as lineOf, nt as jobFails, o as readConfig, on as declaredName, or as replaceLine, ot as pipeFails, p as PRE_PUSH_HOOK, pn as HOMES, pt as runnerBudget, q as reachOf, qn as STRICT_OPTIONS, qt as mainCheck, r as createContext, rn as moduleMessage, rr as matchesAny, rt as parseAdvisory, s as runChecks, sn as homePackage, sr as runGit, st as isGitSpecifier, t as USAGE, tn as repositoryIsPublic, tr as keyLine, tt as hiddenFailures, u as summaryMarkdown, un as reposOf, ur as parseConfig, ut as siteCheckInCi, v as GITHUB_YAML, vn as mergeHomes, vt as pagesSite, w as IGNORE_AFTER, wn as serviceRunMain, wt as PRIVATE_NAMES_FILE_CONFIG, x as namedVersions, xn as readOverlay, xt as packNoBuildinfo, y as workflowParses, yn as npmDrift, yt as exportsRequire, z as roadmapOfLine, zn as ACTIONS_COMMIT, zt as lineNameHits } from "./run-PzdziLsV.js";
|
|
2
2
|
import { OWNERS, ownerOf, ownersOf, sharedNames } from "./owners.js";
|
|
3
3
|
import { i as packageFolders, n as globFolders, r as globToRegExp, s as workspaceGlobs } from "./workspace-Cx7p7bWn.js";
|
|
4
4
|
// src/release-text.ts
|
|
@@ -97,6 +97,8 @@ function replaceLine(text, line, lines) {
|
|
|
97
97
|
}
|
|
98
98
|
/** The days from the release of a new rule to its day `failsFrom`, at the least. In this time the owners fix the breaks. */
|
|
99
99
|
const RULE_WARN_DAYS = 14;
|
|
100
|
+
/** This function tells if the environment is a CI run: `CI` is `true` or `1`, or `GITHUB_ACTIONS` is `true`. */
|
|
101
|
+
const isCi = (env) => ["true", "1"].includes((env["CI"] ?? "").toLowerCase()) || env["GITHUB_ACTIONS"] === "true";
|
|
100
102
|
/** The fields of `package.json` that hold dependencies. */
|
|
101
103
|
const DEPENDENCY_FIELDS = [
|
|
102
104
|
"dependencies",
|
|
@@ -14302,6 +14304,10 @@ const noLocalPaths = {
|
|
|
14302
14304
|
}
|
|
14303
14305
|
for (const change of changeTexts(context)) add(textBreaks(change.name, change.text, matchers, {}));
|
|
14304
14306
|
return breaks;
|
|
14307
|
+
},
|
|
14308
|
+
noRead(context) {
|
|
14309
|
+
if (!isCi(context.env) || privatePatterns(context.env).length > 0) return void 0;
|
|
14310
|
+
return `CI gives no ${PRIVATE_PATTERNS_VARIABLE}, so the rule did not look for private names. It looked only for home folders and the patterns of its options.`;
|
|
14305
14311
|
}
|
|
14306
14312
|
};
|
|
14307
14313
|
// src/tsconfig.ts
|
|
@@ -19621,9 +19627,15 @@ function repoOfPush(options) {
|
|
|
19621
19627
|
* that it adds or changes, and each line that it adds. It writes the breaks to `stderr`, and gives the exit code: 1 on a
|
|
19622
19628
|
* break, 0 on a pass. With no private name list and no private pattern, it writes the line `NO_READ_LINE` and gives 0.
|
|
19623
19629
|
* The settings can name more than one list (`privateNamesFiles`). The command then examines the merge of the lists.
|
|
19630
|
+
*
|
|
19631
|
+
* With the option `base`, the command is the check of a change in CI. It examines each commit of `base..head` with
|
|
19632
|
+
* the same rules, and the title and the body of the pull request of the run. A message then tells that the check fails,
|
|
19633
|
+
* not that the push stops.
|
|
19624
19634
|
*/
|
|
19625
19635
|
function prePush(options, io) {
|
|
19626
19636
|
const readFile = options.readFile ?? ((path) => readFileSync(path, "utf8"));
|
|
19637
|
+
const change = options.base !== void 0;
|
|
19638
|
+
const stops = change ? "The check fails." : "The push stops.";
|
|
19627
19639
|
const files = privateNamesFiles(options.env, options.git);
|
|
19628
19640
|
const patterns = privatePatterns(options.env);
|
|
19629
19641
|
if (files.length === 0 && patterns.length === 0) {
|
|
@@ -19640,14 +19652,14 @@ function prePush(options, io) {
|
|
|
19640
19652
|
try {
|
|
19641
19653
|
text = readFile(resolve(options.root, file));
|
|
19642
19654
|
} catch (error) {
|
|
19643
|
-
io.stderr(`conventions pre-push: Cannot read ${which}: ${readReason(error)}. Correct the setting or the file.
|
|
19655
|
+
io.stderr(`conventions pre-push: Cannot read ${which}: ${readReason(error)}. Correct the setting or the file. ${stops}\n`);
|
|
19644
19656
|
return 1;
|
|
19645
19657
|
}
|
|
19646
19658
|
try {
|
|
19647
19659
|
lists.push(parsePrivateNames(text));
|
|
19648
19660
|
} catch (error) {
|
|
19649
19661
|
const reason = error instanceof PrivateNameListError ? error.reason : "the parse failed";
|
|
19650
|
-
io.stderr(`conventions pre-push: ${which.charAt(0).toUpperCase()}${which.slice(1)} is not valid: ${reason}. Correct the file.
|
|
19662
|
+
io.stderr(`conventions pre-push: ${which.charAt(0).toUpperCase()}${which.slice(1)} is not valid: ${reason}. Correct the file. ${stops}\n`);
|
|
19651
19663
|
return 1;
|
|
19652
19664
|
}
|
|
19653
19665
|
}
|
|
@@ -19655,7 +19667,7 @@ function prePush(options, io) {
|
|
|
19655
19667
|
names = mergePrivateNames(lists);
|
|
19656
19668
|
} catch (error) {
|
|
19657
19669
|
const reason = error instanceof PrivateNameListError ? error.reason : "the merge failed";
|
|
19658
|
-
io.stderr(`conventions pre-push: The private name lists that ${source} names are not valid together: ${reason}. Give each name its own id.
|
|
19670
|
+
io.stderr(`conventions pre-push: The private name lists that ${source} names are not valid together: ${reason}. Give each name its own id. ${stops}\n`);
|
|
19659
19671
|
return 1;
|
|
19660
19672
|
}
|
|
19661
19673
|
}
|
|
@@ -19667,7 +19679,21 @@ function prePush(options, io) {
|
|
|
19667
19679
|
const home = homeSettings(options.root, readFile);
|
|
19668
19680
|
const breaks = invalidPatternBreaks(patterns);
|
|
19669
19681
|
const commits = /* @__PURE__ */ new Set();
|
|
19670
|
-
|
|
19682
|
+
if (options.base !== void 0) {
|
|
19683
|
+
const head = options.head ?? "HEAD";
|
|
19684
|
+
const listed = options.git([
|
|
19685
|
+
"rev-list",
|
|
19686
|
+
head,
|
|
19687
|
+
`^${options.base}`,
|
|
19688
|
+
"--"
|
|
19689
|
+
]);
|
|
19690
|
+
if (listed === void 0) {
|
|
19691
|
+
io.stderr(`conventions pre-push: git cannot list the commits of ${options.base}..${head}. ${stops}\n`);
|
|
19692
|
+
return 1;
|
|
19693
|
+
}
|
|
19694
|
+
for (const sha of listed.split(/\r?\n/)) if (SHA.test(sha.trim())) commits.add(sha.trim());
|
|
19695
|
+
}
|
|
19696
|
+
for (const line of change ? [] : options.input.split(/\r?\n/)) {
|
|
19671
19697
|
if (line.trim() === "") continue;
|
|
19672
19698
|
const [localRef, localSha, , remoteSha] = line.trim().split(/\s+/);
|
|
19673
19699
|
if (localSha === void 0 || remoteSha === void 0 || !SHA.test(localSha) || !SHA.test(remoteSha)) {
|
|
@@ -19684,7 +19710,9 @@ function prePush(options, io) {
|
|
|
19684
19710
|
const listed = ZERO.test(remoteSha) ? options.git(others) : options.git([
|
|
19685
19711
|
"rev-list",
|
|
19686
19712
|
localSha,
|
|
19687
|
-
|
|
19713
|
+
"--not",
|
|
19714
|
+
remoteSha,
|
|
19715
|
+
`--remotes=${options.remote}`
|
|
19688
19716
|
]) ?? options.git(others);
|
|
19689
19717
|
if (listed === void 0) {
|
|
19690
19718
|
io.stderr(`conventions pre-push: git cannot list the new commits of ${localRef ?? localSha}. The push stops.\n`);
|
|
@@ -19696,22 +19724,34 @@ function prePush(options, io) {
|
|
|
19696
19724
|
for (const sha of commits) {
|
|
19697
19725
|
const read = readCommit(sha, privates, home, repo, options.git);
|
|
19698
19726
|
if (read === void 0) {
|
|
19699
|
-
io.stderr(`conventions pre-push: git cannot show the commit ${sha.slice(0, 12)}.
|
|
19727
|
+
io.stderr(`conventions pre-push: git cannot show the commit ${sha.slice(0, 12)}. ${stops}\n`);
|
|
19700
19728
|
return 1;
|
|
19701
19729
|
}
|
|
19702
19730
|
for (const item of read.breaks) breaks.push(item);
|
|
19703
19731
|
lines += read.lines;
|
|
19704
19732
|
}
|
|
19733
|
+
const pullRequest = change ? pullRequestOfRun(options.env) : void 0;
|
|
19734
|
+
let texts = 0;
|
|
19735
|
+
for (const [name, text] of [["pull request title", pullRequest?.title], ["pull request body", pullRequest?.body]]) {
|
|
19736
|
+
if (text === void 0) continue;
|
|
19737
|
+
texts += 1;
|
|
19738
|
+
for (const item of privateTextBreaks(name, text, privates, {
|
|
19739
|
+
allow: home.allow,
|
|
19740
|
+
homes: home.on
|
|
19741
|
+
})) breaks.push(item);
|
|
19742
|
+
lines += text === "" ? 0 : text.replace(/\r?\n$/, "").split(/\r?\n/).length;
|
|
19743
|
+
}
|
|
19744
|
+
const read = `${String(commits.size)} commits${texts > 0 ? " and the text of the pull request" : ""}, ${String(lines)} lines read`;
|
|
19705
19745
|
if (breaks.length === 0) {
|
|
19706
|
-
io.stderr(`conventions pre-push: ${
|
|
19746
|
+
io.stderr(`conventions pre-push: ${read}, 0 breaks.\n`);
|
|
19707
19747
|
return 0;
|
|
19708
19748
|
}
|
|
19709
|
-
const out = [`conventions pre-push: ${
|
|
19749
|
+
const out = [`conventions pre-push: ${read}, ${String(breaks.length)} breaks. ${stops}`];
|
|
19710
19750
|
for (const item of breaks) {
|
|
19711
19751
|
out.push(` ${placeOf$1(item)} ${item.message}`);
|
|
19712
19752
|
if (item.fix !== void 0) out.push(` fix: ${item.fix}`);
|
|
19713
19753
|
}
|
|
19714
|
-
out.push("Change the commits (git commit --amend, or git rebase), and push again.");
|
|
19754
|
+
out.push(change ? "Remove each text from the commits (git commit --amend, or git rebase) and from the pull request. Then push again." : "Change the commits (git commit --amend, or git rebase), and push again.");
|
|
19715
19755
|
io.stderr(`${out.join("\n")}\n`);
|
|
19716
19756
|
return 1;
|
|
19717
19757
|
}
|
|
@@ -19749,8 +19789,6 @@ if [ -x "$bin" ] && node -e 'let v;try{v=JSON.parse(require("fs").readFileSync(p
|
|
|
19749
19789
|
fi
|
|
19750
19790
|
exec pnpm dlx @mark1russell7/conventions@${ownVersion()} pre-push "$@"
|
|
19751
19791
|
`;
|
|
19752
|
-
/** This function tells if the environment is a CI run. */
|
|
19753
|
-
const isCi = (env) => ["true", "1"].includes((env["CI"] ?? "").toLowerCase()) || env["GITHUB_ACTIONS"] === "true";
|
|
19754
19792
|
/**
|
|
19755
19793
|
* This function is the command `conventions hook install`. It writes the hook `pre-push` into the hooks folder of git,
|
|
19756
19794
|
* so it uses the folder of `core.hooksPath` and works in a worktree. It keeps a hook that does not have `HOOK_MARKER`, and writes a warning.
|
|
@@ -19921,12 +19959,19 @@ function runChecks(options) {
|
|
|
19921
19959
|
const warns = breaks.length > 0 && rule.failsFrom !== void 0 && today < rule.failsFrom;
|
|
19922
19960
|
const reason = warns ? [ruleConfig.reason, `The rule fails from ${rule.failsFrom ?? ""}.`].filter((text) => text !== void 0).join(" ") : ruleConfig.reason;
|
|
19923
19961
|
const note = reason === void 0 ? {} : { note: reason };
|
|
19962
|
+
let noRead;
|
|
19963
|
+
try {
|
|
19964
|
+
noRead = rule.noRead?.(context, ruleConfig.options);
|
|
19965
|
+
} catch (error) {
|
|
19966
|
+
noRead = `the rule cannot tell what it read: ${error instanceof Error ? error.message : String(error)}`;
|
|
19967
|
+
}
|
|
19924
19968
|
results.push({
|
|
19925
19969
|
...base,
|
|
19926
19970
|
status: breaks.length === 0 ? "pass" : warns ? "warn" : "break",
|
|
19927
19971
|
breaks,
|
|
19928
19972
|
ignored,
|
|
19929
|
-
...note
|
|
19973
|
+
...note,
|
|
19974
|
+
...noRead === void 0 ? {} : { noRead }
|
|
19930
19975
|
});
|
|
19931
19976
|
}
|
|
19932
19977
|
return {
|
|
@@ -19988,7 +20033,8 @@ const placeOf = (item) => item.line === void 0 ? item.file : `${item.file}:${ite
|
|
|
19988
20033
|
function formatResult(result) {
|
|
19989
20034
|
const count = (status) => result.rules.filter((rule) => rule.status === status).length;
|
|
19990
20035
|
const breaks = result.rules.filter((rule) => rule.status === "break").reduce((sum, rule) => sum + rule.breaks.length, 0);
|
|
19991
|
-
const
|
|
20036
|
+
const noReads = result.rules.filter((rule) => rule.noRead !== void 0).length;
|
|
20037
|
+
const out = [`conventions: ${result.rules.length} rules: ${count("pass")} pass, ${count("break")} with ${breaks} break(s), ${count("warn")} warn, ${count("off")} off, ${count("skipped")} skipped, ${count("error")} error(s)${noReads > 0 ? `, ${noReads} with no read` : ""}.`, ""];
|
|
19992
20038
|
const label = {
|
|
19993
20039
|
pass: "pass ",
|
|
19994
20040
|
break: "BREAK",
|
|
@@ -20000,6 +20046,7 @@ function formatResult(result) {
|
|
|
20000
20046
|
for (const rule of result.rules) {
|
|
20001
20047
|
const extra = rule.ignored > 0 ? ` (${rule.ignored} ignored: ${rule.note ?? ""})` : rule.note !== void 0 && rule.status !== "pass" ? ` (${rule.note})` : "";
|
|
20002
20048
|
out.push(`${label[rule.status]} ${rule.id}${rule.breaks.length > 0 ? `: ${rule.breaks.length} break(s)` : ""}${extra}`);
|
|
20049
|
+
if (rule.noRead !== void 0) out.push(` NO READ: ${rule.noRead}`);
|
|
20003
20050
|
for (const item of rule.breaks.slice(0, MAX_SHOWN)) {
|
|
20004
20051
|
out.push(` ${placeOf(item)} ${item.message}${(item.edits ?? []).length > 0 ? " (conventions fix writes the fix)" : ""}`);
|
|
20005
20052
|
if (item.fix !== void 0) out.push(` fix: ${item.fix}`);
|
|
@@ -20023,7 +20070,8 @@ function summaryMarkdown(result) {
|
|
|
20023
20070
|
for (const rule of result.rules) {
|
|
20024
20071
|
const shown = rule.status === "break" ? `${rule.breaks.length} break(s)` : rule.status === "warn" ? `warn: ${rule.breaks.length} break(s)` : rule.status;
|
|
20025
20072
|
const note = rule.ignored > 0 ? `${rule.ignored} ignored: ${rule.note ?? ""}` : rule.note ?? "";
|
|
20026
|
-
|
|
20073
|
+
const noRead = rule.noRead === void 0 ? "" : `no read: ${rule.noRead}`;
|
|
20074
|
+
out.push(`| \`${rule.id}\` | ${shown}${noRead === "" ? "" : ", no read"} | ${cell([noRead, note].filter((text) => text !== "").join(" "))} |`);
|
|
20027
20075
|
}
|
|
20028
20076
|
const broken = result.rules.filter((rule) => rule.breaks.length > 0);
|
|
20029
20077
|
for (const rule of broken) {
|
|
@@ -20039,13 +20087,17 @@ const escapeData = (text) => text.replace(/%/g, "%25").replace(/\r/g, "%0D").rep
|
|
|
20039
20087
|
const escapeProperty = (text) => escapeData(text).replace(/:/g, "%3A").replace(/,/g, "%2C");
|
|
20040
20088
|
/**
|
|
20041
20089
|
* This function gives an `::error` workflow command for each break, so that GitHub shows each break on its line in the pull request.
|
|
20042
|
-
* A break of a rule that only warns gives a `::warning` command.
|
|
20090
|
+
* A break of a rule that only warns gives a `::warning` command. A rule with no read of a part gives a `::warning` command
|
|
20091
|
+
* with the reason.
|
|
20043
20092
|
*/
|
|
20044
20093
|
function annotations(result) {
|
|
20045
20094
|
const out = [];
|
|
20046
|
-
for (const rule of result.rules)
|
|
20047
|
-
|
|
20048
|
-
|
|
20095
|
+
for (const rule of result.rules) {
|
|
20096
|
+
if (rule.noRead !== void 0) out.push(`::warning title=${escapeProperty(`conventions ${rule.id}`)}::${escapeData(`No read: ${rule.noRead}`)}`);
|
|
20097
|
+
for (const item of rule.breaks) {
|
|
20098
|
+
const line = item.line === void 0 ? "" : `,line=${item.line}`;
|
|
20099
|
+
out.push(`::${rule.status === "warn" ? "warning" : "error"} file=${escapeProperty(item.file)}${line},title=${escapeProperty(`conventions ${rule.id}`)}::${escapeData(`${item.message} Fix: ${item.fix ?? rule.fix}`)}`);
|
|
20100
|
+
}
|
|
20049
20101
|
}
|
|
20050
20102
|
return out.length === 0 ? "" : `${out.join("\n")}\n`;
|
|
20051
20103
|
}
|
|
@@ -20072,6 +20124,7 @@ const USAGE = `Usage: conventions check [options]
|
|
|
20072
20124
|
conventions --list
|
|
20073
20125
|
conventions map [words] [--markdown | --json] [--overlay <file>]
|
|
20074
20126
|
conventions pre-push <remote> [<url>]
|
|
20127
|
+
conventions pre-push --base <ref> [--head <ref>]
|
|
20075
20128
|
conventions hook install
|
|
20076
20129
|
|
|
20077
20130
|
check Start each rule. Exit code 1 when a rule has a break.
|
|
@@ -20084,7 +20137,10 @@ const USAGE = `Usage: conventions check [options]
|
|
|
20084
20137
|
lines. Exit code 1 on a break. The list is the JSON file of CONVENTIONS_PRIVATE_NAMES_FILE, else
|
|
20085
20138
|
of the git config conventions.privateNamesFile. CONVENTIONS_PRIVATE_PATTERNS adds one regular
|
|
20086
20139
|
expression on each line. With neither, it writes a "No read" line and gives 0.
|
|
20087
|
-
|
|
20140
|
+
With --base, it is the check of a change in CI. It examines each commit of <base>..<head>
|
|
20141
|
+
(the default head is HEAD) with the same rules, and the title and the body of the pull
|
|
20142
|
+
request of the run. It reads no standard input.
|
|
20143
|
+
hook install Write the hook pre-push into the hooks folder of git. It keeps a hook that it did not write.
|
|
20088
20144
|
In CI, or outside a git repository, it does nothing.
|
|
20089
20145
|
|
|
20090
20146
|
--root <folder> The root of the repository. The default is the current folder.
|
|
@@ -20260,20 +20316,41 @@ function runMap(args, io) {
|
|
|
20260
20316
|
else io.stdout(mapText(found));
|
|
20261
20317
|
return 0;
|
|
20262
20318
|
}
|
|
20263
|
-
/**
|
|
20319
|
+
/**
|
|
20320
|
+
* The command `pre-push`: the arguments of the git hook, the remote and its URL. Or the options `--base` and `--head` of
|
|
20321
|
+
* the check of a change in CI. Then the remote is `origin`.
|
|
20322
|
+
*/
|
|
20264
20323
|
function runPrePush(args, io) {
|
|
20265
|
-
const
|
|
20266
|
-
|
|
20267
|
-
|
|
20324
|
+
const positional = [];
|
|
20325
|
+
const range = {};
|
|
20326
|
+
let usage = false;
|
|
20327
|
+
for (let index = 0; index < args.length; index++) {
|
|
20328
|
+
const arg = args[index] ?? "";
|
|
20329
|
+
if (arg === "--base" || arg === "--head") {
|
|
20330
|
+
const value = args[++index];
|
|
20331
|
+
if (value === void 0 || value === "" || value.startsWith("-")) usage = true;
|
|
20332
|
+
else range[arg === "--base" ? "base" : "head"] = value;
|
|
20333
|
+
} else if (arg.startsWith("-")) usage = true;
|
|
20334
|
+
else positional.push(arg);
|
|
20335
|
+
}
|
|
20336
|
+
const { base, head } = range;
|
|
20337
|
+
const remote = base === void 0 ? positional[0] : "origin";
|
|
20338
|
+
if (usage || remote === void 0 || (base === void 0 ? head !== void 0 || positional.length > 2 : positional.length > 0)) {
|
|
20339
|
+
io.stderr(`conventions: The command pre-push takes the name of the remote and, after it, its URL. In CI, it takes --base <ref> and, as an option, --head <ref>.\n\n${USAGE}`);
|
|
20268
20340
|
return 2;
|
|
20269
20341
|
}
|
|
20270
20342
|
const top = runGit(io.cwd, ["rev-parse", "--show-toplevel"])?.trim() ?? "";
|
|
20271
20343
|
const root = top === "" ? io.cwd : top;
|
|
20272
|
-
const url =
|
|
20344
|
+
const url = base === void 0 ? positional[1] : void 0;
|
|
20345
|
+
const change = base === void 0 ? {} : {
|
|
20346
|
+
base,
|
|
20347
|
+
...head === void 0 ? {} : { head }
|
|
20348
|
+
};
|
|
20273
20349
|
return prePush({
|
|
20274
20350
|
remote,
|
|
20275
20351
|
...url === void 0 ? {} : { url },
|
|
20276
|
-
|
|
20352
|
+
...change,
|
|
20353
|
+
input: base === void 0 ? io.stdin ?? "" : "",
|
|
20277
20354
|
env: io.env,
|
|
20278
20355
|
root,
|
|
20279
20356
|
git: (gitArgs) => runGit(root, gitArgs)
|
|
@@ -20293,4 +20370,4 @@ function runHook(args, io) {
|
|
|
20293
20370
|
}
|
|
20294
20371
|
export { unreleasedChangeRule as $, hasFile as $n, licenseFileOf as $t, typedFiles as A, callsSharedCi as An, privateNamesFiles as At, roadmapParses as B, convertGate as Bn, mergePrivateNames as Bt, versionTitle as C, runCalls as Cn, HOME_PATTERNS as Ct, typedScripts as D, SHARED_ACTIONS as Dn, invalidPatternBreaks as Dt, trustPolicy as E, tsconfigTest as En, PRIVATE_PATTERNS_VARIABLE as Et, HOME_TIMEOUT_MS as F, SECURITY_TIMEOUT_MINUTES as Fn, firstNameMatch as Ft, publishedMinor as G, readAction as Gn, REAL_COMPARE as Gt, releaseFiles as H, prPathFilters as Hn, parsePrivateNames as Ht, blockHash as I, securityCallers as In, isAllowedHit as It, NPM_REGISTRY as J, cuePreset as Jn, coverageProvider as Jt, publishedMinorRule as K, readWorkflow as Kn, hasImportMetaMain as Kt, githubFetch as L, securityOneJob as Ln, isCommonUse as Lt, isSourcePath as M, setupCue as Mn, privateTextBreaks as Mt, pathsOf as N, SECURITY_SCAN_COMMIT as Nn, PRIVATE_NAME_LIST as Nt, configsOfScript as O, SHARED_CI as On, noLocalPaths as Ot, sourceMain as P, SECURITY_SCAN_INPUTS as Pn, PrivateNameListError as Pt, unreleasedChange as Q, codePackages as Qn, licenseFile as Qt, sharedDocsRule as R, withOneJob as Rn, lineNameHit as Rt, setVersions as S, SERVICE_PACKAGE as Sn, DEFAULT_ALLOWED as St, TRAIN_SCOPES as T, hasTests as Tn, PRIVATE_NAMES_FILE_VARIABLE as Tt, lockedVersions as U, summaryName as Un, pathNameHit as Ut, requiredScripts as V, gateTrigger as Vn, nameMatches as Vt, minorOf as W, gateAfterCancel as Wn, noBuildOutput as Wt, UNSHIPPED_FILES as X, RULE_WARN_DAYS as Xn, LICENSE_TEXTS as Xt, SHIPPED_FIELDS as Y, DEPENDENCY_FIELDS as Yn, apiReportScript as Yt, npmLookup as Z, cleanPath as Zn, authorOf as Zt, workspaceProtocol as _, mapText as _n, pagesCalls as _t, listRules as a, modulesOf as an, readJsonc as ar, swallowsTests as at, yamlFaults as b, npmNames as bn, publishTextSafe as bt, runCli as c, messageOf as cn, specifiersOf as cr, isPinned as ct, HOOK_MARKER as d, signaturesOf as dn, pagesAfterRelease as dt, mitText as en, inFolder as er, playwrightInstall as et, NO_READ_LINE as f, HOME_EXPORTS as fn, repositoryOfRemote as ft, RULES as g, mapMarkdown as gn, PAGES_WORKFLOWS as gt, prePush as h, findHomes as hn, pushMainOnly as ht, formatResult as i, moduleUses as in, parseJsonc as ir, startsTests as it, testsRequired as j, sharedCi as jn, privatePatterns as jt, scriptsOf as k, SHARED_WORKFLOWS as kn, privateNamesFile as kt, runFix as l, repoOf as ln, defaultOptions as lr, pinnedGitDeps as lt, installHook as m, MAP_RULE as mn, scheduleMinute as mt, annotations as n, homeModule as nn, lineOf as nr, jobFails as nt, readConfig as o, declaredName as on, replaceLine as or, pipeFails as ot, PRE_PUSH_HOOK as p, HOMES as pn, runnerBudget as pt, reachOf as q, STRICT_OPTIONS as qn, mainCheck as qt, createContext as r, moduleMessage as rn, matchesAny as rr, parseAdvisory as rt, runChecks as s, homePackage as sn, runGit as sr, isGitSpecifier as st, USAGE as t, repositoryIsPublic as tn, keyLine as tr, hiddenFailures as tt, summaryMarkdown as u, reposOf as un, parseConfig as ur, siteCheckInCi as ut, GITHUB_YAML as v, mergeHomes as vn, pagesSite as vt, IGNORE_AFTER as w, serviceRunMain as wn, PRIVATE_NAMES_FILE_CONFIG as wt, namedVersions as x, readOverlay as xn, packNoBuildinfo as xt, workflowParses as y, npmDrift as yn, exportsRequire as yt, roadmapOfLine as z, ACTIONS_COMMIT as zn, lineNameHits as zt };
|
|
20295
20372
|
|
|
20296
|
-
//# sourceMappingURL=run-
|
|
20373
|
+
//# sourceMappingURL=run-PzdziLsV.js.map
|