@intellectual-frontiers/libraries 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/affected.d.ts +1 -1
- package/dist/dev.js +1 -1
- package/dist/imports/nist-sp-800-53.auto.prov.ttl +22 -0
- package/dist/imports/schema-org.auto.prov.ttl +22 -0
- package/dist/install-bun.js +1 -1
- package/dist/libraries.d.ts +34 -2
- package/dist/libraries.js +70 -9
- package/dist/license/PolyForm-Noncommercial-1.0.0.md +73 -0
- package/dist/link.d.ts +1 -1
- package/dist/link.js +4 -4
- package/dist/metapackages.d.ts +62 -0
- package/dist/metapackages.js +190 -0
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +1 -1
- package/dist/pack-library.d.ts +7 -0
- package/dist/pack-library.js +31 -56
- package/dist/pack-metapackage.d.ts +22 -0
- package/dist/pack-metapackage.js +147 -0
- package/dist/pins.d.ts +1 -1
- package/dist/pins.js +1 -1
- package/dist/readme.d.ts +13 -1
- package/dist/readme.js +42 -4
- package/dist/releasing.d.ts +8 -1
- package/dist/releasing.js +44 -14
- package/dist/workflows/definitions.d.ts +2 -2
- package/dist/workflows/definitions.js +31 -113
- package/dist/workflows/model.d.ts +2 -0
- package/dist/workflows/render.js +2 -0
- package/dist/workflows/schema/github-workflow.schema.json +2290 -0
- package/package.json +28 -13
- package/src/affected.ts +1 -1
- package/src/dev.ts +1 -1
- package/src/imports/nist-sp-800-53.auto.prov.ttl +22 -0
- package/src/imports/schema-org.auto.prov.ttl +22 -0
- package/src/install-bun.ts +1 -1
- package/src/libraries.ts +88 -8
- package/src/license/PolyForm-Noncommercial-1.0.0.md +73 -0
- package/src/link.ts +4 -4
- package/src/metapackages.ts +206 -0
- package/src/mod.ts +1 -1
- package/src/pack-library.ts +37 -53
- package/src/pack-metapackage.ts +137 -0
- package/src/pins.ts +1 -1
- package/src/readme.ts +46 -4
- package/src/releasing.ts +47 -16
- package/src/workflows/definitions.ts +34 -131
- package/src/workflows/model.ts +2 -0
- package/src/workflows/render.ts +1 -0
- package/src/workflows/schema/github-workflow.schema.json +2290 -0
package/dist/affected.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Library } from "./libraries.js";
|
|
2
2
|
/** What a library reads: its folder, the folders and files it takes from others, what it depends on, and the files it imports one by one. */
|
|
3
3
|
export type Inputs = {
|
|
4
|
-
/** The paths of the library's inputs: `commons/<name>/` and each folder (`commons/
|
|
4
|
+
/** The paths of the library's inputs: `commons/<name>/` and each folder (`commons/core/src/**`) or file the library takes from another. */
|
|
5
5
|
readonly paths: readonly string[];
|
|
6
6
|
/** The folders of commons that the library depends on through its package. */
|
|
7
7
|
readonly dependsOn: readonly string[];
|
package/dist/dev.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @remarks
|
|
13
13
|
* Nothing is installed per library. The repository's root installs the packages every library shares (`bun install`, once), the libraries are linked under `commons/node_modules` (a link for each folder whose package
|
|
14
|
-
* name is `@intellectual-frontiers/<folder
|
|
14
|
+
* name is `@intellectual-frontiers/<folder>`), so that a library that imports another by its package name reads the checkout's source, never a copy from a
|
|
15
15
|
* registry: the `exports` of each package are the sources. A library with a package of its own outside the shared set (a database driver) is installed in its folder, once. The affected libraries are those of
|
|
16
16
|
* `affected.ts` (the same code the workflow of CI runs); TypeScript 7 checks each library's own `tsconfig.json`, several at a time, and the tests of each run in a `bun test` process of its own, from its folder as `verify` runs them, several at a time.
|
|
17
17
|
*
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# AUTO-GENERATED with ../../../ontology/src/standards/nist-sp-800-53/controls.auto.ts by commons/mizan/src/integrations/pure/import-oscal-catalog.ts (commons 0019-mizan-integrations FR-009). Do not edit.
|
|
2
|
+
|
|
3
|
+
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
4
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
5
|
+
|
|
6
|
+
<urn:ifc:mizan:module:nist-sp-800-53> a prov:Entity ;
|
|
7
|
+
dcterms:source "../../../ontology/src/standards/nist-sp-800-53/controls.auto.ts" ;
|
|
8
|
+
prov:wasGeneratedBy <urn:ifc:mizan:import:nist-sp-800-53:64ca6b4161de51ab6af098a7d101d326f14c95e1abf721396cd8a049e8115eeb> ;
|
|
9
|
+
prov:wasDerivedFrom <urn:sha256:64ca6b4161de51ab6af098a7d101d326f14c95e1abf721396cd8a049e8115eeb> .
|
|
10
|
+
|
|
11
|
+
<urn:ifc:mizan:import:nist-sp-800-53:64ca6b4161de51ab6af098a7d101d326f14c95e1abf721396cd8a049e8115eeb> a prov:Activity ;
|
|
12
|
+
prov:used <urn:sha256:64ca6b4161de51ab6af098a7d101d326f14c95e1abf721396cd8a049e8115eeb> ;
|
|
13
|
+
prov:wasAssociatedWith <urn:ifc:mizan:generator:commons:mizan:src:integrations:pure:import-oscal-catalog.ts> .
|
|
14
|
+
|
|
15
|
+
<urn:ifc:mizan:generator:commons:mizan:src:integrations:pure:import-oscal-catalog.ts> a prov:SoftwareAgent .
|
|
16
|
+
|
|
17
|
+
<urn:sha256:64ca6b4161de51ab6af098a7d101d326f14c95e1abf721396cd8a049e8115eeb> a prov:Entity ;
|
|
18
|
+
dcterms:title "NIST SP 800-53 Rev. 5.2.0 (OSCAL catalog)" ;
|
|
19
|
+
dcterms:publisher "National Institute of Standards and Technology" ;
|
|
20
|
+
dcterms:hasVersion "5.2.0" ;
|
|
21
|
+
dcterms:source <https://raw.githubusercontent.com/usnistgov/oscal-content/f0de6d8d8c059d374f15e0ae07508d82e370fc1d/nist.gov/SP800-53/rev5/json/NIST_SP-800-53_rev5_catalog.json> ;
|
|
22
|
+
dcterms:license <https://spdx.org/licenses/Public domain (a work of the United States Government, 17 U.S.C. 105).html> .
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# AUTO-GENERATED with ../../../ontology/src/supply-chain/packaging/schema.auto.ts by commons/mizan/src/integrations/pure/import-vocabulary.ts (commons 0019-mizan-integrations FR-009). Do not edit.
|
|
2
|
+
|
|
3
|
+
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
4
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
5
|
+
|
|
6
|
+
<urn:ifc:mizan:module:schema-org> a prov:Entity ;
|
|
7
|
+
dcterms:source "../../../ontology/src/supply-chain/packaging/schema.auto.ts" ;
|
|
8
|
+
prov:wasGeneratedBy <urn:ifc:mizan:import:schema-org:7f15ca89398c4f235f478a4b3b8d1f975d63c5a860b77c8a8fce01f791b7ae2f> ;
|
|
9
|
+
prov:wasDerivedFrom <urn:sha256:7f15ca89398c4f235f478a4b3b8d1f975d63c5a860b77c8a8fce01f791b7ae2f> .
|
|
10
|
+
|
|
11
|
+
<urn:ifc:mizan:import:schema-org:7f15ca89398c4f235f478a4b3b8d1f975d63c5a860b77c8a8fce01f791b7ae2f> a prov:Activity ;
|
|
12
|
+
prov:used <urn:sha256:7f15ca89398c4f235f478a4b3b8d1f975d63c5a860b77c8a8fce01f791b7ae2f> ;
|
|
13
|
+
prov:wasAssociatedWith <urn:ifc:mizan:generator:commons:mizan:src:integrations:pure:import-vocabulary.ts> .
|
|
14
|
+
|
|
15
|
+
<urn:ifc:mizan:generator:commons:mizan:src:integrations:pure:import-vocabulary.ts> a prov:SoftwareAgent .
|
|
16
|
+
|
|
17
|
+
<urn:sha256:7f15ca89398c4f235f478a4b3b8d1f975d63c5a860b77c8a8fce01f791b7ae2f> a prov:Entity ;
|
|
18
|
+
dcterms:title "schema.org" ;
|
|
19
|
+
dcterms:publisher "Schema.org Community Group" ;
|
|
20
|
+
dcterms:hasVersion "30.1" ;
|
|
21
|
+
dcterms:source <https://schema.org/version/30.1/schemaorg-current-https.ttl> ;
|
|
22
|
+
dcterms:license <https://spdx.org/licenses/CC-BY-SA-3.0.html> .
|
package/dist/install-bun.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Bun at the version commons pins (its version, address, SHA-256, format and folder per platform in `commons/generated/pins.auto.env`, commons
|
|
3
|
-
* 0005-typescript-
|
|
3
|
+
* 0005-typescript-practice FR-026, 0002-packaging FR-019), fetched from that address with retries, kept only where its SHA-256 is the pinned one, unpacked by the
|
|
4
4
|
* kernel's own zip reader and put in a folder; nothing but IFC TypeScript itself, so it runs on Node 26 (or Bun) on Linux, macOS
|
|
5
5
|
* and Windows with no shell, no Python and no unzip. CI's `.github/actions/bun` runs it.
|
|
6
6
|
*
|
package/dist/libraries.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Result } from "@intellectual-frontiers/core";
|
|
1
|
+
import { type Brand, type Result } from "@intellectual-frontiers/core";
|
|
2
2
|
import { type SpdxId } from "./license/standard.js";
|
|
3
3
|
import { type Table } from "@intellectual-frontiers/kanon";
|
|
4
4
|
import { type LevelKey } from "@intellectual-frontiers/mizan/levels";
|
|
@@ -37,6 +37,35 @@ export type Library = {
|
|
|
37
37
|
readonly family?: LibraryFamily;
|
|
38
38
|
/** The license its `LICENSE` and its packed `package.json` carry, where it is not the default of the repository (`license/standard.ts`; commons 0035-licensing FR-003). */
|
|
39
39
|
readonly license?: SpdxId;
|
|
40
|
+
/** The constants of its sources that say its own version (`ERGONEX_VERSION`), each a file from the library's folder and the name of the constant: the release rewrites them with the version, and a check finds one that disagrees. */
|
|
41
|
+
readonly versionConstants?: readonly VersionConstant[];
|
|
42
|
+
/** The package the library publishes where it is not `@intellectual-frontiers/<name>` (the `data` library publishes `@intellectual-frontiers/arcactl`; commons 0036-distribution FR-009). */
|
|
43
|
+
readonly publishes?: PackageName;
|
|
44
|
+
/** Why the library is kept out of the release: it is verified and packed like any other, and has no release record entry, no tag, no set and no registry (FR-0xx of 0001-libraries). */
|
|
45
|
+
readonly held?: HeldReason;
|
|
46
|
+
/** The set the library is, where it is a metapackage: a folder with no code of its own whose package depends on the libraries of the set at exact versions (commons 0036-distribution FR-005). */
|
|
47
|
+
readonly bundle?: BundleName;
|
|
48
|
+
};
|
|
49
|
+
/** The reason a library is held out of the release: a non-empty sentence, made only by {@link parseHeldReason}. */
|
|
50
|
+
export type HeldReason = Brand<string, "held reason">;
|
|
51
|
+
/** A held reason from text, or why the text is not one. */
|
|
52
|
+
export declare function parseHeldReason(text: string): Result<HeldReason, string>;
|
|
53
|
+
/** The scope of the packages of commons. */
|
|
54
|
+
export declare const PACKAGE_SCOPE = "@intellectual-frontiers/";
|
|
55
|
+
/** The sets that a metapackage is: the whole of commons, and the four roles of the libraries; a closed union, and the name of the folder and of the package of each. */
|
|
56
|
+
export declare const BUNDLES: readonly ["commons", "foundation", "patterns", "programs", "standards"];
|
|
57
|
+
/** The name of a set of libraries a metapackage is. */
|
|
58
|
+
export type BundleName = (typeof BUNDLES)[number];
|
|
59
|
+
/** The name of a package of commons: `@intellectual-frontiers/` and a name, made only by {@link parsePackageName}. */
|
|
60
|
+
export type PackageName = Brand<string, "package name">;
|
|
61
|
+
/** A package name of commons from text, or why the text is not one. */
|
|
62
|
+
export declare function parsePackageName(text: string): Result<PackageName, string>;
|
|
63
|
+
/** The package a library publishes: the one its manifest names in `publishes`, else `@intellectual-frontiers/<name>` (commons 0036-distribution FR-009). */
|
|
64
|
+
export declare function publishedPackage(l: Pick<Library, "name" | "publishes">): string;
|
|
65
|
+
/** A constant of a library's sources that holds the library's version: the file (from the library's folder) and the constant's name. */
|
|
66
|
+
export type VersionConstant = {
|
|
67
|
+
readonly file: string;
|
|
68
|
+
readonly name: string;
|
|
40
69
|
};
|
|
41
70
|
/** The lowest conformance level that requires a library to declare `kanon`; none yet (0033-kanon FR-014, OQ-1): a level asks for it by naming itself here. */
|
|
42
71
|
export declare const KANON_REQUIRED_FROM: LevelKey | undefined;
|
|
@@ -69,7 +98,10 @@ export declare function requirementOf(id: string, l: Library): string;
|
|
|
69
98
|
export declare function rowOf(id: string, l: Library): string;
|
|
70
99
|
/** The ids the section already gives each library, by name, read from its text between the markers. */
|
|
71
100
|
export declare function idsIn(spec: string): ReadonlyMap<string, string>;
|
|
72
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* The id each library has: the one it had, or the next number after the greatest. A number belongs to the first library that holds it in the specification: where a second one holds it (two branches each gave the next number to a
|
|
103
|
+
* library, and a merge kept both), the second is given the next number after the greatest, so that the generator makes the section again with one number for each library.
|
|
104
|
+
*/
|
|
73
105
|
export declare function idsFor(libraries: readonly Library[], had: ReadonlyMap<string, string>): ReadonlyMap<string, string>;
|
|
74
106
|
/** The text of the specification and of the register, made again from the libraries: nothing where the specification has no markers. */
|
|
75
107
|
export declare function generated(spec: string, enforcement: string, libraries: readonly Library[]): Result<{
|
package/dist/libraries.js
CHANGED
|
@@ -80,7 +80,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
80
80
|
* @module
|
|
81
81
|
*/
|
|
82
82
|
import process from "node:process";
|
|
83
|
-
import { array, describe, formatDecodeError, literal, object, unknownValue, string, err, ok, } from "@intellectual-frontiers/core";
|
|
83
|
+
import { array, describe, formatDecodeError, literal, object, unknownValue, string, err, ok, refine, } from "@intellectual-frontiers/core";
|
|
84
84
|
import { parseSpdxId } from "./license/standard.js";
|
|
85
85
|
import { exportedLiteral } from "@intellectual-frontiers/formats/ts-literal";
|
|
86
86
|
import { decodeTable } from "@intellectual-frontiers/kanon";
|
|
@@ -105,6 +105,26 @@ function bounds(spec) {
|
|
|
105
105
|
const to = spec.indexOf(`\n${END}\n`, from);
|
|
106
106
|
return from < 0 || to < 0 ? undefined : { from: from + 1, to: to + 1 };
|
|
107
107
|
}
|
|
108
|
+
const heldDecoder = refine(string, "held reason", (t) => t.trim() !== "" && t.trim() === t && !t.includes("\n"));
|
|
109
|
+
/** A held reason from text, or why the text is not one. */
|
|
110
|
+
export function parseHeldReason(text) {
|
|
111
|
+
const r = heldDecoder(text, "held");
|
|
112
|
+
return r.kind === "ok" ? ok(r.value) : err("library.held is one non-empty line that says why the library is kept out of the release");
|
|
113
|
+
}
|
|
114
|
+
/** The scope of the packages of commons. */
|
|
115
|
+
export const PACKAGE_SCOPE = "@intellectual-frontiers/";
|
|
116
|
+
/** The sets that a metapackage is: the whole of commons, and the four roles of the libraries; a closed union, and the name of the folder and of the package of each. */
|
|
117
|
+
export const BUNDLES = ["commons", "foundation", "patterns", "programs", "standards"];
|
|
118
|
+
const packageNameDecoder = refine(string, "package name", (t) => /^@intellectual-frontiers\/[a-z][a-z0-9-]*$/.test(t));
|
|
119
|
+
/** A package name of commons from text, or why the text is not one. */
|
|
120
|
+
export function parsePackageName(text) {
|
|
121
|
+
const r = packageNameDecoder(text, "package");
|
|
122
|
+
return r.kind === "ok" ? ok(r.value) : err(`${JSON.stringify(text)} is not a package of commons (@intellectual-frontiers/ and a name of lower-case letters, digits and hyphens)`);
|
|
123
|
+
}
|
|
124
|
+
/** The package a library publishes: the one its manifest names in `publishes`, else `@intellectual-frontiers/<name>` (commons 0036-distribution FR-009). */
|
|
125
|
+
export function publishedPackage(l) {
|
|
126
|
+
return l.publishes ?? `${PACKAGE_SCOPE}${l.name}`;
|
|
127
|
+
}
|
|
108
128
|
/** The lowest conformance level that requires a library to declare `kanon`; none yet (0033-kanon FR-014, OQ-1): a level asks for it by naming itself here. */
|
|
109
129
|
export const KANON_REQUIRED_FROM = undefined;
|
|
110
130
|
/** The registries a library may be published to: the kinds only, never a host or a credential (0027-commons-libraries FR-018). */
|
|
@@ -125,8 +145,16 @@ const nameDecoder = (input, path = "$") => {
|
|
|
125
145
|
? r
|
|
126
146
|
: err({ kind: "decode", path, expected: "a name of lower-case letters, digits and hyphens", found: describe(input) });
|
|
127
147
|
};
|
|
128
|
-
const
|
|
129
|
-
const
|
|
148
|
+
const constantName = (input, path = "$") => {
|
|
149
|
+
const r = string(input, path);
|
|
150
|
+
if (r.kind === "err")
|
|
151
|
+
return r;
|
|
152
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(r.value)
|
|
153
|
+
? r
|
|
154
|
+
: err({ kind: "decode", path, expected: "the name of a constant: letters, digits and underscores", found: describe(input) });
|
|
155
|
+
};
|
|
156
|
+
const body = object({ name: nameDecoder, verify: nonEmpty, version: nonEmpty, exports: array(nonEmpty) }, { level: literal(...LEVELS), specKit: nonEmpty, summary: nonEmpty, distribution: array(literal(...REGISTRIES)), kanon: unknownValue, family: object({ host: nonEmpty, role: literal(...ROLES) }), license: nonEmpty, versionConstants: array(object({ file: nonEmpty, name: constantName })), publishes: nonEmpty, bundle: literal(...BUNDLES), held: string });
|
|
157
|
+
const FIELDS = ["name", "level", "specKit", "verify", "version", "exports", "summary", "distribution", "kanon", "family", "license", "versionConstants", "publishes", "bundle", "held"];
|
|
130
158
|
/** The manifest read from the text of its file: `export const library = { ... }` and no other export, read as data and never run (0027-commons-libraries FR-012). */
|
|
131
159
|
export function decodeLibrarySource(source) {
|
|
132
160
|
const exports = source.split("\n").filter((l) => /^export\s/.test(l));
|
|
@@ -147,9 +175,18 @@ export function decodeLibrarySource(source) {
|
|
|
147
175
|
return err(formatDecodeError(r.error));
|
|
148
176
|
const v = r.value;
|
|
149
177
|
const distribution = v.distribution ?? DEFAULT_DISTRIBUTION;
|
|
150
|
-
|
|
178
|
+
let held;
|
|
179
|
+
if (v.held !== undefined) {
|
|
180
|
+
const h = parseHeldReason(v.held);
|
|
181
|
+
if (h.kind === "err")
|
|
182
|
+
return err(h.error);
|
|
183
|
+
held = h.value;
|
|
184
|
+
if (v.publishes !== undefined || v.bundle !== undefined)
|
|
185
|
+
return err("library.held is not given with library.publishes or library.bundle: a held library is published nowhere");
|
|
186
|
+
}
|
|
187
|
+
if (held === undefined && (distribution.length === 0 || new Set(distribution).size !== distribution.length))
|
|
151
188
|
return err("library.distribution lists each registry once and at least one (FR-015)");
|
|
152
|
-
if (!distribution.includes("github"))
|
|
189
|
+
if (held === undefined && !distribution.includes("github"))
|
|
153
190
|
return err("library.distribution includes github: a library is published to the GitHub package registry whatever else it is published to (FR-015, FR-016)");
|
|
154
191
|
let kanon;
|
|
155
192
|
if (v.kanon !== undefined) {
|
|
@@ -172,6 +209,17 @@ export function decodeLibrarySource(source) {
|
|
|
172
209
|
return err(`library.license: ${l.error}`);
|
|
173
210
|
license = l.value;
|
|
174
211
|
}
|
|
212
|
+
let publishes;
|
|
213
|
+
if (v.publishes !== undefined) {
|
|
214
|
+
const p = parsePackageName(v.publishes);
|
|
215
|
+
if (p.kind === "err")
|
|
216
|
+
return err(`library.publishes: ${p.error}`);
|
|
217
|
+
publishes = p.value;
|
|
218
|
+
}
|
|
219
|
+
if (v.bundle !== undefined && v.bundle !== v.name)
|
|
220
|
+
return err(`library.bundle ${v.bundle} is the set of the metapackage of that name: the folder is named ${v.bundle}, and this one is ${v.name} (0036-distribution FR-005)`);
|
|
221
|
+
if (v.bundle !== undefined && publishes !== undefined)
|
|
222
|
+
return err("library.bundle and library.publishes are not both given: a metapackage publishes the package of its folder (0036-distribution FR-005)");
|
|
175
223
|
return ok({
|
|
176
224
|
name: v.name,
|
|
177
225
|
level: v.level ?? DEFAULT_LIBRARY_LEVEL,
|
|
@@ -184,6 +232,10 @@ export function decodeLibrarySource(source) {
|
|
|
184
232
|
...(kanon === undefined ? {} : { kanon }),
|
|
185
233
|
...(family === undefined ? {} : { family }),
|
|
186
234
|
...(license === undefined ? {} : { license }),
|
|
235
|
+
...(v.versionConstants === undefined ? {} : { versionConstants: v.versionConstants }),
|
|
236
|
+
...(publishes === undefined ? {} : { publishes }),
|
|
237
|
+
...(v.bundle === undefined ? {} : { bundle: v.bundle }),
|
|
238
|
+
...(held === undefined ? {} : { held }),
|
|
187
239
|
});
|
|
188
240
|
}
|
|
189
241
|
/** The manifests of `commons/*`, in the order of the folders' names: every folder that holds a `library.ts`. */
|
|
@@ -292,8 +344,10 @@ const list = (items) => {
|
|
|
292
344
|
export function requirementOf(id, l) {
|
|
293
345
|
const kit = l.specKit === undefined ? "" : `, its spec kit at \`commons/${l.name}/${l.specKit}\``;
|
|
294
346
|
const summary = l.summary === undefined ? "" : ` ${l.summary}`;
|
|
295
|
-
const where = l.distribution.map((r) => REGISTRY_NAME[r]).join(" and ")
|
|
296
|
-
|
|
347
|
+
const where = l.held === undefined ? l.distribution.map((r) => REGISTRY_NAME[r]).join(" and ") : `no registry (held out of the release: ${l.held})`;
|
|
348
|
+
const own = l.publishes === undefined ? `@intellectual-frontiers/${l.name}` : l.publishes;
|
|
349
|
+
const sets = l.bundle === undefined ? "" : `, a metapackage with no code of its own (the set ${l.bundle}, 0036-distribution FR-005)`;
|
|
350
|
+
return `- **${id}**: \`commons/${l.name}\` MUST be a library at conformance level ${l.level} (\`${LEVEL_TERM[l.level]}\`): the package \`${own}\`${sets} at version \`${l.version}\`${kit}, exporting ${list(l.exports)}, published to ${where}, proved by \`cd commons/${l.name} && ${l.verify}\`.${summary}`;
|
|
297
351
|
}
|
|
298
352
|
/** The row of `enforcement.tsv` of a library's requirement. */
|
|
299
353
|
export function rowOf(id, l) {
|
|
@@ -313,13 +367,20 @@ export function idsIn(spec) {
|
|
|
313
367
|
}
|
|
314
368
|
return out;
|
|
315
369
|
}
|
|
316
|
-
/**
|
|
370
|
+
/**
|
|
371
|
+
* The id each library has: the one it had, or the next number after the greatest. A number belongs to the first library that holds it in the specification: where a second one holds it (two branches each gave the next number to a
|
|
372
|
+
* library, and a merge kept both), the second is given the next number after the greatest, so that the generator makes the section again with one number for each library.
|
|
373
|
+
*/
|
|
317
374
|
export function idsFor(libraries, had) {
|
|
318
375
|
const out = new Map();
|
|
376
|
+
const first = new Map();
|
|
377
|
+
for (const [name, id] of had)
|
|
378
|
+
if (!first.has(id))
|
|
379
|
+
first.set(id, name);
|
|
319
380
|
let next = Math.max(FIRST_GENERATED - 1, ...[...had.values()].map((id) => Number(id.slice(3)))) + 1;
|
|
320
381
|
for (const l of libraries) {
|
|
321
382
|
const id = had.get(l.name);
|
|
322
|
-
if (id !== undefined)
|
|
383
|
+
if (id !== undefined && first.get(id) === l.name)
|
|
323
384
|
out.set(l.name, id);
|
|
324
385
|
else
|
|
325
386
|
out.set(l.name, `FR-${String(next++).padStart(3, "0")}`);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# PolyForm Noncommercial License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
12
|
+
|
|
13
|
+
## Distribution License
|
|
14
|
+
|
|
15
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
16
|
+
|
|
17
|
+
## Notices
|
|
18
|
+
|
|
19
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
20
|
+
|
|
21
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
22
|
+
|
|
23
|
+
## Changes and New Works License
|
|
24
|
+
|
|
25
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
26
|
+
|
|
27
|
+
## Patent License
|
|
28
|
+
|
|
29
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
30
|
+
|
|
31
|
+
## Noncommercial Purposes
|
|
32
|
+
|
|
33
|
+
Any noncommercial purpose is a permitted purpose.
|
|
34
|
+
|
|
35
|
+
## Personal Uses
|
|
36
|
+
|
|
37
|
+
Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
|
|
38
|
+
|
|
39
|
+
## Noncommercial Organizations
|
|
40
|
+
|
|
41
|
+
Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
|
|
42
|
+
|
|
43
|
+
## Fair Use
|
|
44
|
+
|
|
45
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
46
|
+
|
|
47
|
+
## No Other Rights
|
|
48
|
+
|
|
49
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
50
|
+
|
|
51
|
+
## Patent Defense
|
|
52
|
+
|
|
53
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
54
|
+
|
|
55
|
+
## Violations
|
|
56
|
+
|
|
57
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
58
|
+
|
|
59
|
+
## No Liability
|
|
60
|
+
|
|
61
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
62
|
+
|
|
63
|
+
## Definitions
|
|
64
|
+
|
|
65
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
66
|
+
|
|
67
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
68
|
+
|
|
69
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
70
|
+
|
|
71
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
72
|
+
|
|
73
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
package/dist/link.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** The packages of commons by name and the folder of each
|
|
1
|
+
/** The packages of commons by name and the folder of each. */
|
|
2
2
|
export declare function linksOf(repo: string): ReadonlyMap<string, string>;
|
|
3
3
|
/** Links each package that is not linked yet, and gives how many it linked, or why it could not. */
|
|
4
4
|
export declare function linkAll(repo: string): {
|
package/dist/link.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* bun commons/libraries/src/link.ts link what is not linked, from the repository above this folder (or --repo DIR)
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* A folder of `commons/` whose `package.json` is named `@intellectual-frontiers/<name>` is linked as that name
|
|
9
|
+
* A folder of `commons/` whose `package.json` is named `@intellectual-frontiers/<name>` is linked as that name (the metapackage `commons/commons` bears `@intellectual-frontiers/commons`). A link
|
|
10
10
|
* that is there is left as it is. Only the built-ins of Node are used, so it runs on Bun and on Node 26 before anything is installed.
|
|
11
11
|
*
|
|
12
12
|
* @limits
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts
|
|
17
17
|
* import { linksOf } from "./link.ts";
|
|
18
|
-
* linksOf(".").get("@intellectual-frontiers/commons"); // the path of commons/
|
|
18
|
+
* linksOf(".").get("@intellectual-frontiers/commons"); // the path of commons/commons
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* Spec: 0001-libraries FR-011
|
|
@@ -36,13 +36,13 @@ const nameOf = (file) => {
|
|
|
36
36
|
return undefined;
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
/** The packages of commons by name and the folder of each
|
|
39
|
+
/** The packages of commons by name and the folder of each. */
|
|
40
40
|
export function linksOf(repo) {
|
|
41
41
|
const links = new Map();
|
|
42
42
|
const dirs = readdirSync(join(repo, "commons"), { withFileTypes: true })
|
|
43
43
|
.filter((e) => e.isDirectory() && e.name !== "node_modules")
|
|
44
44
|
.map((e) => e.name)
|
|
45
|
-
.sort((a, b) => (a
|
|
45
|
+
.sort((a, b) => (a < b ? -1 : 1));
|
|
46
46
|
for (const d of dirs) {
|
|
47
47
|
const name = nameOf(join(repo, "commons", d, "package.json"));
|
|
48
48
|
if (name !== undefined && name.startsWith(SCOPE) && !links.has(name))
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metapackages of commons (commons 0036-distribution FR-005 to FR-008): five packages with no code of their own, each a set of libraries at the exact versions of one release. `@intellectual-frontiers/commons` is every
|
|
3
|
+
* consumer-facing library; `foundation`, `patterns`, `programs` and `standards` are the four roles of the libraries. A repository other than `.github` installs commons by installing one of them, or a library, from a registry.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Pure: the libraries as data give the members of a set, the exact dependencies of its package, the file that records them, the `package.json` and the README that are published. The role of a library is read from `ROLE_OF` of
|
|
7
|
+
* `readme.ts`, the one place that says it, and the set of a role is the role's: `foundation`, `pattern` (`patterns`), `program` (`programs`) and `standard` (`standards`). A library is consumer-facing where its distribution
|
|
8
|
+
* names npm and it is not a metapackage and not held back ({@link HELD_BACK}); the package of a member is the package it publishes ({@link publishedPackage}). A member whose role is not known is a problem and never a member
|
|
9
|
+
* of no set. The effects (writing the files, packing) are `pack-metapackage.ts`.
|
|
10
|
+
*
|
|
11
|
+
* @limits
|
|
12
|
+
* It reads no file and knows no registry. It does not know what is published: a release that has not published a member makes the set refer to a version npm does not hold yet, which the release's order prevents.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { dependenciesOf } from "./metapackages.js";
|
|
17
|
+
* dependenciesOf([{ library: "core", package: "@intellectual-frontiers/core", version: "0.1.5" }]); // { "@intellectual-frontiers/core": "0.1.5" }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Spec: 0001-libraries FR-023
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
import { type Result } from "@intellectual-frontiers/core";
|
|
25
|
+
import { type BundleName, type Library } from "./libraries.js";
|
|
26
|
+
import { type Role } from "./readme.js";
|
|
27
|
+
/** The libraries that are not in any set yet, each with why: they declare npm and are not ready to be installed (commons 0036-distribution FR-006). A library leaves this list when its owner releases it. */
|
|
28
|
+
export declare const HELD_BACK: ReadonlyMap<string, string>;
|
|
29
|
+
/** The roles' sets: a role is in exactly one. */
|
|
30
|
+
export declare const BUNDLE_OF_ROLE: Readonly<Record<Role, Exclude<BundleName, "commons">>>;
|
|
31
|
+
/** A member of a set: the library, the package it publishes and the version of this release. */
|
|
32
|
+
export type Member = {
|
|
33
|
+
readonly library: string;
|
|
34
|
+
readonly package: string;
|
|
35
|
+
readonly version: string;
|
|
36
|
+
};
|
|
37
|
+
/** The exact dependencies of a package: the name of each member and its version, nothing else. */
|
|
38
|
+
export type Dependencies = Readonly<Record<string, string>>;
|
|
39
|
+
/** Whether a library is installed by a set: it names npm, it is no metapackage and it is not held back. */
|
|
40
|
+
export declare function isConsumerFacing(l: Pick<Library, "name" | "bundle" | "distribution" | "held">): boolean;
|
|
41
|
+
/** The members of a set, in the order of their packages' names; the problem where a consumer-facing library has no role in `ROLE_OF`. */
|
|
42
|
+
export declare function membersOf(bundle: BundleName, libraries: readonly Library[]): Result<readonly Member[], string>;
|
|
43
|
+
/** The exact dependencies of the package of a set: each member's package at its version, no range. */
|
|
44
|
+
export declare function dependenciesOf(members: readonly Member[]): Dependencies;
|
|
45
|
+
/** What the generated file of a set holds: the set and its exact dependencies. */
|
|
46
|
+
export declare function setFileText(bundle: BundleName, members: readonly Member[]): string;
|
|
47
|
+
/** The generated file of a set, from its folder. */
|
|
48
|
+
export declare const SET_FILE = "dependencies.auto.json";
|
|
49
|
+
/** The dependencies a generated file holds, or why its text is not one. */
|
|
50
|
+
export declare function readSetFile(text: string): Result<Dependencies, string>;
|
|
51
|
+
/** The text of a set's own `description`, which the package carries. */
|
|
52
|
+
export declare function descriptionOf(bundle: BundleName): string;
|
|
53
|
+
/** The README of a set's package: what it holds, how to install it from npm and from the GitHub package registry, and how to keep one copy of each library. */
|
|
54
|
+
export declare function readmeOf(bundle: BundleName, members: readonly Member[]): string;
|
|
55
|
+
/** The `package.json` that is published for a set: no code, one empty entry, the exact dependencies. */
|
|
56
|
+
export declare function publishedManifest(bundle: BundleName, version: string, dependencies: Dependencies, license: string): Readonly<Record<string, unknown>>;
|
|
57
|
+
/** The one file of code of a set's package, and its declaration: an empty module, so that the entry imports. */
|
|
58
|
+
export declare const ENTRY_JS = "export {};\n";
|
|
59
|
+
/** The declaration of {@link ENTRY_JS}. */
|
|
60
|
+
export declare const ENTRY_DTS = "export {};\n";
|
|
61
|
+
/** Every set, in the order the README lists them. */
|
|
62
|
+
export declare const ALL_BUNDLES: readonly BundleName[];
|