Skip to content

Commit

Permalink
feat(nuxt): typecheck on hooks and ci (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Sep 8, 2024
1 parent cd8a2cb commit 794157f
Show file tree
Hide file tree
Showing 11 changed files with 74,122 additions and 73,950 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ jobs:
- name: Create Nuxt types ⛰️
run: pnpm run postinstall

- name: Type check 🪨
run: pnpm run typecheck

- name: Build app ✨
run: pnpm run build

Expand Down
3 changes: 1 addition & 2 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

npx commitlint -g config/commitlint/.commitlintrc.json --edit $1
npx commitlint -g config/commitlint/.commitlintrc.json --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

npx --no-install validate-branch-name;
npm run prettier:gherkin:fix;
npm run lint:staged:fix;
git add -A .;
npm run typecheck;
npm run test:unit:staged;
npm run script:check-acceptance-features-shard;
13 changes: 13 additions & 0 deletions .run/Typecheck.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Typecheck" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
<scripts>
<script value="typecheck" />
</scripts>
<node-interpreter value="project" />
<package-manager value="pnpm" />
<envs />
<method v="2" />
</configuration>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<script setup lang="ts">
import { storeToRefs } from "pinia";
import type { GameEventsMonitorEventTypeComponent } from "~/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/game-events-monitor-current-event.types";
import type { Component } from "vue";
import GameAccursedWolfFatherMayHaveInfectedEvent from "~/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameAccursedWolfFatherMayHaveInfectedEvent/GameAccursedWolfFatherMayHaveInfectedEvent.vue";
import GameActorMayHaveChosenCardEvent from "~/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameActorMayHaveChosenCardEvent/GameActorMayHaveChosenCardEvent.vue";
import GameBearGrowlsOrSleepsEvent from "~/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GameBearGrowlsOrSleepsEvent/GameBearGrowlsOrSleepsEvent.vue";
Expand All @@ -48,8 +48,8 @@ import { useGameEventsStore } from "~/stores/game/game-event/useGameEventsStore"
const gameEventsStore = useGameEventsStore();
const { currentGameEvent } = storeToRefs(gameEventsStore);
const currentGameEventTypeComponent = computed<GameEventsMonitorEventTypeComponent | undefined>(() => {
const currentGameEventTypeComponents: Record<GameEventType, GameEventsMonitorEventTypeComponent> = {
const currentGameEventTypeComponent = computed<Component | undefined>(() => {
const currentGameEventTypeComponents: Record<GameEventType, Component> = {
"game-starts": GameStartsEvent,
"game-phase-starts": GamePhaseStartsEvent,
"game-turn-starts": GameTurnStartsEvent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ const { playSoundEffect } = audioStore;
const { t } = useI18n();
const thiefAdditionalCardsCount = computed<number>(() => game.value.additionalCards.filter(card => card.recipient === "thief").length);
const thiefAdditionalCardsCount = computed<number>(() => {
if (!game.value.additionalCards) {
return 0;
}
return game.value.additionalCards.filter(card => card.recipient === "thief").length;
});
const mustThiefChooseBetweenWerewolves = computed<boolean>(() => game.value.options.roles.thief.mustChooseBetweenWerewolves);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import type GamePhaseStartsEvent from "~/components/pages/game/GamePlaying/GameEventsMonitor/GameEventsMonitorCurrentEvent/GamePhaseStartsEvent/GamePhaseStartsEvent.vue";
import type { GameEvent } from "~/composables/api/game/game-event/game-event.class";

type GameEventsMonitorEventTypeComponent = typeof GamePhaseStartsEvent;

type CurrentGameEventProps = {
event: GameEvent;
};

export type {
GameEventsMonitorEventTypeComponent,
CurrentGameEventProps,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type GameEventWithTextsProps = {
};

type GameEventWithTextsEmits = {
gameEventTextChange: [string | undefined];
gameEventTextChange: [string];
};

export type {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"prepare": "is-ci || husky",
"build": "nuxt build",
"dev": "nuxt dev --dotenv env/.env.development --port 4000",
"typecheck": "nuxt typecheck",
"generate": "nuxt generate",
"preview": "npm run build && nuxt preview --dotenv env/.env.production",
"postinstall": "! ls -log -u node_modules/.bin/nuxt || nuxt prepare",
Expand Down Expand Up @@ -193,4 +194,4 @@
"linux"
],
"packageManager": "pnpm@9.9.0"
}
}
Loading

0 comments on commit 794157f

Please sign in to comment.