revise late 2018 editorial articles
Build and deploy / deploy (push) Successful in 14s

This commit is contained in:
2026-07-31 10:09:53 +03:00
parent 2c7f9d37d7
commit c72a72b8f3
18 changed files with 2281 additions and 6 deletions
+10 -5
View File
@@ -6,10 +6,15 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
const execFileAsync = promisify(execFile);
const webRoot = join(fileURLToPath(new URL('..', import.meta.url)));
const scriptArgument = process.argv[2];
const argumentsAfterCommand = process.argv.slice(2);
const scriptArgument = argumentsAfterCommand.find((argument) => !argument.startsWith('--'));
const expectedCountArgument = argumentsAfterCommand.find((argument) => argument.startsWith('--expected-count='));
const expectedCount = expectedCountArgument
? Number(expectedCountArgument.slice('--expected-count='.length))
: 3;
if (!scriptArgument) {
throw new Error('Usage: node scripts/audit-editorial-draft.mjs <revision-script.mjs>');
if (!scriptArgument || !Number.isInteger(expectedCount) || expectedCount < 1) {
throw new Error('Usage: node scripts/audit-editorial-draft.mjs <revision-script.mjs> [--expected-count=N]');
}
const scriptPath = isAbsolute(scriptArgument)
@@ -65,8 +70,8 @@ try {
const imported = await import(pathToFileURL(scriptPath).href);
const revisions = imported.revisions;
if (!Array.isArray(revisions) || revisions.length !== 3) {
throw new Error('Module must export exactly three revisions');
if (!Array.isArray(revisions) || revisions.length !== expectedCount) {
throw new Error('Module must export exactly ' + expectedCount + ' revision(s)');
}
if (JSON.stringify(cliRevisions) !== JSON.stringify(revisions)) {