| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import assert from "node:assert/strict";
- import { readFile } from "node:fs/promises";
- import test from "node:test";
- test("README documents the lifecycle-free immutable Git package workflow", async () => {
- const [readme, packageText, gitVerifier] = await Promise.all([
- readFile(new URL("../README.md", import.meta.url), "utf8"),
- readFile(new URL("../package.json", import.meta.url), "utf8"),
- readFile(new URL("../scripts/verify-git-package.mjs", import.meta.url), "utf8"),
- ]);
- const packageJson = JSON.parse(packageText) as {
- bin: Record<string, string>;
- files: string[];
- scripts: Record<string, string>;
- };
- for (const script of [
- "typecheck",
- "compile",
- "test",
- "verify:runtime",
- "verify:git-package",
- "verify:package",
- "pack:verified",
- ]) {
- assert.equal(typeof packageJson.scripts[script], "string");
- assert.equal(
- readme.includes(`npm run ${script}`) || (script === "test" && readme.includes("npm test")),
- true,
- );
- }
- assert.equal(
- packageJson.bin["codex-app-server-bridge"],
- "bin/codex-app-server-bridge.js",
- );
- assert.deepEqual(packageJson.files, [
- "bin/",
- "dist/cli.js",
- "dist/config.js",
- "README.md",
- "LICENSE",
- ]);
- assert.match(readme, /npm install --global/);
- assert.doesNotMatch(readme, /npm run build|prepack/);
- assert.match(readme, /git\+https:\/\/git\.bodicsek\.host\/bodicsek\/codex-app-server-bridge\.git#v0\.1\.1/);
- assert.match(readme, /full 40-character commit/i);
- assert.match(readme, /Do not use\s+`#main`/);
- assert.match(readme, /end-user install intentionally omits `--prefix`/);
- assert.match(readme, /0\.1\.0\.tgz/);
- assert.match(readme, /npm uninstall --global codex-app-server-bridge/);
- assert.match(readme, /command -v codex-app-server-bridge/);
- assert.match(readme, /CODEX_PATH/);
- for (const argument of ["--global", "--prefix", "--ignore-scripts", "--cache"]) {
- assert.equal(gitVerifier.includes(`"${argument}"`), true, `Git verifier is missing ${argument}`);
- }
- });
|