@mark1russell7/conventions 0.50.0 → 0.50.2

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 CHANGED
@@ -291,10 +291,10 @@ An overlay file has the shape `{ "homes": [...] }`. A home of the overlay takes
291
291
  The repositories have more than one owner: the personal account and an organization. Each owner is a GitHub account with its own pool of concurrent jobs. `OWNERS` gives the login, the kind, the plan and the pool of each owner. A reader of all repositories reads each owner, and a gate of the runners keeps one lane for each owner. Thus no reader names an owner in its code.
292
292
 
293
293
  ```ts
294
- import { OWNERS, ownersOf, sharedNames } from "@mark1russell7/conventions/owners";
294
+ import { OWNERS, ownersOf, repoKeyer, sharedNames } from "@mark1russell7/conventions/owners";
295
295
  ```
296
296
 
297
- The subpath `@mark1russell7/conventions/owners` has no import, so a workflow with a sparse checkout and no install can import its source. `ownersOf(value)` reads a list of logins with commas, and gives each owner for an empty list. `sharedNames(repos)` gives each repository name that two owners have. A reader that keys its records by the name stops on such a name.
297
+ The subpath `@mark1russell7/conventions/owners` has no import, so a workflow with a sparse checkout and no install can import its source. `ownersOf(value)` reads a list of logins with commas, and gives each owner for an empty list. `sharedNames(repos)` gives each repository name that two owners have. `repoKeyer(repos)` gives the record key of each repository: the name when one owner has the name, and `owner/name` when two owners have it. Thus a reader that keys its records by the name keeps its old keys, and two repositories with one name become two records. A second argument sets the separator: `repoKeyer(repos, "~")` gives `owner~name`, for a key in a file name or a database id.
298
298
 
299
299
  ## Add a rule
300
300
 
@@ -312,7 +312,7 @@ The package also exports the functions of the tool:
312
312
  - `replaceLine(text, line, lines)` gives the text with one line replaced, for the edits of a rule.
313
313
  - `formatResult(result)`, `summaryMarkdown(result)`, `annotations(result)` and `listRules(config)` give the output.
314
314
  - `parseConfig(value, rules)` and `readConfig(root)` read the field `conventions`. `parseRuleConfig(value, rule)` reads the entry of one rule, and not the other entries.
315
- - `OWNERS` is the list of the owners, with `ownerOf(login)`, `ownersOf(value)` and `sharedNames(repos)`. The subpath `@mark1russell7/conventions/owners` gives them and no other code.
315
+ - `OWNERS` is the list of the owners, with `ownerOf(login)`, `ownersOf(value)`, `sharedNames(repos)` and `repoKeyer(repos, separator)`. The subpath `@mark1russell7/conventions/owners` gives them and no other code.
316
316
  - `HOMES` is the map of homes. `findHomes(query)` finds the homes of words, and `mapMarkdown(homes)` and `mapText(homes)` write them. `readOverlay(file)` and `mergeHomes(base, extra)` add more homes.
317
317
  - `tagName(name, version, packageCount)` gives the git tag of a version. `releaseNotes(name, version, changelog)` gives the text of its GitHub release, with `changelogSection`, `npmUrl` and `MAX_NOTES`. The script `scripts/release/tags.ts` keeps the same rule, and a test compares the two.
318
318
  - `RULES` and each rule, with the helpers `isGitSpecifier`, `isPinned`, `isSourcePath` and `parseJsonc`.
package/build/index.d.ts CHANGED
@@ -12,7 +12,7 @@
12
12
  * conventions hook install
