mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Add transactional progressive publication, durable cancellation, responsive accept cleanup, and framework-safe Svelte and Nuxt previews.\n\nAI-assisted: OpenAI Codex.
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import {
|
|
prepareGenerationArtifact,
|
|
publishGenerationArtifact,
|
|
} from './live/generation-publisher.mjs';
|
|
|
|
const args = process.argv.slice(2);
|
|
const result = args.includes('--prepare')
|
|
? prepareGenerationArtifact({
|
|
id: arg(args, '--id'),
|
|
sourceFile: arg(args, '--file'),
|
|
})
|
|
: publishGenerationArtifact({
|
|
id: arg(args, '--id'),
|
|
epoch: Number(arg(args, '--epoch')),
|
|
sourceFile: arg(args, '--file'),
|
|
artifactFile: arg(args, '--artifact'),
|
|
expectedSourceHash: arg(args, '--expected-source-hash'),
|
|
arrivedVariants: optionalNumber(arg(args, '--arrived')),
|
|
expectedVariants: optionalNumber(arg(args, '--expected')),
|
|
});
|
|
|
|
console.log(JSON.stringify(result));
|
|
if (!result.ok) process.exitCode = 2;
|
|
|
|
function arg(values, name) {
|
|
const index = values.indexOf(name);
|
|
return index >= 0 ? values[index + 1] : undefined;
|
|
}
|
|
|
|
function optionalNumber(value) {
|
|
if (value === undefined) return undefined;
|
|
const number = Number(value);
|
|
return Number.isInteger(number) ? number : undefined;
|
|
}
|