feat: publish Regex Tools 0.2.0
This commit is contained in:
@@ -1,8 +1,37 @@
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import {
|
||||
buildPcre2Pack,
|
||||
parsePcre2BuildArguments,
|
||||
} from "./pcre2-engine-pack.mjs";
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const options = parsePcre2BuildArguments(process.argv.slice(2));
|
||||
|
||||
if (options.mode === "help") {
|
||||
console.log(`Usage:
|
||||
node scripts/build-engines.mjs
|
||||
node scripts/build-engines.mjs --pcre2 --source-dir PATH --emcc PATH [--force]
|
||||
|
||||
The PCRE2 command is an explicit offline build gate. It verifies exact local
|
||||
source and compiler identities, writes .engine-build/pcre2, and never
|
||||
downloads or publishes an engine pack. Install the verified local pack with
|
||||
npm run engines:pcre2:install.`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (options.mode === "pcre2") {
|
||||
const result = await buildPcre2Pack(options, root);
|
||||
console.log(
|
||||
`Built and verified staged PCRE2 ${result.metadata.engineVersion} pack at ${result.output}.`,
|
||||
);
|
||||
console.log(
|
||||
"The verified pack remains in private staging until the explicit local install command is run.",
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
const packageJson = JSON.parse(
|
||||
await readFile(path.join(root, "package.json"), "utf8"),
|
||||
);
|
||||
@@ -10,15 +39,16 @@ const engineDirectory = path.join(root, "public", "engines");
|
||||
const entries = (await readdir(engineDirectory)).sort();
|
||||
|
||||
if (
|
||||
packageJson.version !== "0.1.0" ||
|
||||
entries.length !== 1 ||
|
||||
entries[0] !== "README.md"
|
||||
typeof packageJson.version !== "string" ||
|
||||
entries.length !== 2 ||
|
||||
entries[0] !== "README.md" ||
|
||||
entries[1] !== "pcre2"
|
||||
) {
|
||||
throw new Error(
|
||||
"The ECMAScript release must contain only the documented native-browser engine placeholder.",
|
||||
"The production build requires the documented PCRE2 runtime pack.",
|
||||
);
|
||||
}
|
||||
|
||||
console.log(
|
||||
"Regex Tools 0.1.0 uses the native browser RegExp engine; no external engine pack needs building.",
|
||||
"The checked-in PCRE2 runtime pack is present; no release-time download or engine compilation is needed.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user