13
13
  * ```
14
14
  */
15
- import { OWNERS, Owner, ownerOf, ownersOf, sharedNames } from "./owners.js";
15
+ import { OWNERS, Owner, RepoRef, ownerOf, ownersOf, repoKeyer, sharedNames } from "./owners.js";
16
16
  import { a as parseWorkspaceGlobs, i as packageFolders, n as globToRegExp, r as isWorkspaceFolder, s as workspaceGlobs, t as globFolders } from "./workspace-BjoLngtR.js";
17
17
  import "@mark1russell7/text/redact";
18
18
  /** A row of the invariants audit that a rule comes from: the repository, the id of the rule in that audit, and the document line. */
@@ -1146,5 +1146,5 @@ export declare function npmUrl(name: string, version: string): string;
1146
1146
  * link to npm. The Releases page of `site-pages` reads each list item as a change.
1147
1147
  */
1148
1148
  export declare function releaseNotes(name: string, version: string, changelog: string | undefined): string;
1149
- export { type Advisory, type AllowedHit, type AuditSource, type Break, type CheckOptions, type CheckResult, type CliIo, type ConventionsConfig, type Edit, type FixResult, type HiddenFailure, type Home, type HomeAnswer, type HomeFetch, type HomeModule, type HomeState, type HookOptions, type LinePlace, type Manifest, type Minor, type ModuleUse, type NameHit, type NameRule, type NpmDrift, type NpmDriftKind, type NpmPresence, OWNERS, type OptionSpec, type OptionValue, type Options, type Owner, type PackageInfo, type PagesCall, type ParsedJob, type ParsedStep, type ParsedWorkflow, type PathFilter, type PrePushArgs, type PrePushOptions, type PrivateNameList, type PrivatePattern, type PrivateSources, type RegistryAnswer, type RegistryLookup, type Rule, type RuleConfig, type RuleContext, type RuleOutcome, type RuleResult, type SecurityCaller, type SummaryJob, type TextBreakOptions, type Workflow, type WorkflowInput, type WorkflowJob, type WorkflowPermissions, type WorkflowStep, type YamlFault, globFolders, globToRegExp, isWorkspaceFolder, ownerOf, ownersOf, packageFolders, parseWorkspaceGlobs, sharedNames, workspaceGlobs };
1149
+ export { type Advisory, type AllowedHit, type AuditSource, type Break, type CheckOptions, type CheckResult, type CliIo, type ConventionsConfig, type Edit, type FixResult, type HiddenFailure, type Home, type HomeAnswer, type HomeFetch, type HomeModule, type HomeState, type HookOptions, type LinePlace, type Manifest, type Minor, type ModuleUse, type NameHit, type NameRule, type NpmDrift, type NpmDriftKind, type NpmPresence, OWNERS, type OptionSpec, type OptionValue, type Options, type Owner, type PackageInfo, type PagesCall, type ParsedJob, type ParsedStep, type ParsedWorkflow, type PathFilter, type PrePushArgs, type PrePushOptions, type PrivateNameList, type PrivatePattern, type PrivateSources, type RegistryAnswer, type RegistryLookup, type RepoRef, type Rule, type RuleConfig, type RuleContext, type RuleOutcome, type RuleResult, type SecurityCaller, type SummaryJob, type TextBreakOptions, type Workflow, type WorkflowInput, type WorkflowJob, type WorkflowPermissions, type WorkflowStep, type YamlFault, globFolders, globToRegExp, isWorkspaceFolder, ownerOf, ownersOf, packageFolders, parseWorkspaceGlobs, repoKeyer, sharedNames, workspaceGlobs };
1150
1150
  //# sourceMappingURL=index.d.ts.map
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as unreleasedChange, $n as readAction, $t as licenseFileOf, A as scriptsOf, An as callsSharedCi, At as privateNamesFiles, B as roadmapOfLine, Bn as SECURITY_TIMEOUT_MINUTES, Bt as mergePrivateNames, C as setVersions, Cn as runCalls, Cr as parseConfig, Ct as HOME_PATTERNS, D as trustPolicy, Dn as SHARED_ACTIONS, Dt as invalidPatternBreaks, E as TRAIN_SCOPES, En as tsconfigTest, Et as PRIVATE_PATTERNS_VARIABLE, F as sourceMain, Fn as hasSummaryJob, Ft as firstNameMatch, G as minorOf, Gn as convertGate, Gt as REAL_COMPARE, H as requiredScripts, Hn as securityOneJob, Ht as parsePrivateNames, I as HOME_TIMEOUT_MS, In as startsOnPullRequest, It as isAllowedHit, J as reachOf, Jn as skippableJobs, Jt as coverageProvider, K as publishedMinor, Kn as gateTrigger, Kt as hasImportMetaMain, L as blockHash, Ln as summaryJobRule, Lt as isCommonUse, M as testsRequired, Mn as setupCue, Mt as privateTextBreaks, N as isSourcePath, Nn as SUMMARY_GATES, Nt as PRIVATE_NAME_LIST, O as typedScripts, On as SHARED_CI, Ot as noLocalPaths, P as pathsOf, Pn as addSummaryJob, Pt as PrivateNameListError, Q as npmLookup, Qn as parseWorkflow, Qt as licenseFile, R as githubFetch, Rn as SECURITY_SCAN_COMMIT, Rt as lineNameHit, S as namedVersions, Sn as SERVICE_PACKAGE, Sr as defaultOptions, St as DEFAULT_ALLOWED, T as IGNORE_AFTER, Tn as hasTests, Tt as PRIVATE_NAMES_FILE_VARIABLE, U as releaseFiles, Un as withOneJob, Ut as pathNameHit, V as roadmapParses, Vn as securityCallers, Vt as nameMatches, W as lockedVersions, Wn as ACTIONS_COMMIT, Wt as noBuildOutput, X as SHIPPED_FIELDS, Xn as summaryName, Xt as LICENSE_TEXTS, Y as NPM_REGISTRY, Yn as summaryJob, Yt as apiReportScript, Z as UNSHIPPED_FILES, Zn as gateAfterCancel, Zt as authorOf, _ as runPrePushArgs, _n as mapText, _r as repositoryOfRemote, _t as pagesCalls, a as listRules, an as modulesOf, ar as RULE_WARN_DAYS, at as startsTests, b as GITHUB_YAML, bn as npmNames, br as showFiles, bt as publishTextSafe, c as runCli, cn as messageOf, cr as hasFile, ct as isGitSpecifier, d as HOOK_MARKER, dn as signaturesOf, dr as lineOf, dt as siteCheckInCi, en as mitText, er as readWorkflow, et as unreleasedChangeRule, f as NO_READ_LINE, fn as HOME_EXPORTS, fr as matchesAny, ft as pagesAfterRelease, g as prePush, gn as mapMarkdown, gr as replaceLine, gt as PAGES_WORKFLOWS, h as parsePrePushArgs, hn as findHomes, hr as readJsonc, ht as pushMainOnly, i as formatResult, in as moduleUses, ir as DEPENDENCY_FIELDS, it as parseAdvisory, j as typedFiles, jn as sharedCi, jt as privatePatterns, k as configsOfScript, kn as SHARED_WORKFLOWS, kt as privateNamesFile, l as runFix, ln as repoOf, lr as inFolder, lt as isPinned, m as installHook, mn as MAP_RULE, mr as parseJsonc, mt as scheduleMinute, n as annotations, nn as homeModule, nr as STRICT_OPTIONS, nt as hiddenFailures, o as readConfig, on as declaredName, or as cleanPath, ot as swallowsTests, p as PRE_PUSH_HOOK, pn as HOMES, pr as parseCatFileBatch, pt as runnerBudget, q as publishedMinorRule, qn as prPathFilters, qt as mainCheck, r as createContext, rn as moduleMessage, rr as cuePreset, rt as jobFails, s as runChecks, sn as homePackage, sr as codePackages, st as pipeFails, t as USAGE, tn as repositoryIsPublic, tr as yamlFaults, tt as playwrightInstall, u as summaryMarkdown, un as reposOf, ur as keyLine, ut as pinnedGitDeps, v as RULES, vn as mergeHomes, vr as runGit, vt as pagesSite, w as versionTitle, wn as serviceRunMain, wr as parseRuleConfig, wt as PRIVATE_NAMES_FILE_CONFIG, x as workflowParses, xn as readOverlay, xr as specifiersOf, xt as packNoBuildinfo, y as workspaceProtocol, yn as npmDrift, yr as runGitShow, yt as exportsRequire, z as sharedDocsRule, zn as SECURITY_SCAN_INPUTS, zt as lineNameHits } from "./run-DNe9I3-M.js";
2
- import { OWNERS, ownerOf, ownersOf, sharedNames } from "./owners.js";
2
+ import { OWNERS, ownerOf, ownersOf, repoKeyer, sharedNames } from "./owners.js";
3
3
  import { a as packageFolders, i as isWorkspaceFolder, l as workspaceGlobs, n as globFolders, o as parseWorkspaceGlobs, r as globToRegExp } from "./workspace-_CIq-8ei.js";
4
4
  // src/release-text.ts
5
5
  /**
@@ -66,6 +66,6 @@ function releaseNotes(name, version, changelog) {
66
66
  if (section.length <= 1e5) return section;
67
67
  return `${section.slice(0, MAX_NOTES)}\n\n(The CHANGELOG.md of \`${name}\` has the full text.)`;
68
68
  }
