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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
node-version: v22.17.0

- name: Init
run: yarn install && yarn setup
run: yarn install

- name: Lint
run: yarn lint
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker compose exec -T root yarn lint:fix && yarn build && yarn test && yarn test-local
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:alpine
FROM node:24-alpine

COPY . /app
WORKDIR /app
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ docker compose down # 停止
docker compose exec root sh
```

#### セットアップ
#### ローカルセットアップ

```sh
docker compose exec root yarn setup
# インストール
yarn install

# セットアップ
yarn setup-local
```

#### ビルド
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/00-commons/CImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</template>

<script setup lang="ts">
import type { ImageType } from '@/types/element/ImageType';
import type { ImageType } from '@type/element/ImageType'

const props = defineProps<ImageType>()
const props = defineProps<ImageType>()
</script>

<style scoped>
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/01-atoms/image/Icon.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<CImage
<CImage
:src="props.src"
:width="props.width"
:height="props.height"
Expand All @@ -10,8 +10,8 @@
</template>

<script setup lang="ts">
import type { ImageType } from '@/types/element/ImageType';
import CImage from '@components/00-commons/CImage.vue';
import CImage from '@components/00-commons/CImage.vue'
import type { ImageType } from '@type/element/ImageType'

const props = defineProps<ImageType>()

Expand Down
5 changes: 3 additions & 2 deletions client/src/components/02-molecules/AppIcon.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<Icon
<Icon
:width="128"
:height="128"
:src="iconImage"
Expand All @@ -8,7 +8,8 @@

<script setup lang="ts">
import iconImage from '@assets/images/app-icon-white.svg'
import Icon from '@components/01-atoms/image/Icon.vue';

import Icon from '@components/01-atoms/image/Icon.vue'
</script>

<style scoped lang="scss">
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/03-orgnisms/AppSample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</template>

<script setup lang="ts">
import { useCounterStore } from '@/composables/state/CounterState';
import AppIcon from '../02-molecules/AppIcon.vue';
import AppIcon from '@components/02-molecules/AppIcon.vue'
import { useCounterStore } from '@composables/state/CounterState'

const counterState = useCounterStore()

Expand Down
1 change: 0 additions & 1 deletion client/src/components/04-templates/CommonTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ main {
width: 100%;
}
</style>

4 changes: 2 additions & 2 deletions client/src/components/05-pages/IndexPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</template>

<script setup lang="ts">
import CommonTemplate from '@components/04-templates/CommonTemplate.vue';
import AppSample from '@components/03-orgnisms/AppSample.vue';
import AppSample from '@components/03-orgnisms/AppSample.vue'
import CommonTemplate from '@components/04-templates/CommonTemplate.vue'

</script>

Expand Down
13 changes: 7 additions & 6 deletions client/src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
</template>

<script setup lang="ts">
import { useMeta } from '@/composables/head/Meta';
import { useRoute } from '@/composables/router';
import { clientEnvConfig } from '@/configs/ClientEnvConfig';
import { MetaConfigs } from '@/configs/routes-config/MetaConfigs';
import type { UrlPathConfigs } from '@/configs/routes-config/UrlPathConfigs';
import { clientEnvConfig } from '@configs/ClientEnvConfig'
import { MetaConfigs } from '@configs/routes-config/MetaConfigs'
import type { UrlPathConfigs } from '@configs/routes-config/UrlPathConfigs'

import { useMeta } from '@composables/head/Meta'
import { useRoute } from '@composables/router'

const route = useRoute()
useMeta(clientEnvConfig.domain).setMeta(
MetaConfigs[route.getCurrentPath() as UrlPathConfigs],
route.getCurrentPath()
route.getCurrentPath(),
)
</script>

Expand Down
3 changes: 2 additions & 1 deletion client/src/composables/head/Meta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { MetaType } from '@/types/route-types/MetaType'
import { useHead } from '@unhead/vue'

import type { MetaType } from '@type/route-types/MetaType'

export const useMeta = (root: string) => ({
setMeta: (meta: MetaType, path: string) => {
useHead({
Expand Down
6 changes: 3 additions & 3 deletions client/src/composables/router/RouteComponents.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { UrlPathConfigs } from '@configs/routes-config/UrlPathConfigs'

import IndexPage from '@components/05-pages/IndexPage.vue'

import { UrlPathConfigs } from '@/configs/routes-config/UrlPathConfigs'
import type { Component } from 'vue'
import IndexPage from '@/components/05-pages/IndexPage.vue'

export const RouteComponentRecord: Record<UrlPathConfigs, Component> = {
[UrlPathConfigs.INDEX]: IndexPage,
}

14 changes: 8 additions & 6 deletions client/src/composables/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { UrlPathConfigs } from '@/configs/routes-config/UrlPathConfigs'
import type { RouteRecordRaw } from 'vue-router'
import { createRouter, createWebHistory } from 'vue-router'
import { MetaConfigs } from '@/configs/routes-config/MetaConfigs'
import { RouteComponentRecord } from '@composables/router/RouteComponents'
import { useRoute as _useRoute } from 'vue-router'

import { MetaConfigs } from '@configs/routes-config/MetaConfigs'
import { UrlPathConfigs } from '@configs/routes-config/UrlPathConfigs'

import { RouteComponentRecord } from '@composables/router/RouteComponents'

import type { RouteRecordRaw } from 'vue-router'

const generateRouteRecordRaw = (path: UrlPathConfigs): RouteRecordRaw => ({
path: path,
name: MetaConfigs[path].pageName,
component: RouteComponentRecord[path],
})
const routeRecordRaws: RouteRecordRaw[] = Object.values(UrlPathConfigs).map((key) => generateRouteRecordRaw(key))

const routeRecordRaws: RouteRecordRaw[] = Object.values(UrlPathConfigs).map(key => generateRouteRecordRaw(key))

export const router = createRouter({
history: createWebHistory(),
Expand Down
2 changes: 1 addition & 1 deletion client/src/composables/state/CounterState.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'

interface CounterState {
count: number;
count: number
}

export const useCounterStore = defineStore('counter', {
Expand Down
5 changes: 3 additions & 2 deletions client/src/configs/routes-config/MetaConfigs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { UrlPathConfigs } from '@/configs/routes-config/UrlPathConfigs'
import type { MetaType } from '@/types/route-types/MetaType'
import { UrlPathConfigs } from '@configs/routes-config/UrlPathConfigs'

import type { MetaType } from '@type/route-types/MetaType'

export const MetaConfigs: Record<UrlPathConfigs, MetaType> = {
[UrlPathConfigs.INDEX]: {
Expand Down
3 changes: 1 addition & 2 deletions client/src/configs/routes-config/UrlPathConfigs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const UrlPathConfigs = {
INDEX: '/',
} as const
export type UrlPathConfigs = (typeof UrlPathConfigs)[keyof typeof UrlPathConfigs];

export type UrlPathConfigs = (typeof UrlPathConfigs)[keyof typeof UrlPathConfigs]
11 changes: 7 additions & 4 deletions client/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { createApp } from 'vue'
import '@assets/styles/index.scss'
import App from '@components/App.vue'
import { router } from '@composables/router'
import { createPinia } from 'pinia'

import { createHead } from '@unhead/vue/client'
import { createPinia } from 'pinia'
import { createApp } from 'vue'
import { createVuetify } from 'vuetify'

import App from '@components/App.vue'
import { router } from '@composables/router'

import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles/main.css'

Expand Down
3 changes: 2 additions & 1 deletion client/src/tests/usecases/util/LoggerUtilUsecase.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { logError, logInfo, logWarn } from '@/usecases/util/LoggerUtilUsecase'
import { describe, it, expect, vi } from 'vitest'

import { logError, logInfo, logWarn } from '@usecases/util/LoggerUtilUsecase'

describe('LoggerUtilUsecase', () => {
it('logInfo', () => {
const logSpy = vi.spyOn(console, 'info')
Expand Down
8 changes: 4 additions & 4 deletions client/src/types/element/ImageType.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type ImageType = {
src: string,
width: number,
height: number,
export type ImageType = {
src: string
width: number
height: number
alt: string
}
7 changes: 3 additions & 4 deletions client/src/usecases/util/LoggerUtilUsecase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export const logInfo = (objs: any) => console.info(`[INFO] ${objs}`)
export const logWarn = (objs: any) => console.warn(`[WARN] ${objs}`)
export const logError = (objs: any) => console.error(`[ERROR] ${objs}`)
export const logInfo = (objs: unknown) => console.info(`[INFO] ${objs}`)
export const logWarn = (objs: unknown) => console.warn(`[WARN] ${objs}`)
export const logError = (objs: unknown) => console.error(`[ERROR] ${objs}`)
2 changes: 1 addition & 1 deletion client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@composables/*": ["./src/composables/*"],
"@configs/*": ["./src/configs/*"],
"@tests/*": ["./src/tests/*"],
"@types/*": ["./src/types/*"],
"@type/*": ["./src/types/*"],
"@usecases/*": ["./src/usecases/*"],
},
"baseUrl": ".",
Expand Down
9 changes: 7 additions & 2 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ process.env.VITE_DOMAIN = domain ? `https://${domain}` : 'http://localhost'

