@intellectual-frontiers/libraries 0.4.0 → 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/LICENSE +75 -21
- package/dist/affected.d.ts +1 -1
- package/dist/dev.d.ts +2 -0
- package/dist/dev.js +14 -2
- package/dist/family.js +1 -0
- package/dist/generate-ontology.js +4 -0
- 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 +19 -14
- package/dist/libraries.d.ts +39 -2
- package/dist/libraries.js +80 -9
- package/dist/license/PolyForm-Noncommercial-1.0.0.md +73 -0
- package/dist/license/standard.d.ts +46 -0
- package/dist/license/standard.js +43 -0
- package/dist/license/third-party.d.ts +25 -0
- package/dist/license/third-party.js +71 -0
- package/dist/license.d.ts +61 -0
- package/dist/license.js +204 -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 +9 -0
- package/dist/pack-library.js +46 -58
- package/dist/pack-metapackage.d.ts +22 -0
- package/dist/pack-metapackage.js +147 -0
- package/dist/pins.d.ts +34 -7
- package/dist/pins.js +36 -9
- package/dist/readme.d.ts +71 -0
- package/dist/readme.js +310 -0
- 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 +32 -114
- package/dist/workflows/model.d.ts +6 -0
- package/dist/workflows/render.js +2 -0
- package/dist/workflows/schema/github-workflow.schema.json +2290 -0
- package/package.json +39 -14
- package/src/affected.ts +1 -1
- package/src/dev.ts +13 -2
- package/src/family.ts +1 -0
- package/src/generate-ontology.ts +4 -0
- 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 +16 -13
- package/src/libraries.ts +100 -8
- package/src/license/PolyForm-Noncommercial-1.0.0.md +73 -0
- package/src/license/standard.ts +67 -0
- package/src/license/third-party.ts +87 -0
- package/src/license.ts +222 -0
- package/src/link.ts +4 -4
- package/src/metapackages.ts +206 -0
- package/src/mod.ts +1 -1
- package/src/pack-library.ts +52 -55
- package/src/pack-metapackage.ts +137 -0
- package/src/pins.ts +55 -10
- package/src/readme.ts +320 -0
- package/src/releasing.ts +47 -16
- package/src/workflows/definitions.ts +36 -133
- package/src/workflows/model.ts +6 -0
- package/src/workflows/render.ts +1 -0
- package/src/workflows/schema/github-workflow.schema.json +2290 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intellectual-frontiers/libraries",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The libraries of a repository of commons as code: the manifest of a library and the check that it and its folder agree, which libraries a change affects, the typed workflows of GitHub Actions and their generator, the pinned Bun, the packer that builds, inspects and packs a library for npm with its declarations, and the commands that hold a whole repository to Mizan (check, change control, versions, the register and the ontologies).",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=26"
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"bun": "./src/dev.ts",
|
|
36
36
|
"default": "./dist/dev.js"
|
|
37
37
|
},
|
|
38
|
+
"./family": {
|
|
39
|
+
"types": "./dist/family.d.ts",
|
|
40
|
+
"bun": "./src/family.ts",
|
|
41
|
+
"default": "./dist/family.js"
|
|
42
|
+
},
|
|
38
43
|
"./generate-ontology": {
|
|
39
44
|
"types": "./dist/generate-ontology.d.ts",
|
|
40
45
|
"bun": "./src/generate-ontology.ts",
|
|
@@ -50,11 +55,21 @@
|
|
|
50
55
|
"bun": "./src/libraries.ts",
|
|
51
56
|
"default": "./dist/libraries.js"
|
|
52
57
|
},
|
|
58
|
+
"./license": {
|
|
59
|
+
"types": "./dist/license.d.ts",
|
|
60
|
+
"bun": "./src/license.ts",
|
|
61
|
+
"default": "./dist/license.js"
|
|
62
|
+
},
|
|
53
63
|
"./link": {
|
|
54
64
|
"types": "./dist/link.d.ts",
|
|
55
65
|
"bun": "./src/link.ts",
|
|
56
66
|
"default": "./dist/link.js"
|
|
57
67
|
},
|
|
68
|
+
"./metapackages": {
|
|
69
|
+
"types": "./dist/metapackages.d.ts",
|
|
70
|
+
"bun": "./src/metapackages.ts",
|
|
71
|
+
"default": "./dist/metapackages.js"
|
|
72
|
+
},
|
|
58
73
|
"./newer": {
|
|
59
74
|
"types": "./dist/newer.d.ts",
|
|
60
75
|
"bun": "./src/newer.ts",
|
|
@@ -70,6 +85,11 @@
|
|
|
70
85
|
"bun": "./src/pack-library.ts",
|
|
71
86
|
"default": "./dist/pack-library.js"
|
|
72
87
|
},
|
|
88
|
+
"./pack-metapackage": {
|
|
89
|
+
"types": "./dist/pack-metapackage.d.ts",
|
|
90
|
+
"bun": "./src/pack-metapackage.ts",
|
|
91
|
+
"default": "./dist/pack-metapackage.js"
|
|
92
|
+
},
|
|
73
93
|
"./pins": {
|
|
74
94
|
"types": "./dist/pins.d.ts",
|
|
75
95
|
"bun": "./src/pins.ts",
|
|
@@ -90,6 +110,11 @@
|
|
|
90
110
|
"bun": "./src/publish-ontology.ts",
|
|
91
111
|
"default": "./dist/publish-ontology.js"
|
|
92
112
|
},
|
|
113
|
+
"./readme": {
|
|
114
|
+
"types": "./dist/readme.d.ts",
|
|
115
|
+
"bun": "./src/readme.ts",
|
|
116
|
+
"default": "./dist/readme.js"
|
|
117
|
+
},
|
|
93
118
|
"./versions": {
|
|
94
119
|
"types": "./dist/versions.d.ts",
|
|
95
120
|
"bun": "./src/versions.ts",
|
|
@@ -117,18 +142,18 @@
|
|
|
117
142
|
}
|
|
118
143
|
},
|
|
119
144
|
"dependencies": {
|
|
120
|
-
"@intellectual-frontiers/core": "0.
|
|
121
|
-
"@intellectual-frontiers/crypto": "0.
|
|
122
|
-
"@intellectual-frontiers/formats": "0.
|
|
123
|
-
"@intellectual-frontiers/githost": "0.
|
|
124
|
-
"@intellectual-frontiers/kanon": "0.
|
|
125
|
-
"@intellectual-frontiers/mizan": "0.
|
|
126
|
-
"@intellectual-frontiers/net": "0.
|
|
127
|
-
"@intellectual-frontiers/ontology": "0.
|
|
128
|
-
"@intellectual-frontiers/quality": "0.
|
|
129
|
-
"@intellectual-frontiers/rdf": "0.
|
|
130
|
-
"@intellectual-frontiers/system": "0.
|
|
131
|
-
"@intellectual-frontiers/terminal": "0.
|
|
145
|
+
"@intellectual-frontiers/core": "0.2.0",
|
|
146
|
+
"@intellectual-frontiers/crypto": "0.2.0",
|
|
147
|
+
"@intellectual-frontiers/formats": "0.2.0",
|
|
148
|
+
"@intellectual-frontiers/githost": "0.2.0",
|
|
149
|
+
"@intellectual-frontiers/kanon": "0.3.0",
|
|
150
|
+
"@intellectual-frontiers/mizan": "0.2.0",
|
|
151
|
+
"@intellectual-frontiers/net": "0.2.0",
|
|
152
|
+
"@intellectual-frontiers/ontology": "0.4.0",
|
|
153
|
+
"@intellectual-frontiers/quality": "0.3.0",
|
|
154
|
+
"@intellectual-frontiers/rdf": "0.2.0",
|
|
155
|
+
"@intellectual-frontiers/system": "0.2.0",
|
|
156
|
+
"@intellectual-frontiers/terminal": "0.2.0"
|
|
132
157
|
},
|
|
133
158
|
"files": [
|
|
134
159
|
"dist",
|
package/src/affected.ts
CHANGED
|
@@ -37,7 +37,7 @@ import { type Library, readLibraries } from "./libraries.ts";
|
|
|
37
37
|
|
|
38
38
|
/** 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. */
|
|
39
39
|
export type Inputs = {
|
|
40
|
-
/** The paths of the library's inputs: `commons/<name>/` and each folder (`commons/
|
|
40
|
+
/** The paths of the library's inputs: `commons/<name>/` and each folder (`commons/core/src/**`) or file the library takes from another. */
|
|
41
41
|
readonly paths: readonly string[];
|
|
42
42
|
/** The folders of commons that the library depends on through its package. */
|
|
43
43
|
readonly dependsOn: readonly string[];
|
package/src/dev.ts
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* bun run dev:check --files a.ts,b/c.ts the libraries these files affect (paths from the repository's root)
|
|
8
8
|
* bun run dev:check --all every library
|
|
9
9
|
* bun run dev:check --list say what is affected and run nothing
|
|
10
|
-
* other flags: --base REF (origin/main by default), --no-types, --no-tests, --bail (stop at the first failing test), --repo DIR
|
|
10
|
+
* other flags: --base REF (origin/main by default), --no-types, --no-tests, --no-license, --bail (stop at the first failing test), --repo DIR
|
|
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
|
*
|
|
@@ -40,6 +40,7 @@ import { flag, formatUsageError, helpText, many, parseArgs, value } from "@intel
|
|
|
40
40
|
import { label, paint } from "@intellectual-frontiers/terminal/palette";
|
|
41
41
|
import { affectedBy, changedSince, everyLibrary } from "./affected.ts";
|
|
42
42
|
import { linkAll } from "./link.ts";
|
|
43
|
+
import { judge as judgeLicense, sentence as licenseSentence } from "./license.ts";
|
|
43
44
|
import type { Library } from "./libraries.ts";
|
|
44
45
|
|
|
45
46
|
/** What the loop is asked about: what changed since a revision, a list of files, named libraries or everything. */
|
|
@@ -217,6 +218,14 @@ export async function typeCheck(repo: string, libs: readonly Lib[], width: numbe
|
|
|
217
218
|
};
|
|
218
219
|
}
|
|
219
220
|
|
|
221
|
+
/** The license of the repository and of each library, as the check of `license.ts` finds it: a library with no `LICENSE` fails here, and the sentence says the command that writes it. */
|
|
222
|
+
export async function licenseStage(repo: string): Promise<Outcome> {
|
|
223
|
+
const t0 = performance.now();
|
|
224
|
+
const { findings } = await judgeLicense(repo);
|
|
225
|
+
if (findings.length === 0) return { kind: "passed", detail: `every LICENSE is the official text in ${seconds(t0)}` };
|
|
226
|
+
return { kind: "failed", detail: plural(findings.length, "finding", "findings"), output: findings.map(licenseSentence) };
|
|
227
|
+
}
|
|
228
|
+
|
|
220
229
|
/** The sum of counts. */
|
|
221
230
|
export const addCounts = (a: Counts, b: Counts): Counts => ({ pass: a.pass + b.pass, skip: a.skip + b.skip, fail: a.fail + b.fail, files: a.files + b.files });
|
|
222
231
|
|
|
@@ -291,6 +300,7 @@ const OPTIONS = {
|
|
|
291
300
|
list: flag({ help: "Say what is affected and run nothing." }),
|
|
292
301
|
types: flag({ help: "Type-check the libraries (on by default).", negatable: true, default: true }),
|
|
293
302
|
tests: flag({ help: "Run their tests (on by default).", negatable: true, default: true }),
|
|
303
|
+
license: flag({ help: "Check the license files of the repository (on by default).", negatable: true, default: true }),
|
|
294
304
|
bail: flag({ help: "Stop the tests at the first one that fails." }),
|
|
295
305
|
repo: value({ help: "The repository (the working folder, or the one above it that has commons/, by default).", valueName: "DIR" }),
|
|
296
306
|
};
|
|
@@ -361,6 +371,7 @@ export async function main(argv: readonly string[]): Promise<number> {
|
|
|
361
371
|
]);
|
|
362
372
|
stages.push({ name: "types", outcome: types }, { name: "tests", outcome: tests });
|
|
363
373
|
}
|
|
374
|
+
if (!o.list && o.license) stages.push({ name: "license", outcome: await licenseStage(repo) });
|
|
364
375
|
for (const l of summaryLines(look, { why, libs: names }, stages, notes, seconds(t0))) stdio.stdout.writeSync(`${l}\n`);
|
|
365
376
|
return stages.some((s) => s.outcome.kind === "failed") ? 1 : 0;
|
|
366
377
|
}
|
package/src/family.ts
CHANGED
|
@@ -42,6 +42,7 @@ export const RESERVED: readonly Reservation[] = [
|
|
|
42
42
|
{ match: { kind: "exact", name: "signing" }, host: "signing", reason: "held for the signing library of the fleet libraries (intellectual-frontiers/.github#11)" },
|
|
43
43
|
{ match: { kind: "exact", name: "gitops" }, host: "gitops", reason: "held for the gitops library of the fleet libraries (intellectual-frontiers/.github#11)" },
|
|
44
44
|
{ match: { kind: "exact", name: "estate" }, host: "estate", reason: "held for the estate library of the fleet libraries (intellectual-frontiers/.github#11)" },
|
|
45
|
+
{ match: { kind: "exact", name: "toolchain" }, host: "toolchain", reason: "held for the toolchain library of the fleet libraries (intellectual-frontiers/.github#11)" },
|
|
45
46
|
];
|
|
46
47
|
|
|
47
48
|
/** Whether a library name is one a match holds. */
|
package/src/generate-ontology.ts
CHANGED
|
@@ -75,6 +75,8 @@ export const MIZAN: OntologyPublication = {
|
|
|
75
75
|
["dcterms", "http://purl.org/dc/terms/"],
|
|
76
76
|
["pm", "https://www.intellectualfrontiers.com/ontology/packaging#"],
|
|
77
77
|
["schema", "https://schema.org/"],
|
|
78
|
+
["dcat", "http://www.w3.org/ns/dcat#"],
|
|
79
|
+
["purl", "https://github.com/package-url/purl-spec#"],
|
|
78
80
|
],
|
|
79
81
|
files,
|
|
80
82
|
ontology: mizanOntology,
|
|
@@ -97,6 +99,8 @@ export const MIZAN: OntologyPublication = {
|
|
|
97
99
|
dcterms: "http://purl.org/dc/terms/",
|
|
98
100
|
pm: "https://www.intellectualfrontiers.com/ontology/packaging#",
|
|
99
101
|
schema: "https://schema.org/",
|
|
102
|
+
dcat: "http://www.w3.org/ns/dcat#",
|
|
103
|
+
purl: "https://github.com/package-url/purl-spec#",
|
|
100
104
|
},
|
|
101
105
|
viewTitle: "Mizan: the shared ontology",
|
|
102
106
|
license: CC0,
|
|
@@ -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/src/install-bun.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bun at the version commons pins (
|
|
3
|
-
* 0005-typescript-
|
|
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-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
|
*
|
|
@@ -17,7 +17,7 @@ import { chmod, ensureDir, readFile, readTextFile, writeFile, writeTextFile } fr
|
|
|
17
17
|
import { downloadVerified, Retries } from "@intellectual-frontiers/net/net";
|
|
18
18
|
import { dirname, fromFileUrl, join, resolve } from "@intellectual-frontiers/system/path";
|
|
19
19
|
import { args, build, env, exit } from "@intellectual-frontiers/system/proc";
|
|
20
|
-
import {
|
|
20
|
+
import { describePinProblem, pinDownload, pinSuffix, readEnvFile } from "./pins.ts";
|
|
21
21
|
|
|
22
22
|
/** Stop with a message and status 1. */
|
|
23
23
|
function stop(message: string): never {
|
|
@@ -30,21 +30,24 @@ const given = args[0];
|
|
|
30
30
|
if (given === undefined) stop("give the folder to put Bun in");
|
|
31
31
|
const dest = resolve(given);
|
|
32
32
|
const pins = readEnvFile(await readTextFile(join(ROOT, "commons", "generated", "pins.auto.env")));
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
const suffix = pinSuffix(build.os, build.arch);
|
|
34
|
+
if (suffix === undefined) stop(`Bun has no build for ${build.os} on ${build.arch}`);
|
|
35
|
+
const pin = pinDownload(pins, "BUN", suffix);
|
|
36
|
+
if (pin.kind === "err") stop(describePinProblem(pin.error));
|
|
37
|
+
const download = pin.value;
|
|
38
|
+
if (download.format !== "zip") stop(`commons pins Bun as ${download.format}, and this installer unpacks a zip`);
|
|
39
|
+
const sum = sha256Of(download.sha256);
|
|
40
|
+
if (sum === undefined) stop(`commons pins no SHA-256 of Bun for ${suffix}`);
|
|
38
41
|
const retries = new Retries({ tries: 5, base: 2, cap: 30 }, (line) => console.error(line));
|
|
39
|
-
const
|
|
40
|
-
const zip = await downloadVerified(retries, url, sum, join(dest, "cache"));
|
|
42
|
+
const zip = await downloadVerified(retries, download.url, sum, join(dest, "cache"));
|
|
41
43
|
if (zip.kind === "err") stop(zip.error);
|
|
42
44
|
const files = await unzip(await readFile(zip.value));
|
|
43
45
|
if (files.kind === "err") stop(formatArchiveError(files.error));
|
|
44
46
|
const exe = build.os === "windows" ? "bun.exe" : "bun";
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
const inside = download.binPath === "" ? exe : `${download.binPath}/${exe}`;
|
|
48
|
+
const bytes = files.value.get(inside);
|
|
49
|
+
if (bytes === undefined) stop(`the zip holds no ${inside}`);
|
|
50
|
+
const bin = join(dest, `bun-${download.version}`);
|
|
48
51
|
await ensureDir(bin);
|
|
49
52
|
await writeFile(join(bin, exe), bytes);
|
|
50
53
|
await chmod(join(bin, exe), 0o755);
|
package/src/libraries.ts
CHANGED
|
@@ -39,8 +39,11 @@ import {
|
|
|
39
39
|
string,
|
|
40
40
|
err,
|
|
41
41
|
ok,
|
|
42
|
+
refine,
|
|
43
|
+
type Brand,
|
|
42
44
|
type Result,
|
|
43
45
|
} from "@intellectual-frontiers/core";
|
|
46
|
+
import { parseSpdxId, type SpdxId } from "./license/standard.ts";
|
|
44
47
|
import { exportedLiteral } from "@intellectual-frontiers/formats/ts-literal";
|
|
45
48
|
import { decodeTable, type Table } from "@intellectual-frontiers/kanon";
|
|
46
49
|
import { existsSync, readDirSync, readTextFileSync, writeTextFileSync } from "@intellectual-frontiers/system/fs";
|
|
@@ -58,6 +61,7 @@ export const LIBRARIES_SPEC = "0027-commons-libraries";
|
|
|
58
61
|
export const FIRST_GENERATED = 101;
|
|
59
62
|
/** The marker that opens the generated section, and the one that closes it. */
|
|
60
63
|
export const BEGIN = "<!-- libraries:begin -->";
|
|
64
|
+
/** The marker that ends the generated section of the libraries in a document. */
|
|
61
65
|
export const END = "<!-- libraries:end -->";
|
|
62
66
|
|
|
63
67
|
/** Where the generated section begins and ends: the markers on lines of their own (a requirement may name them in its text). */
|
|
@@ -89,13 +93,60 @@ export type Library = {
|
|
|
89
93
|
readonly kanon?: Table;
|
|
90
94
|
/** Its host and its role where it is of a family (a host, a dialect of it or a plugin of it; 0033-kanon FR-021, 0027-commons-libraries FR-023). */
|
|
91
95
|
readonly family?: LibraryFamily;
|
|
96
|
+
/** 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). */
|
|
97
|
+
readonly license?: SpdxId;
|
|
98
|
+
/** 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. */
|
|
99
|
+
readonly versionConstants?: readonly VersionConstant[];
|
|
100
|
+
/** The package the library publishes where it is not `@intellectual-frontiers/<name>` (the `data` library publishes `@intellectual-frontiers/arcactl`; commons 0036-distribution FR-009). */
|
|
101
|
+
readonly publishes?: PackageName;
|
|
102
|
+
/** 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). */
|
|
103
|
+
readonly held?: HeldReason;
|
|
104
|
+
/** 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). */
|
|
105
|
+
readonly bundle?: BundleName;
|
|
92
106
|
};
|
|
93
107
|
|
|
108
|
+
/** The reason a library is held out of the release: a non-empty sentence, made only by {@link parseHeldReason}. */
|
|
109
|
+
export type HeldReason = Brand<string, "held reason">;
|
|
110
|
+
const heldDecoder = refine(string, "held reason", (t) => t.trim() !== "" && t.trim() === t && !t.includes("\n"));
|
|
111
|
+
|
|
112
|
+
/** A held reason from text, or why the text is not one. */
|
|
113
|
+
export function parseHeldReason(text: string): Result<HeldReason, string> {
|
|
114
|
+
const r = heldDecoder(text, "held");
|
|
115
|
+
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");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** The scope of the packages of commons. */
|
|
119
|
+
export const PACKAGE_SCOPE = "@intellectual-frontiers/";
|
|
120
|
+
|
|
121
|
+
/** 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. */
|
|
122
|
+
export const BUNDLES = ["commons", "foundation", "patterns", "programs", "standards"] as const;
|
|
123
|
+
/** The name of a set of libraries a metapackage is. */
|
|
124
|
+
export type BundleName = (typeof BUNDLES)[number];
|
|
125
|
+
|
|
126
|
+
/** The name of a package of commons: `@intellectual-frontiers/` and a name, made only by {@link parsePackageName}. */
|
|
127
|
+
export type PackageName = Brand<string, "package name">;
|
|
128
|
+
const packageNameDecoder = refine(string, "package name", (t) => /^@intellectual-frontiers\/[a-z][a-z0-9-]*$/.test(t));
|
|
129
|
+
|
|
130
|
+
/** A package name of commons from text, or why the text is not one. */
|
|
131
|
+
export function parsePackageName(text: string): Result<PackageName, string> {
|
|
132
|
+
const r = packageNameDecoder(text, "package");
|
|
133
|
+
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)`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** The package a library publishes: the one its manifest names in `publishes`, else `@intellectual-frontiers/<name>` (commons 0036-distribution FR-009). */
|
|
137
|
+
export function publishedPackage(l: Pick<Library, "name" | "publishes">): string {
|
|
138
|
+
return l.publishes ?? `${PACKAGE_SCOPE}${l.name}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** 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. */
|
|
142
|
+
export type VersionConstant = { readonly file: string; readonly name: string };
|
|
143
|
+
|
|
94
144
|
/** 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. */
|
|
95
145
|
export const KANON_REQUIRED_FROM: LevelKey | undefined = undefined;
|
|
96
146
|
|
|
97
147
|
/** The registries a library may be published to: the kinds only, never a host or a credential (0027-commons-libraries FR-018). */
|
|
98
148
|
export const REGISTRIES = ["github", "npm"] as const;
|
|
149
|
+
/** A registry a library is distributed to: github or npm. */
|
|
99
150
|
export type Registry = (typeof REGISTRIES)[number];
|
|
100
151
|
/** Where a manifest that declares no distribution is published. */
|
|
101
152
|
export const DEFAULT_DISTRIBUTION: readonly Registry[] = ["github"];
|
|
@@ -112,11 +163,18 @@ const nameDecoder: Decoder<string> = (input, path = "$") => {
|
|
|
112
163
|
? r
|
|
113
164
|
: err({ kind: "decode", path, expected: "a name of lower-case letters, digits and hyphens", found: describe(input) });
|
|
114
165
|
};
|
|
166
|
+
const constantName: Decoder<string> = (input, path = "$") => {
|
|
167
|
+
const r = string(input, path);
|
|
168
|
+
if (r.kind === "err") return r;
|
|
169
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(r.value)
|
|
170
|
+
? r
|
|
171
|
+
: err({ kind: "decode", path, expected: "the name of a constant: letters, digits and underscores", found: describe(input) });
|
|
172
|
+
};
|
|
115
173
|
const body = object(
|
|
116
174
|
{ name: nameDecoder, verify: nonEmpty, version: nonEmpty, exports: array(nonEmpty) },
|
|
117
|
-
{ level: literal(...LEVELS), specKit: nonEmpty, summary: nonEmpty, distribution: array(literal(...REGISTRIES)), kanon: unknownValue, family: object({ host: nonEmpty, role: literal(...ROLES) }) },
|
|
175
|
+
{ 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 },
|
|
118
176
|
);
|
|
119
|
-
const FIELDS = ["name", "level", "specKit", "verify", "version", "exports", "summary", "distribution", "kanon", "family"] as const;
|
|
177
|
+
const FIELDS = ["name", "level", "specKit", "verify", "version", "exports", "summary", "distribution", "kanon", "family", "license", "versionConstants", "publishes", "bundle", "held"] as const;
|
|
120
178
|
|
|
121
179
|
/** 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). */
|
|
122
180
|
export function decodeLibrarySource(source: string): Result<Library, string> {
|
|
@@ -134,9 +192,16 @@ export function decodeLibrarySource(source: string): Result<Library, string> {
|
|
|
134
192
|
if (r.kind === "err") return err(formatDecodeError(r.error));
|
|
135
193
|
const v = r.value;
|
|
136
194
|
const distribution = v.distribution ?? DEFAULT_DISTRIBUTION;
|
|
137
|
-
|
|
195
|
+
let held: HeldReason | undefined;
|
|
196
|
+
if (v.held !== undefined) {
|
|
197
|
+
const h = parseHeldReason(v.held);
|
|
198
|
+
if (h.kind === "err") return err(h.error);
|
|
199
|
+
held = h.value;
|
|
200
|
+
if (v.publishes !== undefined || v.bundle !== undefined) return err("library.held is not given with library.publishes or library.bundle: a held library is published nowhere");
|
|
201
|
+
}
|
|
202
|
+
if (held === undefined && (distribution.length === 0 || new Set(distribution).size !== distribution.length))
|
|
138
203
|
return err("library.distribution lists each registry once and at least one (FR-015)");
|
|
139
|
-
if (!distribution.includes("github"))
|
|
204
|
+
if (held === undefined && !distribution.includes("github"))
|
|
140
205
|
return err(
|
|
141
206
|
"library.distribution includes github: a library is published to the GitHub package registry whatever else it is published to (FR-015, FR-016)",
|
|
142
207
|
);
|
|
@@ -152,6 +217,21 @@ export function decodeLibrarySource(source: string): Result<Library, string> {
|
|
|
152
217
|
if (f.kind === "err") return f;
|
|
153
218
|
family = f.value;
|
|
154
219
|
}
|
|
220
|
+
let license: SpdxId | undefined;
|
|
221
|
+
if (v.license !== undefined) {
|
|
222
|
+
const l = parseSpdxId(v.license);
|
|
223
|
+
if (l.kind === "err") return err(`library.license: ${l.error}`);
|
|
224
|
+
license = l.value;
|
|
225
|
+
}
|
|
226
|
+
let publishes: PackageName | undefined;
|
|
227
|
+
if (v.publishes !== undefined) {
|
|
228
|
+
const p = parsePackageName(v.publishes);
|
|
229
|
+
if (p.kind === "err") return err(`library.publishes: ${p.error}`);
|
|
230
|
+
publishes = p.value;
|
|
231
|
+
}
|
|
232
|
+
if (v.bundle !== undefined && v.bundle !== v.name)
|
|
233
|
+
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)`);
|
|
234
|
+
if (v.bundle !== undefined && publishes !== undefined) return err("library.bundle and library.publishes are not both given: a metapackage publishes the package of its folder (0036-distribution FR-005)");
|
|
155
235
|
return ok({
|
|
156
236
|
name: v.name,
|
|
157
237
|
level: v.level ?? DEFAULT_LIBRARY_LEVEL,
|
|
@@ -163,6 +243,11 @@ export function decodeLibrarySource(source: string): Result<Library, string> {
|
|
|
163
243
|
distribution,
|
|
164
244
|
...(kanon === undefined ? {} : { kanon }),
|
|
165
245
|
...(family === undefined ? {} : { family }),
|
|
246
|
+
...(license === undefined ? {} : { license }),
|
|
247
|
+
...(v.versionConstants === undefined ? {} : { versionConstants: v.versionConstants }),
|
|
248
|
+
...(publishes === undefined ? {} : { publishes }),
|
|
249
|
+
...(v.bundle === undefined ? {} : { bundle: v.bundle }),
|
|
250
|
+
...(held === undefined ? {} : { held }),
|
|
166
251
|
});
|
|
167
252
|
}
|
|
168
253
|
|
|
@@ -293,8 +378,10 @@ const list = (items: readonly string[]): string => {
|
|
|
293
378
|
export function requirementOf(id: string, l: Library): string {
|
|
294
379
|
const kit = l.specKit === undefined ? "" : `, its spec kit at \`commons/${l.name}/${l.specKit}\``;
|
|
295
380
|
const summary = l.summary === undefined ? "" : ` ${l.summary}`;
|
|
296
|
-
const where = l.distribution.map((r) => REGISTRY_NAME[r]).join(" and ")
|
|
297
|
-
|
|
381
|
+
const where = l.held === undefined ? l.distribution.map((r) => REGISTRY_NAME[r]).join(" and ") : `no registry (held out of the release: ${l.held})`;
|
|
382
|
+
const own = l.publishes === undefined ? `@intellectual-frontiers/${l.name}` : l.publishes;
|
|
383
|
+
const sets = l.bundle === undefined ? "" : `, a metapackage with no code of its own (the set ${l.bundle}, 0036-distribution FR-005)`;
|
|
384
|
+
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}`;
|
|
298
385
|
}
|
|
299
386
|
|
|
300
387
|
/** The row of `enforcement.tsv` of a library's requirement. */
|
|
@@ -315,13 +402,18 @@ export function idsIn(spec: string): ReadonlyMap<string, string> {
|
|
|
315
402
|
return out;
|
|
316
403
|
}
|
|
317
404
|
|
|
318
|
-
/**
|
|
405
|
+
/**
|
|
406
|
+
* 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
|
|
407
|
+
* 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.
|
|
408
|
+
*/
|
|
319
409
|
export function idsFor(libraries: readonly Library[], had: ReadonlyMap<string, string>): ReadonlyMap<string, string> {
|
|
320
410
|
const out = new Map<string, string>();
|
|
411
|
+
const first = new Map<string, string>();
|
|
412
|
+
for (const [name, id] of had) if (!first.has(id)) first.set(id, name);
|
|
321
413
|
let next = Math.max(FIRST_GENERATED - 1, ...[...had.values()].map((id) => Number(id.slice(3)))) + 1;
|
|
322
414
|
for (const l of libraries) {
|
|
323
415
|
const id = had.get(l.name);
|
|
324
|
-
if (id !== undefined) out.set(l.name, id);
|
|
416
|
+
if (id !== undefined && first.get(id) === l.name) out.set(l.name, id);
|
|
325
417
|
else out.set(l.name, `FR-${String(next++).padStart(3, "0")}`);
|
|
326
418
|
}
|
|
327
419
|
return out;
|
|
@@ -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.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The license of this repository as data: the one license every library and every part of the repository is under, the one place its identifier is written, and the standard its text is taken from
|
|
3
|
+
* (commons 0035-licensing FR-001 to FR-004, 0018-standards-first FR-006 and FR-007). The text is the official PolyForm Noncommercial License 1.0.0, copied byte for byte into
|
|
4
|
+
* `PolyForm-Noncommercial-1.0.0.md` beside this file from the tag `1.0.0` of the official repository, and held to the SHA-256 recorded here.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Read as data by `../license.ts` (which writes and checks every `LICENSE`), by the packer (the `license` of a package) and by the decoder of the manifest (its optional `license`). The identifier is a closed union:
|
|
8
|
+
* a license is added to {@link SPDX_IDS} together with its text, never as a free string.
|
|
9
|
+
*
|
|
10
|
+
* Spec: 0001-libraries FR-019
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { err, ok, type Result } from "@intellectual-frontiers/core";
|
|
15
|
+
|
|
16
|
+
/** The SPDX identifiers of the licenses this repository can carry: each has its official text in this folder. */
|
|
17
|
+
export const SPDX_IDS = ["PolyForm-Noncommercial-1.0.0"] as const;
|
|
18
|
+
/** An SPDX license identifier of {@link SPDX_IDS}. */
|
|
19
|
+
export type SpdxId = (typeof SPDX_IDS)[number];
|
|
20
|
+
|
|
21
|
+
/** The license of every library and of the repository, unless a manifest's `license` says another of {@link SPDX_IDS}. */
|
|
22
|
+
export const DEFAULT_LICENSE: SpdxId = "PolyForm-Noncommercial-1.0.0";
|
|
23
|
+
|
|
24
|
+
/** An SPDX identifier from text, or why the text is none of the licenses this repository can carry. */
|
|
25
|
+
export function parseSpdxId(text: string): Result<SpdxId, string> {
|
|
26
|
+
const found = SPDX_IDS.find((id) => id === text);
|
|
27
|
+
return found === undefined ? err(`${JSON.stringify(text)} is not a license of this repository (${SPDX_IDS.join(", ")})`) : ok(found);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A standard imported as data (0018-standards-first FR-006): its issuer, name, version, location, license and the SHA-256 of what was imported. */
|
|
31
|
+
export type Standard = {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly issuer: string;
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly version: string;
|
|
36
|
+
/** Where the imported text is, at the tag that is pinned. */
|
|
37
|
+
readonly location: string;
|
|
38
|
+
/** What the text may be copied under (an SPDX identifier where there is one). */
|
|
39
|
+
readonly license: string;
|
|
40
|
+
readonly redistributable: boolean;
|
|
41
|
+
/** The SHA-256 of the file in this folder, line ends as they are (they are `\n`). */
|
|
42
|
+
readonly sha256: string;
|
|
43
|
+
/** The file of this folder that holds the text. */
|
|
44
|
+
readonly file: string;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** The official text of each license, as a standard of 0018-standards-first. */
|
|
48
|
+
export const LICENSE_STANDARDS: Readonly<Record<SpdxId, Standard>> = {
|
|
49
|
+
"PolyForm-Noncommercial-1.0.0": {
|
|
50
|
+
id: "polyform-noncommercial-1.0.0",
|
|
51
|
+
issuer: "The PolyForm Project",
|
|
52
|
+
name: "PolyForm Noncommercial License 1.0.0",
|
|
53
|
+
version: "1.0.0",
|
|
54
|
+
location: "https://raw.githubusercontent.com/polyformproject/polyform-licenses/1.0.0/PolyForm-Noncommercial-1.0.0.md",
|
|
55
|
+
license: "The terms of LICENSE.md of polyformproject/polyform-licenses at tag 1.0.0: a PolyForm license is copied as it is, and a change removes the name PolyForm",
|
|
56
|
+
redistributable: true,
|
|
57
|
+
sha256: "c0ea4a896d2c8c394b29f9427589996db826cd501c512279ff0ed3ef48fabbe5",
|
|
58
|
+
file: "PolyForm-Noncommercial-1.0.0.md",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** The licensor named in the `Required Notice:` line of every `LICENSE` and in `NOTICE`. */
|
|
63
|
+
export const LICENSOR = "Intellectual Frontiers LLC";
|
|
64
|
+
/** The repository the `Required Notice:` line names. */
|
|
65
|
+
export const REPOSITORY_URL = "https://github.com/intellectual-frontiers/.github";
|
|
66
|
+
/** Where a commercial license is asked for. */
|
|
67
|
+
export const COMMERCIAL_ISSUES_URL = "https://github.com/intellectual-frontiers/.github/issues";
|