69
- export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, OWNERS, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, RULE_WARN_DAYS, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, SUMMARY_GATES, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, addSummaryJob, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, coverageProvider, createContext, cuePreset, declaredName, defaultOptions, exportsRequire, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasSummaryJob, hasTests, hiddenFailures, homeModule, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, isWorkspaceFolder, jobFails, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, mergePrivateNames, messageOf, minorOf, mitText, moduleMessage, moduleUses, modulesOf, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmDrift, npmLookup, npmNames, npmUrl, ownerOf, ownersOf, packNoBuildinfo, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseAdvisory, parseCatFileBatch, parseConfig, parseJsonc, parsePrePushArgs, parsePrivateNames, parseRuleConfig, parseWorkflow, parseWorkspaceGlobs, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, playwrightInstall, prPathFilters, prePush, privateNamesFile, privateNamesFiles, privatePatterns, privateTextBreaks, publishTextSafe, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readAction, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoOf, reposOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runGitShow, runPrePushArgs, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, setupCue, sharedCi, sharedDocsRule, sharedNames, showFiles, signaturesOf, siteCheckInCi, skippableJobs, sourceMain, specifiersOf, startsOnPullRequest, startsTests, summaryJob, summaryJobRule, summaryMarkdown, summaryName, swallowsTests, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
69
+ export { ACTIONS_COMMIT, DEFAULT_ALLOWED, DEPENDENCY_FIELDS, GITHUB_YAML, HOMES, HOME_EXPORTS, HOME_PATTERNS, HOME_TIMEOUT_MS, HOOK_MARKER, IGNORE_AFTER, LICENSE_TEXTS, MAP_RULE, MAX_NOTES, NO_READ_LINE, NPM_REGISTRY, OWNERS, PAGES_WORKFLOWS, PRE_PUSH_HOOK, PRIVATE_NAMES_FILE_CONFIG, PRIVATE_NAMES_FILE_VARIABLE, PRIVATE_NAME_LIST, PRIVATE_PATTERNS_VARIABLE, PrivateNameListError, REAL_COMPARE, RULES, RULE_WARN_DAYS, SECURITY_SCAN_COMMIT, SECURITY_SCAN_INPUTS, SECURITY_TIMEOUT_MINUTES, SERVICE_PACKAGE, SHARED_ACTIONS, SHARED_CI, SHARED_WORKFLOWS, SHIPPED_FIELDS, STRICT_OPTIONS, SUMMARY_GATES, TRAIN_SCOPES, UNSHIPPED_FILES, USAGE, addSummaryJob, annotations, apiReportScript, authorOf, blockHash, callsSharedCi, changelogSection, cleanPath, codePackages, configsOfScript, convertGate, coverageProvider, createContext, cuePreset, declaredName, defaultOptions, exportsRequire, findHomes, firstNameMatch, formatResult, gateAfterCancel, gateTrigger, githubFetch, globFolders, globToRegExp, hasFile, hasImportMetaMain, hasSummaryJob, hasTests, hiddenFailures, homeModule, homePackage, inFolder, installHook, invalidPatternBreaks, isAllowedHit, isCommonUse, isGitSpecifier, isPinned, isSourcePath, isWorkspaceFolder, jobFails, keyLine, licenseFile, licenseFileOf, lineNameHit, lineNameHits, lineOf, listRules, lockedVersions, mainCheck, mapMarkdown, mapText, matchesAny, mergeHomes, mergePrivateNames, messageOf, minorOf, mitText, moduleMessage, moduleUses, modulesOf, nameMatches, namedVersions, noBuildOutput, noLocalPaths, npmDrift, npmLookup, npmNames, npmUrl, ownerOf, ownersOf, packNoBuildinfo, packageFolders, pagesAfterRelease, pagesCalls, pagesSite, parseAdvisory, parseCatFileBatch, parseConfig, parseJsonc, parsePrePushArgs, parsePrivateNames, parseRuleConfig, parseWorkflow, parseWorkspaceGlobs, pathNameHit, pathsOf, pinnedGitDeps, pipeFails, playwrightInstall, prPathFilters, prePush, privateNamesFile, privateNamesFiles, privatePatterns, privateTextBreaks, publishTextSafe, publishedMinor, publishedMinorRule, pushMainOnly, reachOf, readAction, readConfig, readJsonc, readOverlay, readWorkflow, releaseFiles, releaseNotes, replaceLine, repoKeyer, repoOf, reposOf, repositoryIsPublic, repositoryOfRemote, requiredScripts, roadmapOfLine, roadmapParses, runCalls, runChecks, runCli, runFix, runGit, runGitShow, runPrePushArgs, runnerBudget, scheduleMinute, scriptsOf, securityCallers, securityOneJob, serviceRunMain, setVersions, setupCue, sharedCi, sharedDocsRule, sharedNames, showFiles, signaturesOf, siteCheckInCi, skippableJobs, sourceMain, specifiersOf, startsOnPullRequest, startsTests, summaryJob, summaryJobRule, summaryMarkdown, summaryName, swallowsTests, tagName, testsRequired, trustPolicy, tsconfigTest, typedFiles, typedScripts, unreleasedChange, unreleasedChangeRule, versionTitle, withOneJob, workflowParses, workspaceGlobs, workspaceProtocol, yamlFaults };
70
70
 
