Fix map wrap, touch and keyboard input; harden build and release workflow; docs
This commit is contained in:
parent
f51c68a8ac
commit
494d71793e
6 changed files with 91 additions and 40 deletions
|
|
@ -4,22 +4,23 @@ const fs = require('node:fs');
|
|||
const path = require('node:path');
|
||||
const { execFileSync } = require('node:child_process');
|
||||
|
||||
const OUT = require('node:fs').mkdtempSync(require('node:path').join(require('node:os').tmpdir(), 'tubes-build-'));
|
||||
const root = path.join(__dirname, '..');
|
||||
|
||||
test('build stamps version and date into the site', () => {
|
||||
execFileSync('bash', ['scripts/build.sh'], { cwd: root, env: { ...process.env, VERSION: '9.9.9', BUILD_DATE: '2030-01-01' } });
|
||||
const html = fs.readFileSync(path.join(root, '_site', 'index.html'), 'utf8');
|
||||
execFileSync('bash', ['scripts/build.sh'], { cwd: root, env: { ...process.env, OUT, VERSION: '9.9.9', BUILD_DATE: '2030-01-01' } });
|
||||
const html = fs.readFileSync(path.join(OUT, 'index.html'), 'utf8');
|
||||
assert.match(html, /const APP_VERSION='9\.9\.9'/);
|
||||
assert.match(html, /"softwareVersion": "9\.9\.9"/);
|
||||
assert.match(fs.readFileSync(path.join(root, '_site', 'sitemap.xml'), 'utf8'), /<lastmod>2030-01-01<\/lastmod>/);
|
||||
assert.match(fs.readFileSync(path.join(OUT, 'sitemap.xml'), 'utf8'), /<lastmod>2030-01-01<\/lastmod>/);
|
||||
for (const f of ['favicon.svg', 'favicon.ico', 'apple-touch-icon.png', 'icon-192.png', 'icon-512.png', 'site.webmanifest', 'robots.txt', 'images/og-image.png', '404.html', 'CNAME', 'version.json']) {
|
||||
assert.ok(fs.existsSync(path.join(root, '_site', f)), `${f} is shipped`);
|
||||
assert.ok(fs.existsSync(path.join(OUT, f)), `${f} is shipped`);
|
||||
}
|
||||
});
|
||||
|
||||
test('version.json carries the release notes from the changelog', () => {
|
||||
execFileSync('bash', ['scripts/build.sh'], { cwd: root, env: { ...process.env, VERSION: '1.0.0', BUILD_DATE: '2026-10-23' } });
|
||||
const v = JSON.parse(fs.readFileSync(path.join(root, '_site', 'version.json'), 'utf8'));
|
||||
execFileSync('bash', ['scripts/build.sh'], { cwd: root, env: { ...process.env, OUT, VERSION: '1.0.0', BUILD_DATE: '2026-10-23' } });
|
||||
const v = JSON.parse(fs.readFileSync(path.join(OUT, 'version.json'), 'utf8'));
|
||||
assert.equal(v.version, '1.0.0');
|
||||
assert.ok(v.notes.length >= 5);
|
||||
assert.ok(v.notes.every((n) => !n.startsWith('-')));
|
||||
|
|
@ -34,3 +35,8 @@ test('head carries the SEO and social metadata', () => {
|
|||
JSON.parse(block.replace(/<\/?script[^>]*>/g, ''));
|
||||
}
|
||||
});
|
||||
|
||||
test('a release build refuses to ship without release notes', () => {
|
||||
assert.throws(() => execFileSync('bash', ['scripts/build.sh'], { cwd: root, stdio: 'pipe', env: { ...process.env, OUT, VERSION: '9.9.9', REQUIRE_NOTES: '1' } }));
|
||||
assert.throws(() => execFileSync('bash', ['scripts/build.sh'], { cwd: root, stdio: 'pipe', env: { ...process.env, OUT, VERSION: '1.0; rm -rf /' } }), 'junk versions are rejected');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ const path = require('node:path');
|
|||
const { execFileSync } = require('node:child_process');
|
||||
const { load } = require('./harness');
|
||||
|
||||
const OUT = require('node:fs').mkdtempSync(require('node:path').join(require('node:os').tmpdir(), 'tubes-build-'));
|
||||
const root = path.join(__dirname, '..');
|
||||
|
||||
function playedGame() {
|
||||
|
|
@ -31,8 +32,8 @@ test('leaving the page saves the game', () => {
|
|||
|
||||
test('returning players see what is new after an update, once', () => {
|
||||
const { saved } = playedGame();
|
||||
execFileSync('bash', ['scripts/build.sh'], { cwd: root, env: { ...process.env, VERSION: '1.1.0', BUILD_DATE: '2026-10-23' } });
|
||||
const file = path.join(root, '_site', 'index.html');
|
||||
execFileSync('bash', ['scripts/build.sh'], { cwd: root, env: { ...process.env, OUT, VERSION: '1.1.0', BUILD_DATE: '2026-10-23' } });
|
||||
const file = path.join(OUT, 'index.html');
|
||||
const b = load({ file, storage: { 'sot-save-v1': saved, 'sot-seen-version': '1.0.0' } });
|
||||
const text = b.ev("document.getElementById('modalCard').textContent");
|
||||
assert.match(text, /New in Series of Tubes 1\.1\.0/);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue