Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { formatBytes, installCommands, shortDigest } from "./packages.ts"; | |
| 5 | ||
| 6 | test("sizes read as registries show them", () => { | |
| 7 | assert.equal(formatBytes(0), "0 B"); | |
| 8 | assert.equal(formatBytes(812), "812 B"); | |
| 9 | assert.equal(formatBytes(12_340_000), "12.3 MB"); | |
| 10 | assert.equal(formatBytes(1_400_000_000), "1.4 GB"); | |
| 11 | assert.equal(formatBytes(250_000_000), "250 MB"); | |
| 12 | }); | |
| 13 | ||
| 14 | test("digests shorten for lists", () => { | |
| 15 | assert.equal(shortDigest("sha256:3f2a9c1b7d0e55aa"), "3f2a9c1b7d0e"); | |
| 16 | }); | |
| 17 | ||
| npm on g1t.sh: publish and install @<workspace>/<name> with the npm CLI and a g1t token | 18 | test("an npm package is installed after .npmrc names its scope's registry, and a token for private ones", () => { |
| 19 | const pkg = { ecosystem: "npm" as const, address: "g1t.sh/-/npm/@acme/ui", name: "ui", workspace: "acme" }; | |
| 20 | assert.deepEqual(installCommands(pkg, "1.2.0", "ada"), { | |
| 21 | registry: "npm config set @acme:registry=https://g1t.sh/-/npm/", | |
| 22 | login: "npm config set //g1t.sh/-/npm/:_authToken=YOUR_TOKEN", | |
| 23 | install: "npm install @acme/ui@1.2.0", | |
| 24 | }); | |
| 25 | assert.equal(installCommands(pkg, null, "ada").install, "npm install @acme/ui"); | |
| 26 | }); | |
| 27 | ||
| Composer from the workspace's own repositories, and go get from g1t.sh | 28 | test("a Composer package is required after its workspace's repository is added, with credentials for private ones", () => { |
| 29 | const pkg = { ecosystem: "composer" as const, address: "g1t.sh/-/composer/acme/acme/lib", name: "acme/lib", workspace: "acme" }; | |
| 30 | assert.deepEqual(installCommands(pkg, "v1.1.0", "ada"), { | |
| 31 | registry: "composer config repositories.acme composer https://g1t.sh/-/composer/acme/", | |
| 32 | login: "composer config --global --auth http-basic.g1t.sh ada YOUR_TOKEN", | |
| 33 | install: "composer require acme/lib:v1.1.0", | |
| 34 | }); | |
| 35 | }); | |
| 36 | ||
| Packages, with a container registry on g1t.sh; workspaces deleted whole and kept 30 days; Members for every member | 37 | test("a container image is pulled by its address and tag", () => { |
| 38 | const pkg = { ecosystem: "container" as const, address: "g1t.sh/acme/web", name: "web", workspace: "acme" }; | |
| 39 | assert.deepEqual(installCommands(pkg, "latest", "ada"), { | |
| 40 | login: "docker login g1t.sh -u ada", | |
| 41 | install: "docker pull g1t.sh/acme/web:latest", | |
| 42 | }); | |
| 43 | assert.equal(installCommands(pkg, null, "ada").install, "docker pull g1t.sh/acme/web"); | |
| 44 | }); |