71
71
  //# sourceMappingURL=index.js.map
package/build/owners.d.ts CHANGED
@@ -27,11 +27,27 @@ export declare function ownerOf(login: string): Owner | undefined;
27
27
  /** This function reads a list of logins with commas. An empty value gives the login of each owner of `OWNERS`. */
28
28
  export declare function ownersOf(value: string | undefined): string[];
29
29
  /**
30
- * This function gives each repository name that more than one owner has, in lower case and in order. A reader that keys
31
- * its records by the name of the repository must stop on such a name, because the two repositories become one record.
30
+ * This function gives each repository name that more than one owner has, in lower case and in order. If a reader keys its
31
+ * records by the name alone, the two repositories of such a name become one record. Thus the reader takes its keys from
32
+ * `repoKeyer`.
32
33
  */
33
- export declare function sharedNames(repos: readonly {
34
+ export declare function sharedNames(repos: readonly RepoRef[]): string[];
35
+ /** A repository: the login of its owner and its name, as the API gives them. */
36
+ export interface RepoRef {
37
+ /** The login of the owner. */
34
38
  readonly owner: string;
39
+ /** The name of the repository. */
35
40
  readonly name: string;
36
- }[]): string[];
41
+ }
42
+ /**
43
+ * This function gives the record key of each repository of a list. The key is the name when one owner has the name, and
44
+ * `owner/name` when more than one owner has it (see `sharedNames`).
45
+ *
46
+ * - The records of a name that one owner has keep the key that they had before the second owner came.
47
+ * - Two repositories with one name become two records, so a fork in the other owner stops no reader.
48
+ * - The key of a repository that is not in the list is its name, unless the list has its name with more than one owner.
49
+ * - The separator is `/` by default. A key for a file name or a database id takes a separator that no login and no name has, for example `~`.
50
+ * - A separator that a login or a name can have gives an error, because two keys can then be equal.
51
+ */
52
+ export declare function repoKeyer(repos: readonly RepoRef[], separator?: string): (repo: RepoRef) => string;
37
53
  //# sourceMappingURL=owners.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"owners.d.ts","names":[],"sources":["../src/owners.ts"],"mappings":";;;;;;;iBAQiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;qBAOE,iBAAiB;;wBAMd,QAAQ,gBAAgB;;wBAKxB,SAAS;;;;;wBAYT,YAAY;WAA2B;WAAwB"}
