- Remove the request form, consent checkbox, honeypot, success dialog, form.js, analytics.js, the Yandex Metrica id and the cookie banner (D23). - Contact is a mailto card to harveymonsterteam@gmail.com; privacy.html rewritten for "no data collected"; Google Fonts replaced by four self-hosted WOFF2 files, so the page makes no third-party request. - Drop `summary` from the case contract: the project dialog shows the case body only, the planet plaque uses tagline, and a project without shots opens one honest slot instead of three fake ones. - Restore the original voice and punctuation in 12 cards, strip internal wording from published copy, fix stale counts (20 projects, 5 releases). - Deploy = contents of src/: api/ moved to archive/api/, new release gate scripts/check-release.mjs, deploy guide docs/deploy.md. - Sync docs: AGENTS.md (D23, D8, R4 closed, structure), design/spec.md section 10.31, DESIGN.md, PRODUCT.md, INDEX.md, inventory.
46 lines
2.3 KiB
JavaScript
46 lines
2.3 KiB
JavaScript
// dev-server.mjs — локальная раздача проекта БЕЗ HTTP-кэша.
|
|
// Зачем: python -m http.server не шлёт Cache-Control, и браузер держит старые js/css
|
|
// во вкладке — правки «не видны» до жёсткого reload (Ctrl+Shift+R). Здесь no-store,
|
|
// поэтому обычного F5 достаточно.
|
|
//
|
|
// Запуск: node scripts/dev-server.mjs [порт] [корень] (по умолчанию 8765, корень = репозиторий)
|
|
// Страница: http://127.0.0.1:8765/src/ · форма деплоя: node scripts/dev-server.mjs 8765 src → http://127.0.0.1:8765/
|
|
import { createServer } from 'node:http';
|
|
import { createReadStream } from 'node:fs';
|
|
import { stat } from 'node:fs/promises';
|
|
import { extname, join, normalize, resolve } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const PORT = Number(process.argv[2]) || 8765;
|
|
// Корень можно задать вторым аргументом: так проверяется форма деплоя (docroot = src/).
|
|
const ROOT_ARG = process.argv[3];
|
|
const ROOT = ROOT_ARG ? resolve(ROOT_ARG) : fileURLToPath(new URL('..', import.meta.url));
|
|
const PAGE = ROOT_ARG ? '/' : '/src/';
|
|
const TYPES = {
|
|
'.html': 'text/html; charset=utf-8', '.js': 'text/javascript; charset=utf-8',
|
|
'.css': 'text/css; charset=utf-8', '.json': 'application/json; charset=utf-8',
|
|
'.svg': 'image/svg+xml', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg',
|
|
'.webp': 'image/webp', '.ico': 'image/x-icon',
|
|
};
|
|
|
|
createServer(async (req, res) => {
|
|
const url = decodeURIComponent((req.url || '/').split('?')[0]);
|
|
let file = normalize(join(ROOT, url));
|
|
if (!file.startsWith(ROOT)) { res.writeHead(403); res.end(); return; }
|
|
try {
|
|
if ((await stat(file)).isDirectory()) file = join(file, 'index.html');
|
|
const info = await stat(file);
|
|
res.writeHead(200, {
|
|
'Content-Type': TYPES[extname(file).toLowerCase()] || 'application/octet-stream',
|
|
'Content-Length': info.size,
|
|
'Cache-Control': 'no-store, must-revalidate',
|
|
});
|
|
createReadStream(file).pipe(res);
|
|
} catch {
|
|
res.writeHead(404, { 'Content-Type': 'text/plain; charset=utf-8' });
|
|
res.end('404');
|
|
}
|
|
}).listen(PORT, '127.0.0.1', () => {
|
|
console.log(`dev (no-cache): http://127.0.0.1:${PORT}${PAGE}`);
|
|
});
|