20 lines
2.4 KiB
JavaScript
20 lines
2.4 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import assert from 'node:assert/strict';
|
|
import { createHash } from 'node:crypto';
|
|
import { execFileSync } from 'node:child_process';
|
|
const folders = ['src', 'tests', 'scripts', 'benchmarks', 'public', 'examples', 'research'];
|
|
const top = ['package.json', 'package-lock.json', 'vite.config.ts', 'tsconfig.json', 'index.html', 'mobile.html', '.gitattributes', '.gitignore', 'Start-Desktop.cmd', 'Start-Workbench.cmd', 'Stop-Workbench.cmd'];
|
|
assert.equal(execFileSync('git', ['status', '--porcelain', '--', ...folders, ...top], { encoding: 'utf8', windowsHide: true }).trim(), '', 'All executable and QA inputs must be committed.');
|
|
const files = (root, relative = '') => fs.readdirSync(path.join(root, relative), { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name)).flatMap(entry => {
|
|
const file = path.join(relative, entry.name); return entry.isDirectory() ? files(root, file) : [path.join(root, file)];
|
|
});
|
|
const rows = names => names.sort().map(file => { const bytes = fs.readFileSync(file); return { path: file.replaceAll('\\', '/'), bytes: bytes.length, sha256: createHash('sha256').update(bytes).digest('hex') }; });
|
|
const version = JSON.parse(fs.readFileSync('package.json')).version; assert.equal(version, '1.17.0');
|
|
const codeCommit = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim();
|
|
const inputs = rows(folders.flatMap(folder => files(folder)).concat(top)), builds = rows(['dist-client', 'dist-server', 'dist-desktop'].flatMap(folder => files(folder))), benchmarks = rows(files('benchmarks'));
|
|
const result = { success: true, version, codeCommit, capturedAt: new Date().toISOString(), inputs, builds, benchmarks,
|
|
scope: 'All executable source/test/QA/build inputs including mobile.html, all client/mobile/server/desktop build bytes and original benchmark inputs. Current workspace regression and current Responses engineering and native observation evidence are separate from final independently extracted source and contained release acceptance.' };
|
|
for (const file of ['docs/model-protocols-release-code-baseline.json', '.qa/model-protocols-release-code-baseline.json']) fs.writeFileSync(file, JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
|
|
console.log(JSON.stringify({ success: true, version, codeCommit, inputs: inputs.length, builds: builds.length, benchmarks: benchmarks.length }));
|