1
+ {"version":3,"file":"owners.d.ts","names":[],"sources":["../src/owners.ts"],"mappings":";;;;;;;iBAQiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;qBAOE,iBAAiB;;wBAMd,QAAQ,gBAAgB;;wBAKxB,SAAS;;;;;;wBAaT,YAAY,gBAAgB;;iBAa3B;;WAEN;;WAEA;;;;;;;;;;;;wBAaK,UAAU,gBAAgB,WAAW,sBAA2B,MAAM"}
package/build/owners.js CHANGED
@@ -26,8 +26,9 @@ function ownersOf(value) {
26
26
  return named.length > 0 ? [...new Set(named)] : OWNERS.map((owner) => owner.login);
27
27
  }
28
28
  /**
29
- * This function gives each repository name that more than one owner has, in lower case and in order. A reader that keys
30
- * its records by the name of the repository must stop on such a name, because the two repositories become one record.
29
+ * This function gives each repository name that more than one owner has, in lower case and in order. If a reader keys its
30
+ * records by the name alone, the two repositories of such a name become one record. Thus the reader takes its keys from
31
+ * `repoKeyer`.
31
32
  */
32
33
  function sharedNames(repos) {
33
34
  const owners = /* @__PURE__ */ new Map();
@@ -37,6 +38,21 @@ function sharedNames(repos) {
37
38
  }
38
39
  return [...owners].filter(([, logins]) => logins.size > 1).map(([name]) => name).sort();
39
40
  }
