Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,17 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
docs:
name: Docs
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- run: npm ci
- name: Build
run: npm run build:docs
6 changes: 5 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v6
- run: npm i
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
- run: npm ci
- name: Build
run: npm run build:docs
- name: Deploy
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ data.*.json

.eslintcache

dist/
dist/
docs/
18 changes: 8 additions & 10 deletions lib/models/Archimedea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ export interface RawArchimedea extends BaseContentObject {
Variables: string[];
}

type Difficulty = { type: string; deviation: string; risks: string[] };
export type Difficulty = { type: string; deviation: string; risks: string[] };

interface RawArchimedeaMission {
export interface RawArchimedeaMission {
faction: string;
missionType: string;
difficulties: Difficulty[];
}

interface ArchidemeaMissionDifficultyRisk {
export interface ArchimedeaMissionDifficultyRisk {
key: string;
name: string;
description: string;
isHard: boolean;
}

interface ArchidemeaMissionDifficulty {
export interface ArchimedeaMissionDifficulty {
key: string;
name: string;
description: string;
Expand All @@ -56,15 +56,13 @@ export class ArchimedeaMission {

missionTypeKey: string;

diviation: ArchidemeaMissionDifficulty;
deviation: ArchimedeaMissionDifficulty;

risks: ArchidemeaMissionDifficultyRisk[];
risks: ArchimedeaMissionDifficultyRisk[];

/**
* @param mission Challenge mission type
* @param deviation Mission deviation
* @param risks Mission risks
* @param locale Locale to tranlslate to
* @param locale Locale for translation
*/
constructor(mission: RawArchimedeaMission, locale: Locale) {
this.faction = faction(mission.faction, locale);
Expand All @@ -74,7 +72,7 @@ export class ArchimedeaMission {
this.missionTypeKey = missionType(mission.missionType, 'en');

const normal = mission.difficulties[0];
this.diviation = {
this.deviation = {
key: normal.deviation,
name: languageString(normal.deviation, locale),
description: languageDesc(normal.deviation, locale),
Expand Down
14 changes: 9 additions & 5 deletions lib/models/Kuva.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ const hash = (str: string) =>
* @returns Split parsed data
*/
const parse = (data: KuvaLogEntry[], locale: Locale) => {
const parsed = {
kuva: [] as ExternalMission[],
const parsed: { kuva: ExternalMission[]; arbitration: ExternalMission } = {
kuva: [],
arbitration: {} as ExternalMission,
};
const now = new Date();
if (!data) return undefined;
data?.forEach?.((mission) => {
const p = {
const p: ExternalMission = {
id: '',
activation: new Date(mission.start),
expiry: new Date(mission.end),
Expand All @@ -58,6 +58,8 @@ const parse = (data: KuvaLogEntry[], locale: Locale) => {
type: nodeMissionType(mission.solnode, locale),
typeKey: nodeMissionType(mission.solnode, 'en'),
expired: false,
archwing: mission.solnodedata?.archwing ?? false,
sharkwing: mission.solnodedata?.sharkwing ?? false,
};
truncateTime(p);
p.id = hash(JSON.stringify(p));
Expand All @@ -73,9 +75,11 @@ const parse = (data: KuvaLogEntry[], locale: Locale) => {
// if the diff is less than 2 hours?
parsed.arbitration = p;
}
if (mission.missiontype.startsWith('KuvaMission')) parsed.kuva.push(p);
if (mission.missiontype?.startsWith('KuvaMission')) {
parsed.kuva.push(p);
}
}
scrub(p);
scrub(p as unknown as Record<string, unknown>);
});
parsed.kuva = Array.from(new Set(parsed.kuva));

Expand Down
2 changes: 1 addition & 1 deletion lib/supporting/ExternalMission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface ExternalMission {
/**
* Enemy on tile
*/
enemy: string;
enemy?: string;

/**
* Mission type of node
Expand Down