Refractoring Stage 2 Add Refractor plan.md

This commit is contained in:
2026-10-16 16:27:09 +03:00
parent e5391dbb62
commit e398bc4e1a
23 changed files with 1259 additions and 370 deletions
+33
View File
@@ -0,0 +1,33 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs/promises');
const path = require('node:path');
const root = path.resolve(__dirname, '..');
const generated = path.join(root, 'www');
const webAssetExtensions = new Set(['.css', '.html', '.js', '.svg', '.webmanifest']);
test('generated www web assets match their root source files', async () => {
const entries = await fs.readdir(root, { withFileTypes: true });
const assets = entries
.filter(entry => entry.isFile() && webAssetExtensions.has(path.extname(entry.name)))
.map(entry => entry.name);
assert.ok(assets.length > 0, 'expected root web assets to be present');
for (const asset of assets) {
const sourcePath = path.join(root, asset);
const generatedPath = path.join(generated, asset);
const [source, output] = await Promise.all([
fs.readFile(sourcePath),
fs.readFile(generatedPath).catch(error => {
if (error.code === 'ENOENT') {
assert.fail(`generated web asset is missing: www/${asset}`);
}
throw error;
})
]);
assert.deepEqual(output, source, `www/${asset} is stale; rebuild Android web assets`);
}
});