40
- export { OWNERS, ownerOf, ownersOf, sharedNames };
41
+ /**
42
+ * This function gives the record key of each repository of a list. The key is the name when one owner has the name, and
43
+ * `owner/name` when more than one owner has it (see `sharedNames`).
44
+ *
45
+ * - The records of a name that one owner has keep the key that they had before the second owner came.
46
+ * - Two repositories with one name become two records, so a fork in the other owner stops no reader.
47
+ * - The key of a repository that is not in the list is its name, unless the list has its name with more than one owner.
48
+ * - The separator is `/` by default. A key for a file name or a database id takes a separator that no login and no name has, for example `~`.
49
+ * - A separator that a login or a name can have gives an error, because two keys can then be equal.
50
+ */
51
+ function repoKeyer(repos, separator = "/") {
52
+ if (separator === "" || /[A-Za-z0-9._-]/u.test(separator)) throw new Error(`The separator "${separator}" is empty or has a character that a login or a repository name can have.`);
53
+ const shared = new Set(sharedNames(repos));
54
+ return (repo) => shared.has(repo.name.toLowerCase()) ? `${repo.owner}${separator}${repo.name}` : repo.name;
55
+ }
56
+ export { OWNERS, ownerOf, ownersOf, repoKeyer, sharedNames };
41
57
 
42
58
  //# sourceMappingURL=owners.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"owners.js","names":[],"sources":["../src/owners.ts"],"sourcesContent":["/**\n * The owners of the repositories: the GitHub accounts that hold them. Each account has its own pool of concurrent jobs, so\n * a repository can move from one owner to the other. A reader of all repositories reads each owner, and a gate of the\n * runners keeps one lane for each owner. Thus no reader names an owner in its code. This file has no import, so a workflow\n * with a sparse checkout and no install can import it from the source.\n */\n\n/** A GitHub account that holds repositories. */\nexport interface Owner {\n /** The login of the account. */\n readonly login: string;\n /** The kind of the account. The path `users/<login>/repos` of the API lists the repositories of both kinds. */\n readonly kind: \"user\" | \"organization\";\n /** The plan of the account. */\n readonly plan: \"pro\" | \"team\";\n /** The concurrent jobs of the plan: 40 for GitHub Pro, 60 for an organization on GitHub Team. */\n readonly jobs: number;\n /** The concurrent macOS jobs of the plan. */\n readonly macos: number;\n}\n\n/**\n * The owners, the personal account first. The organization got the plan Team on 2026-11-16, with its own pool of 60 jobs.\n * An owner with no public repository adds no read.\n */\nexport const OWNERS: readonly Owner[] = [\n { login: \"mark1russell7\", kind: \"user\", plan: \"pro\", jobs: 40, macos: 5 },\n { login: \"metrograph-labs\", kind: \"organization\", plan: \"team\", jobs: 60, macos: 5 },\n];\n\n/** This function gives the owner with this login, with no regard to case, or undefined. */\nexport function ownerOf(login: string): Owner | undefined {\n return OWNERS.find((owner) => owner.login.toLowerCase() === login.toLowerCase());\n}\n\n/** This function reads a list of logins with commas. An empty value gives the login of each owner of `OWNERS`. */\nexport function ownersOf(value: string | undefined): string[] {\n const named = (value ?? \"\")\n .split(\",\")\n .map((login) => login.trim())\n .filter(Boolean);\n return named.length > 0 ? [...new Set(named)] : OWNERS.map((owner) => owner.login);\n}\n\n/**\n * This function gives each repository name that more than one owner has, in lower case and in order. A reader that keys\n * its records by the name of the repository must stop on such a name, because the two repositories become one record.\n */\nexport function sharedNames(repos: readonly { readonly owner: string; readonly name: string }[]): string[] {\n const owners = new Map<string, Set<string>>();\n for (const repo of repos) {\n const name = repo.name.toLowerCase();\n owners.set(name, (owners.get(name) ?? new Set<string>()).add(repo.owner.toLowerCase()));\n }\n return [...owners]\n .filter(([, logins]) => logins.size > 1)\n .map(([name]) => name)\n .sort();\n}\n"],"mappings":";;;;;AAyBA,MAAa,SAA2B,CACtC;CAAE,OAAO;CAAiB,MAAM;CAAQ,MAAM;CAAO,MAAM;CAAI,OAAO;AAAE,GACxE;CAAE,OAAO;CAAmB,MAAM;CAAgB,MAAM;CAAQ,MAAM;CAAI,OAAO;AAAE,CACrF;;AAGA,SAAgB,QAAQ,OAAkC;CACxD,OAAO,OAAO,MAAM,UAAU,MAAM,MAAM,YAAY,MAAM,MAAM,YAAY,CAAC;AACjF;;AAGA,SAAgB,SAAS,OAAqC;CAC5D,MAAM,SAAS,SAAS,GAAA,CACrB,MAAM,GAAG,CAAC,CACV,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;CACjB,OAAO,MAAM,SAAS,IAAI,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,OAAO,KAAK,UAAU,MAAM,KAAK;AACnF;;;;;AAMA,SAAgB,YAAY,OAA+E;CACzG,MAAM,yBAAS,IAAI,IAAyB;CAC5C,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,KAAK,KAAK,YAAY;EACnC,OAAO,IAAI,OAAO,OAAO,IAAI,IAAI,qBAAK,IAAI,IAAY,EAAA,CAAG,IAAI,KAAK,MAAM,YAAY,CAAC,CAAC;CACxF;CACA,OAAO,CAAC,GAAG,MAAM,CAAC,CACf,QAAQ,GAAG,YAAY,OAAO,OAAO,CAAC,CAAC,CACvC,KAAK,CAAC,UAAU,IAAI,CAAC,CACrB,KAAK;AACV"}
