Add Legends: Arceus tracker and bundle offline sprites on dev
Add standalone Pokémon Legends: Arceus POC tracker (Hisui 242 Pokédex, Research Tasks & RL10 mode, Satchel MP & Save Mythicals toggles, Noble/story battles, saves/movesets), bundle local sprite packs across all three trackers into Git/Docker/Nginx with attribution credits, and update Hub landing page & unified server/tests.
This commit is contained in:
1 parent
708bf6b58c
commit
6b693cc3c6
2672 files changed
+35017
-35
No files matched your search
+39
-3
@@ -13,6 +13,9 @@ import { createTrackerStore as createOrasStore, computeGameProgress as computeOr
|
||||
import { renderHeader as renderLumiHeader } from '../luminescent-platinum/src/ui/header.js';
|
||||
import { getGame as getLumiGame } from '../luminescent-platinum/src/data/games/index.js';
|
||||
import { createTrackerStore as createLumiStore, computeGameProgress as computeLumiProgress } from '../luminescent-platinum/src/state/tracker-store.js';
|
||||
import { renderHeader as renderPlaHeader } from '../legends-arceus/src/ui/header.js';
|
||||
import { getGame as getPlaGame } from '../legends-arceus/src/data/games/index.js';
|
||||
import { createTrackerStore as createPlaStore, computeGameProgress as computePlaProgress } from '../legends-arceus/src/state/tracker-store.js';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT_DIR = path.resolve(__dirname, '..');
|
||||
@@ -43,10 +46,15 @@ test('Unified hub server serves landing page, trailing-slash redirects, both sub
|
||||
const hubHtml = await hubRes.text();
|
||||
assert.ok(hubHtml.includes('href="./oras/"'));
|
||||
assert.ok(hubHtml.includes('href="./luminescent-platinum/"'));
|
||||
assert.ok(hubHtml.includes('href="./legends-arceus/"'));
|
||||
assert.ok(hubHtml.includes('src="./oras/assets/sprites/'));
|
||||
assert.ok(hubHtml.includes('src="./luminescent-platinum/assets/sprites/'));
|
||||
assert.ok(hubHtml.includes('src="./legends-arceus/assets/sprites/'));
|
||||
assert.equal(hubHtml.includes('https://raw.githubusercontent.com/'), false);
|
||||
assert.ok(hubHtml.includes('href="./assets/favicon.svg"'));
|
||||
assert.ok(hubHtml.includes('https://git.trevorstocks.ca/FaroeGames/oaktracker/issues'));
|
||||
|
||||
for (const iconPath of ['/assets/favicon.svg', '/oras/favicon.svg', '/luminescent-platinum/favicon.svg']) {
|
||||
for (const iconPath of ['/assets/favicon.svg', '/oras/favicon.svg', '/luminescent-platinum/favicon.svg', '/legends-arceus/favicon.svg']) {
|
||||
const iconRes = await fetch(`http://127.0.0.1:${port}${iconPath}`);
|
||||
assert.equal(iconRes.status, 200);
|
||||
assert.match(iconRes.headers.get('content-type') || '', /image\/svg\+xml/);
|
||||
@@ -61,7 +69,7 @@ test('Unified hub server serves landing page, trailing-slash redirects, both sub
|
||||
assert.equal(healthRes.status, 200);
|
||||
assert.deepEqual(await healthRes.json(), { status: 'ok' });
|
||||
|
||||
for (const folder of ['/oras', '/luminescent-platinum']) {
|
||||
for (const folder of ['/oras', '/luminescent-platinum', '/legends-arceus']) {
|
||||
const redirRes = await fetch(`http://127.0.0.1:${port}${folder}`, { redirect: 'manual' });
|
||||
assert.equal(redirRes.status, 301);
|
||||
assert.equal(redirRes.headers.get('location'), `${folder}/`);
|
||||
@@ -76,7 +84,7 @@ test('Unified hub server serves landing page, trailing-slash redirects, both sub
|
||||
const statusRes = await fetch(`http://127.0.0.1:${port}${folder}/api/assets-status`);
|
||||
assert.equal(statusRes.status, 200);
|
||||
const statusJson = await statusRes.json();
|
||||
assert.equal(typeof statusJson.hasLocalSprites, 'boolean');
|
||||
assert.equal(statusJson.hasLocalSprites, true);
|
||||
}
|
||||
|
||||
const badStatus = await new Promise((resolve, reject) => {
|
||||
@@ -121,6 +129,16 @@ test('Landing page save detection reads both ORAS and Luminescent localStorage k
|
||||
},
|
||||
}),
|
||||
'lumi-poc-tracker:v1:luminescent-platinum': JSON.stringify({ caught: ['chimchar', 'starly'] }),
|
||||
'pla-poc-tracker:v1:app-meta': JSON.stringify({
|
||||
activeGameId: 'legends-arceus',
|
||||
profilesByGame: {
|
||||
'legends-arceus': {
|
||||
activeProfileId: 'default',
|
||||
profiles: [{ id: 'default', name: 'Hisui Survey' }],
|
||||
},
|
||||
},
|
||||
}),
|
||||
'pla-poc-tracker:v1:legends-arceus': JSON.stringify({ caught: ['rowlet', 'bidoof', 'starly'], rl10: ['rowlet'] }),
|
||||
});
|
||||
|
||||
const makeEl = () => ({
|
||||
@@ -136,11 +154,14 @@ test('Landing page save detection reads both ORAS and Luminescent localStorage k
|
||||
orasEl.classList._owner = orasEl;
|
||||
const lumiEl = makeEl();
|
||||
lumiEl.classList._owner = lumiEl;
|
||||
const plaEl = makeEl();
|
||||
plaEl.classList._owner = plaEl;
|
||||
|
||||
const fakeDoc = {
|
||||
getElementById(id) {
|
||||
if (id === 'oras-save-badge') return orasEl;
|
||||
if (id === 'lumi-save-badge') return lumiEl;
|
||||
if (id === 'pla-save-badge') return plaEl;
|
||||
return null;
|
||||
},
|
||||
};
|
||||
@@ -150,6 +171,8 @@ test('Landing page save detection reads both ORAS and Luminescent localStorage k
|
||||
assert.equal(orasEl.classes.has('has-save'), true);
|
||||
assert.equal(lumiEl.textContent, 'Saved (Sinnoh Run): 2 caught');
|
||||
assert.equal(lumiEl.classes.has('has-save'), true);
|
||||
assert.equal(plaEl.textContent, 'Saved (Hisui Survey): 3 caught · 1 RL10');
|
||||
assert.equal(plaEl.classes.has('has-save'), true);
|
||||
});
|
||||
|
||||
test('Both trackers expose a relative Hub navigation link and valid Docker/Nginx packaging', async () => {
|
||||
@@ -167,12 +190,23 @@ test('Both trackers expose a relative Hub navigation link and valid Docker/Nginx
|
||||
assert.ok(lumiHdr.includes('href="../"'));
|
||||
assert.ok(lumiHdr.includes('https://git.trevorstocks.ca/FaroeGames/oaktracker/issues'));
|
||||
|
||||
const plaStore = createPlaStore({ storage: makeMemoryStorage() });
|
||||
const plaGame = getPlaGame();
|
||||
const plaProg = computePlaProgress(plaGame, plaStore.getState().caught, plaStore.getState().rl10, plaStore.getState().progressMode);
|
||||
const plaHdr = renderPlaHeader(plaGame, plaStore.getState(), plaProg);
|
||||
assert.ok(plaHdr.includes('href="../"'));
|
||||
assert.ok(plaHdr.includes('https://git.trevorstocks.ca/FaroeGames/oaktracker/issues'));
|
||||
|
||||
const dockerfile = await fs.readFile(path.join(ROOT_DIR, 'Dockerfile'), 'utf8');
|
||||
for (const match of dockerfile.matchAll(/^COPY\s+(\S+)\s+/gm)) {
|
||||
const srcRel = match[1];
|
||||
const stat = await fs.stat(path.join(ROOT_DIR, srcRel));
|
||||
assert.ok(stat.isFile() || stat.isDirectory(), `Dockerfile COPY target missing: ${srcRel}`);
|
||||
}
|
||||
assert.ok(dockerfile.includes('oras/assets/'));
|
||||
assert.ok(dockerfile.includes('luminescent-platinum/assets/'));
|
||||
assert.ok(dockerfile.includes('legends-arceus/assets/'));
|
||||
assert.ok(dockerfile.includes('legends-arceus/src/'));
|
||||
|
||||
const nginxConf = await fs.readFile(path.join(ROOT_DIR, 'docker/nginx.conf'), 'utf8');
|
||||
assert.ok(dockerfile.includes('EXPOSE 28473'));
|
||||
@@ -181,6 +215,8 @@ test('Both trackers expose a relative Hub navigation link and valid Docker/Nginx
|
||||
assert.ok(nginxConf.includes('application/javascript mjs;'));
|
||||
assert.ok(nginxConf.includes('location = /oras'));
|
||||
assert.ok(nginxConf.includes('location = /luminescent-platinum'));
|
||||
assert.ok(nginxConf.includes('location = /legends-arceus'));
|
||||
assert.ok(nginxConf.includes('try_files /legends-arceus/assets/sprites/.ready.json'));
|
||||
|
||||
const giteaWorkflow = await fs.readFile(path.join(ROOT_DIR, '.gitea/workflows/docker-publish.yml'), 'utf8');
|
||||
assert.ok(giteaWorkflow.includes('git.trevorstocks.ca/faroegames/oaktracker'));
|
||||
|
||||
Reference in new issue
Block a user