Upd
This commit is contained in:
1 parent
c7ceebde08
commit
34dd004a06
50 files changed
+20222
-11637
No files matched your search
@@ -0,0 +1,42 @@
|
||||
// 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/
|
||||
import { createServer } from 'node:http';
|
||||
import { createReadStream } from 'node:fs';
|
||||
import { stat } from 'node:fs/promises';
|
||||
import { extname, join, normalize } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const ROOT = fileURLToPath(new URL('..', import.meta.url));
|
||||
const PORT = Number(process.argv[2]) || 8765;
|
||||
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}/src/`);
|
||||
});
|
||||
@@ -113,7 +113,7 @@ function loadProjects() {
|
||||
// Wheels → жёлтый герой Moba → зелёная фишка BattleCaps → корабль TITANS (aquatherium).
|
||||
// Выпущенные игры (bukvika, associations) — явным хвостом после арт-четвёрки. Не алфавит
|
||||
// readdirSync: карточки в #work и плашка на планете должны идти в одном порядке.
|
||||
const ART_ORDER = ['ww-wheels', 'moba', 'battlecaps', 'aquatherium', 'bukvika', 'associations'];
|
||||
const ART_ORDER = ['ww-wheels', 'moba', 'battlecaps', 'aquatherium', 'bukvika', 'associations', 'first-step-radio'];
|
||||
const out = [];
|
||||
for (const f of readdirSync(PROJ_DIR).filter((x) => x.endsWith('.md') && !x.startsWith('_'))) {
|
||||
const { meta, body } = parseFrontmatter(join(PROJ_DIR, f));
|
||||
@@ -125,6 +125,7 @@ function loadProjects() {
|
||||
badge: meta.badge || '',
|
||||
platforms: toList(meta.platforms),
|
||||
stack: toList(meta.stack),
|
||||
genre: String(meta.genre || ''),
|
||||
link: meta.link || '',
|
||||
play: meta.play || '',
|
||||
video: meta.video || '',
|
||||
@@ -158,7 +159,9 @@ function loadTeam() {
|
||||
slug,
|
||||
name: meta.name || fallback.name,
|
||||
role: meta.role || fallback.role,
|
||||
photo: sitePath(meta.photo),
|
||||
photo: sitePath(meta.photo), // реальное фото — только в расширенном профиле (окно по клику)
|
||||
mascot: sitePath(meta.mascot), // «мордочка» на карточке (плейсхолдер команды)
|
||||
city: String(meta.city || ''),
|
||||
bio: meta.bio || body,
|
||||
initials: (meta.name || fallback.name).split(/\s+/).map((w) => w[0]).join('').slice(0, 2).toUpperCase(),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user