1
+ {"version":3,"file":"owners.js","names":[],"sources":["../src/owners.ts"],"sourcesContent":["/**\n * The owners of the repositories: the GitHub accounts that hold them. Each account has its own pool of concurrent jobs, so\n * a repository can move from one owner to the other. A reader of all repositories reads each owner, and a gate of the\n * runners keeps one lane for each owner. Thus no reader names an owner in its code. This file has no import, so a workflow\n * with a sparse checkout and no install can import it from the source.\n */\n\n/** A GitHub account that holds repositories. */\nexport interface Owner {\n /** The login of the account. */\n readonly login: string;\n /** The kind of the account. The path `users/<login>/repos` of the API lists the repositories of both kinds. */\n readonly kind: \"user\" | \"organization\";\n /** The plan of the account. */\n readonly plan: \"pro\" | \"team\";\n /** The concurrent jobs of the plan: 40 for GitHub Pro, 60 for an organization on GitHub Team. */\n readonly jobs: number;\n /** The concurrent macOS jobs of the plan. */\n readonly macos: number;\n}\n\n/**\n * The owners, the personal account first. The organization got the plan Team on 2026-11-16, with its own pool of 60 jobs.\n * An owner with no public repository adds no read.\n */\nexport const OWNERS: readonly Owner[] = [\n { login: \"mark1russell7\", kind: \"user\", plan: \"pro\", jobs: 40, macos: 5 },\n { login: \"metrograph-labs\", kind: \"organization\", plan: \"team\", jobs: 60, macos: 5 },\n];\n\n/** This function gives the owner with this login, with no regard to case, or undefined. */\nexport function ownerOf(login: string): Owner | undefined {\n return OWNERS.find((owner) => owner.login.toLowerCase() === login.toLowerCase());\n}\n\n/** This function reads a list of logins with commas. An empty value gives the login of each owner of `OWNERS`. */\nexport function ownersOf(value: string | undefined): string[] {\n const named = (value ?? \"\")\n .split(\",\")\n .map((login) => login.trim())\n .filter(Boolean);\n return named.length > 0 ? [...new Set(named)] : OWNERS.map((owner) => owner.login);\n}\n\n/**\n * This function gives each repository name that more than one owner has, in lower case and in order. If a reader keys its\n * records by the name alone, the two repositories of such a name become one record. Thus the reader takes its keys from\n * `repoKeyer`.\n */\nexport function sharedNames(repos: readonly RepoRef[]): string[] {\n const owners = new Map<string, Set<string>>();\n for (const repo of repos) {\n const name = repo.name.toLowerCase();\n owners.set(name, (owners.get(name) ?? new Set<string>()).add(repo.owner.toLowerCase()));\n }\n return [...owners]\n .filter(([, logins]) => logins.size > 1)\n .map(([name]) => name)\n .sort();\n}\n\n/** A repository: the login of its owner and its name, as the API gives them. */\nexport interface RepoRef {\n /** The login of the owner. */\n readonly owner: string;\n /** The name of the repository. */\n readonly name: string;\n}\n\n/**\n * This function gives the record key of each repository of a list. The key is the name when one owner has the name, and\n * `owner/name` when more than one owner has it (see `sharedNames`).\n *\n * - The records of a name that one owner has keep the key that they had before the second owner came.\n * - Two repositories with one name become two records, so a fork in the other owner stops no reader.\n * - The key of a repository that is not in the list is its name, unless the list has its name with more than one owner.\n * - The separator is `/` by default. A key for a file name or a database id takes a separator that no login and no name has, for example `~`.\n * - A separator that a login or a name can have gives an error, because two keys can then be equal.\n */\nexport function repoKeyer(repos: readonly RepoRef[], separator: string = \"/\"): (repo: RepoRef) => string {\n if (separator === \"\" || /[A-Za-z0-9._-]/u.test(separator)) {\n throw new Error(`The separator \"${separator}\" is empty or has a character that a login or a repository name can have.`);\n }\n const shared = new Set(sharedNames(repos));\n return (repo) => (shared.has(repo.name.toLowerCase()) ? `${repo.owner}${separator}${repo.name}` : repo.name);\n}\n"],"mappings":";;;;;AAyBA,MAAa,SAA2B,CACtC;CAAE,OAAO;CAAiB,MAAM;CAAQ,MAAM;CAAO,MAAM;CAAI,OAAO;AAAE,GACxE;CAAE,OAAO;CAAmB,MAAM;CAAgB,MAAM;CAAQ,MAAM;CAAI,OAAO;AAAE,CACrF;;AAGA,SAAgB,QAAQ,OAAkC;CACxD,OAAO,OAAO,MAAM,UAAU,MAAM,MAAM,YAAY,MAAM,MAAM,YAAY,CAAC;AACjF;;AAGA,SAAgB,SAAS,OAAqC;CAC5D,MAAM,SAAS,SAAS,GAAA,CACrB,MAAM,GAAG,CAAC,CACV,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;CACjB,OAAO,MAAM,SAAS,IAAI,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,IAAI,OAAO,KAAK,UAAU,MAAM,KAAK;AACnF;;;;;;AAOA,SAAgB,YAAY,OAAqC;CAC/D,MAAM,yBAAS,IAAI,IAAyB;CAC5C,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,KAAK,KAAK,YAAY;EACnC,OAAO,IAAI,OAAO,OAAO,IAAI,IAAI,qBAAK,IAAI,IAAY,EAAA,CAAG,IAAI,KAAK,MAAM,YAAY,CAAC,CAAC;CACxF;CACA,OAAO,CAAC,GAAG,MAAM,CAAC,CACf,QAAQ,GAAG,YAAY,OAAO,OAAO,CAAC,CAAC,CACvC,KAAK,CAAC,UAAU,IAAI,CAAC,CACrB,KAAK;AACV;;;;;;;;;;;AAoBA,SAAgB,UAAU,OAA2B,YAAoB,KAAgC;CACvG,IAAI,cAAc,MAAM,kBAAkB,KAAK,SAAS,GACtD,MAAM,IAAI,MAAM,kBAAkB,UAAU,0EAA0E;CAExH,MAAM,SAAS,IAAI,IAAI,YAAY,KAAK,CAAC;CACzC,QAAQ,SAAU,OAAO,IAAI,KAAK,KAAK,YAAY,CAAC,IAAI,GAAG,KAAK,QAAQ,YAAY,KAAK,SAAS,KAAK;AACzG"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/conventions",
4
- "version": "0.50.0",
4
+ "version": "0.50.2",
5
5
  "description": "One check in CI for the conventions of a pnpm workspace that docs tell in prose: pinned git dependencies, source packages, tsconfig.test.json, no build output in git and more.",
6
6
  "keywords": [
7
7
  "conventions",