Skip to content

Commit 57eaa0c

Browse files
authored
docs: update types, export more (#758)
1 parent fe1a29c commit 57eaa0c

File tree

6 files changed

+39
-18
lines changed

6 files changed

+39
-18
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,17 @@ jobs:
6666
uses: coverallsapp/github-action@master
6767
with:
6868
github-token: ${{ secrets.GITHUB_TOKEN }}
69+
docs:
70+
name: Docs
71+
runs-on: ubuntu-latest
72+
needs: lint
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@v6
76+
- name: Use Node.js
77+
uses: actions/setup-node@v6
78+
with:
79+
node-version-file: '.nvmrc'
80+
- run: npm ci
81+
- name: Build
82+
run: npm run build:docs

.github/workflows/docs.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ jobs:
1111
steps:
1212
- name: Checkout code
1313
uses: actions/checkout@v6
14-
- run: npm i
14+
- name: Use Node.js
15+
uses: actions/setup-node@v6
16+
with:
17+
node-version-file: '.nvmrc'
18+
- run: npm ci
1519
- name: Build
1620
run: npm run build:docs
1721
- name: Deploy

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ data.*.json
4848

4949
.eslintcache
5050

51-
dist/
51+
dist/
52+
docs/

lib/models/Archimedea.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ export interface RawArchimedea extends BaseContentObject {
2323
Variables: string[];
2424
}
2525

26-
type Difficulty = { type: string; deviation: string; risks: string[] };
26+
export type Difficulty = { type: string; deviation: string; risks: string[] };
2727

28-
interface RawArchimedeaMission {
28+
export interface RawArchimedeaMission {
2929
faction: string;
3030
missionType: string;
3131
difficulties: Difficulty[];
3232
}
3333

34-
interface ArchidemeaMissionDifficultyRisk {
34+
export interface ArchimedeaMissionDifficultyRisk {
3535
key: string;
3636
name: string;
3737
description: string;
3838
isHard: boolean;
3939
}
4040

41-
interface ArchidemeaMissionDifficulty {
41+
export interface ArchimedeaMissionDifficulty {
4242
key: string;
4343
name: string;
4444
description: string;
@@ -56,15 +56,13 @@ export class ArchimedeaMission {
5656

5757
missionTypeKey: string;
5858

59-
diviation: ArchidemeaMissionDifficulty;
59+
deviation: ArchimedeaMissionDifficulty;
6060

61-
risks: ArchidemeaMissionDifficultyRisk[];
61+
risks: ArchimedeaMissionDifficultyRisk[];
6262

6363
/**
6464
* @param mission Challenge mission type
65-
* @param deviation Mission deviation
66-
* @param risks Mission risks
67-
* @param locale Locale to tranlslate to
65+
* @param locale Locale for translation
6866
*/
6967
constructor(mission: RawArchimedeaMission, locale: Locale) {
7068
this.faction = faction(mission.faction, locale);
@@ -74,7 +72,7 @@ export class ArchimedeaMission {
7472
this.missionTypeKey = missionType(mission.missionType, 'en');
7573

7674
const normal = mission.difficulties[0];
77-
this.diviation = {
75+
this.deviation = {
7876
key: normal.deviation,
7977
name: languageString(normal.deviation, locale),
8078
description: languageDesc(normal.deviation, locale),

lib/models/Kuva.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ const hash = (str: string) =>
4141
* @returns Split parsed data
4242
*/
4343
const parse = (data: KuvaLogEntry[], locale: Locale) => {
44-
const parsed = {
45-
kuva: [] as ExternalMission[],
44+
const parsed: { kuva: ExternalMission[]; arbitration: ExternalMission } = {
45+
kuva: [],
4646
arbitration: {} as ExternalMission,
4747
};
4848
const now = new Date();
4949
if (!data) return undefined;
5050
data?.forEach?.((mission) => {
51-
const p = {
51+
const p: ExternalMission = {
5252
id: '',
5353
activation: new Date(mission.start),
5454
expiry: new Date(mission.end),
@@ -58,6 +58,8 @@ const parse = (data: KuvaLogEntry[], locale: Locale) => {
5858
type: nodeMissionType(mission.solnode, locale),
5959
typeKey: nodeMissionType(mission.solnode, 'en'),
6060
expired: false,
61+
archwing: mission.solnodedata?.archwing ?? false,
62+
sharkwing: mission.solnodedata?.sharkwing ?? false,
6163
};
6264
truncateTime(p);
6365
p.id = hash(JSON.stringify(p));
@@ -73,9 +75,11 @@ const parse = (data: KuvaLogEntry[], locale: Locale) => {
7375
// if the diff is less than 2 hours?
7476
parsed.arbitration = p;
7577
}
76-
if (mission.missiontype.startsWith('KuvaMission')) parsed.kuva.push(p);
78+
if (mission.missiontype?.startsWith('KuvaMission')) {
79+
parsed.kuva.push(p);
80+
}
7781
}
78-
scrub(p);
82+
scrub(p as unknown as Record<string, unknown>);
7983
});
8084
parsed.kuva = Array.from(new Set(parsed.kuva));
8185

lib/supporting/ExternalMission.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface ExternalMission {
2727
/**
2828
* Enemy on tile
2929
*/
30-
enemy: string;
30+
enemy?: string;
3131

3232
/**
3333
* Mission type of node

0 commit comments

Comments
 (0)