// https://vite.dev/config/
export default defineConfig({
plugins: [vue(), vuetify({ autoImport: true })],
plugins: [
// @ts-ignore
vue(),
// @ts-ignore
vuetify({ autoImport: true })
],
server: {
host: true,
port: Number(process.env.CLIENT_PORT ?? 80),
Expand All @@ -27,7 +32,7 @@ export default defineConfig({
'@composables': path.resolve(__dirname, './src/composables'),
'@configs': path.resolve(__dirname, './src/configs'),
'@tests': path.resolve(__dirname, './src/tests'),
'@types': path.resolve(__dirname, './src/types'),
'@type': path.resolve(__dirname, './src/types'),
'@usecases': path.resolve(__dirname, './src/usecases'),
},
},
Expand Down
3 changes: 2 additions & 1 deletion client/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defineConfig } from 'vitest/config'

import viteConfig from './vite.config'

export default defineConfig({
test: {
alias: { ...( viteConfig.resolve?.alias ?? {})},
alias: { ...(viteConfig.resolve?.alias ?? {}) },
},
})
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ services:
volumes:
- ./:/app
- /app/node_modules
- /app/client/node_modules
- /app/server/node_modules
- /app/infra/node_modules
ports:
- "${CLIENT_PORT}:${CLIENT_PORT}"
- "${SERVER_PORT}:${SERVER_PORT}"
Expand Down
Loading