@mark1russell7/conventions 0.50.1 → 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 +2 -2
- package/build/owners.d.ts +3 -1
- package/build/owners.d.ts.map +1 -1
- package/build/owners.js +5 -2
- package/build/owners.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,7 +294,7 @@ The repositories have more than one owner: the personal account and an organizat
|
|
|
294
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. `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.
|
|
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)`, `sharedNames(repos)` and `repoKeyer(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/owners.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface RepoRef {
|
|
|
46
46
|
* - The records of a name that one owner has keep the key that they had before the second owner came.
|
|
47
47
|
* - Two repositories with one name become two records, so a fork in the other owner stops no reader.
|
|
48
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.
|
|
49
51
|
*/
|
|
50
|
-
export declare function repoKeyer(repos: readonly RepoRef[]): (repo: RepoRef) => string;
|
|
52
|
+
export declare function repoKeyer(repos: readonly RepoRef[], separator?: string): (repo: RepoRef) => string;
|
|
51
53
|
//# sourceMappingURL=owners.d.ts.map
|
package/build/owners.d.ts.map
CHANGED
|
@@ -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;;;;;;wBAaT,YAAY,gBAAgB;;iBAa3B;;WAEN;;WAEA
|
|
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
|
@@ -45,10 +45,13 @@ function sharedNames(repos) {
|
|
|
45
45
|
* - The records of a name that one owner has keep the key that they had before the second owner came.
|
|
46
46
|
* - Two repositories with one name become two records, so a fork in the other owner stops no reader.
|
|
47
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.
|
|
48
50
|
*/
|
|
49
|
-
function repoKeyer(repos) {
|
|
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.`);
|
|
50
53
|
const shared = new Set(sharedNames(repos));
|
|
51
|
-
return (repo) => shared.has(repo.name.toLowerCase()) ? `${repo.owner}
|
|
54
|
+
return (repo) => shared.has(repo.name.toLowerCase()) ? `${repo.owner}${separator}${repo.name}` : repo.name;
|
|
52
55
|
}
|
|
53
56
|
export { OWNERS, ownerOf, ownersOf, repoKeyer, sharedNames };
|
|
54
57
|
|
package/build/owners.js.map
CHANGED
|
@@ -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. 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 */\nexport function repoKeyer(repos: readonly RepoRef[]): (repo: RepoRef) => string {\n const shared = new Set(sharedNames(repos));\n return (repo) => (shared.has(repo.name.toLowerCase()) ? `${repo.owner}
|
|
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"],"mapp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G"}
|
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.
|
|
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",
|