diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index 53fcbf56..c4b63e45 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -9,30 +9,30 @@ jobs: build: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: "3.10" - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 21 - uses: aws-actions/setup-sam@v2 - - uses: aws-actions/configure-aws-credentials@v1 + - uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ap-northeast-2 - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 with: - version: 7 + version: 9 run_install: false - name: Get pnpm store directory id: pnpm-cache run: | echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" - name: Setup pnpm cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -45,6 +45,6 @@ jobs: - name: Build run: pnpm build - name: Deploy server - run: pnpm -r --filter=server run deploy --parameter-overrides "JwtSecret=\"${{ secrets.JWT_SECRET }}\"" + run: pnpm -r --filter=server run deploy --parameter-overrides "JwtSecret=\"${{ secrets.JWT_SECRET }}\" SsutodaySecret=\"${{ secrets.SSUTODAY_SECRET }}\"" - name: Deploy client run: pnpm -r --filter=client run deploy diff --git a/.github/workflows/lint-check.yml b/.github/workflows/lint-check.yml index b650fab6..774ab7f9 100644 --- a/.github/workflows/lint-check.yml +++ b/.github/workflows/lint-check.yml @@ -7,21 +7,23 @@ jobs: check: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 21 + - name: Enable corepack + run: corepack enable - name: Install pnpm - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 with: - version: 7 + version: 9 run_install: false - name: Get pnpm store directory id: pnpm-cache run: | echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" - name: Setup pnpm cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -29,20 +31,16 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install Dependencies run: pnpm install --frozen-lockfile + - name: Build client + run: pnpm -r --filter=client build - name: Run prettier check run: pnpm -r prettier - name: Run eslint in server and types run: pnpm -r --filter=!client lint - name: Run eslint on changed files in client - uses: tj-actions/eslint-changed-files@v13.3 + uses: tj-actions/eslint-changed-files@v25 with: path: "./packages/client" - file_extensions: | - **/*.ts - **/*.svelte - **/*.js - **/*.json - - name: Build client - run: pnpm -r --filter=client build + file_extensions: "**/*.{ts, svelte}" - name: Run svelte-check run: pnpm -r check diff --git a/.github/workflows/openapi-gen.yml b/.github/workflows/openapi-gen.yml index 6b317280..0a757b15 100644 --- a/.github/workflows/openapi-gen.yml +++ b/.github/workflows/openapi-gen.yml @@ -8,16 +8,17 @@ on: jobs: openapi-gen: runs-on: ubuntu-22.04 + permissions: write-all steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Generate Swagger UI uses: Legion2/swagger-ui-action@v1 with: output: swagger-ui spec-file: "packages/server/api.yaml" - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: swagger-ui \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..7f0d6791 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "eslint.workingDirectories": [ + "packages/client", + "packages/server", + "packages/types" + ], + "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "svelte"] + } \ No newline at end of file diff --git a/README.md b/README.md index 69007588..decb7188 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@

숭실대학교 사물함 예약 시스템

숭실대학교 학생들의 사물함 예약을 편리하게 하기 위한 예약 시스템입니다.

- Version - License - API Docs - Website - GitHub Workflow Status + Version + License + API Docs + Website + GitHub Workflow Status

----- diff --git a/package.json b/package.json index 43d0c416..854944f4 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,10 @@ "private": true, "scripts": { "build": "concurrently -p \"[{name} / {time}]\" -c \"green,magenta\" -n \"client,server\" \"pnpm run -r --filter=client build \" \"pnpm run -r -filter=server build\"", - "dev": "concurrently -p \"[{name} / {time}]\" -c \"green,magenta\" -n \"client,server\" \"pnpm run -r --filter=client dev \" \"pnpm run -r -filter=server dev\"", + "dev": "concurrently -p \"[{name} / {time}]\" -c \"green,blue,magenta\" -n \"client,server(tsc),server\" \"pnpm run -r --filter=client dev \" \"pnpm run -r --filter=server watch\" \"pnpm run -r -filter=server dev\"", "delete": "pnpm run --filter=client delete && pnpm run --filter=server delete", - "deploy": "node ./scripts/deploy.js" + "deploy": "node ./scripts/deploy.js", + "cf-invalidate": "node ./scripts/cf-invalidate.js" }, "repository": { "type": "git", @@ -23,7 +24,7 @@ }, "homepage": "https://github.com/EATSTEAK/lockerweb", "devDependencies": { - "concurrently": "^7.3.0", - "lint-staged": "^13.0.3" + "concurrently": "^8.2.1", + "lint-staged": "^15.2.8" } } diff --git a/packages/client/.eslintrc.cjs b/packages/client/.eslintrc.cjs index 87d3d5b6..e19e7d14 100644 --- a/packages/client/.eslintrc.cjs +++ b/packages/client/.eslintrc.cjs @@ -1,13 +1,35 @@ module.exports = { root: true, - extends: ['plugin:import/recommended', 'eslint:recommended'], - plugins: ['svelte3', '@typescript-eslint', 'tailwindcss'], - ignorePatterns: ['*.cjs'], + extends: ['plugin:import/recommended', 'eslint:recommended', 'plugin:svelte/recommended'], + plugins: ['@typescript-eslint', 'tailwindcss'], + ignorePatterns: ['*.cjs', '*.js'], + parserOptions: { + project: 'tsconfig.json', + sourceType: 'module', + ecmaVersion: 2020, + extraFileExtensions: ['.svelte'], + }, + env: { + browser: true, + es2017: true, + node: true, + }, + settings: { + svelte: { + kit: { + files: { + routes: 'src/routes', + }, + }, + }, + }, overrides: [ { files: ['*.svelte'], - processor: 'svelte3/svelte3', - parser: '@typescript-eslint/parser', + parser: 'svelte-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser', + }, extends: [ 'plugin:import/typescript', 'airbnb-typescript/base', @@ -17,6 +39,11 @@ module.exports = { ], rules: { '@typescript-eslint/indent': 'off', + '@typescript-eslint/no-throw-literal': 'off', + 'import/no-extraneous-dependencies': 'off', + 'import/extensions': 'off', + 'import/no-unresolved': 'off', + 'no-undef': 'off', }, }, { @@ -30,20 +57,11 @@ module.exports = { ], rules: { '@typescript-eslint/indent': 'off', + '@typescript-eslint/no-throw-literal': 'off', + 'import/no-extraneous-dependencies': 'off', + 'import/extensions': 'off', + 'import/no-unresolved': 'off', }, }, ], - settings: { - 'svelte3/typescript': () => require('typescript'), - }, - parserOptions: { - project: 'tsconfig.json', - sourceType: 'module', - ecmaVersion: 2020, - }, - env: { - browser: true, - es2017: true, - node: true, - }, }; diff --git a/packages/client/.prettierrc b/packages/client/.prettierrc index da3f9a0d..03b637a9 100644 --- a/packages/client/.prettierrc +++ b/packages/client/.prettierrc @@ -2,5 +2,6 @@ "singleQuote": true, "trailingComma": "all", "printWidth": 100, - "bracketSameLine": true + "bracketSameLine": true, + "plugins": ["prettier-plugin-tailwindcss"] } diff --git a/packages/client/package.json b/packages/client/package.json index 12ab0d53..e648f967 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,50 +1,54 @@ { "name": "client", - "version": "1.0.2", + "version": "1.1.0", "scripts": { - "dev": "cross-env VITE_BASE_URL=http://localhost:3000 vite dev --port 5002 --host 0.0.0.0", - "build": "vite build", + "dev": "vite dev --port 5002 --host 0.0.0.0", + "build": "cross-env VITE_BASE_URL= vite build", "package": "svelte-kit package", "preview": "vite preview", "check": "svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", - "prettier": "prettier --check --plugin-search-dir=. . ", + "prettier": "prettier --check . ", "lint": "eslint .", - "format": "eslint . --fix && prettier --write --plugin-search-dir=. .", + "format": "eslint . --fix && prettier --write .", "delete": "node ./scripts/delete.js", "deploy": "node ./scripts/deploy.js" }, "devDependencies": { - "@sveltejs/adapter-auto": "1.0.0-next.65", - "@sveltejs/adapter-static": "1.0.0-next.39", - "@sveltejs/kit": "1.0.0-next.431", - "@tailwindcss/forms": "^0.5.2", - "@types/lodash.isequal": "^4.5.6", - "@typescript-eslint/eslint-plugin": "^5.27.0", - "@typescript-eslint/parser": "^5.27.0", - "autoprefixer": "^10.4.7", + "@sveltejs/adapter-auto": "3.2.3", + "@sveltejs/adapter-static": "3.0.3", + "@sveltejs/kit": "^2.5.21", + "@sveltejs/vite-plugin-svelte": "^3.1.1", + "@tailwindcss/forms": "^0.5.7", + "@types/lodash.isequal": "^4.5.8", + "@typescript-eslint/eslint-plugin": "^7.0.0", + "@typescript-eslint/parser": "^7.0.0", + "autoprefixer": "^10.4.19", "cross-env": "^7.0.3", - "eslint": "^8.16.0", - "eslint-config-airbnb-typescript": "^16.2.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-svelte3": "^4.0.0", - "eslint-plugin-tailwindcss": "^3.6.0", - "postcss": "^8.4.14", - "postcss-load-config": "^4.0.1", - "prettier": "^2.6.2", - "prettier-plugin-tailwindcss": "^0.1.13", - "svelte": "^3.44.0", - "svelte-check": "^2.7.1", - "svelte-preprocess": "^4.10.7", - "tailwindcss": "^3.1.5", - "tslib": "^2.3.1", - "typescript": "^4.7.4", - "vite": "^3.0.0", - "zod": "^3.18.0" + "eslint": "^8.57.0", + "eslint-config-airbnb-typescript": "^18.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-svelte": "^2.42.0", + "eslint-plugin-tailwindcss": "^3.17.4", + "konva": "^9.3.13", + "postcss": "^8.4.39", + "postcss-load-config": "^5.1.0", + "prettier": "^3.3.3", + "prettier-plugin-tailwindcss": "^0.6.6", + "svelte": "^4.2.18", + "svelte-check": "^3.8.4", + "svelte-konva": "^0.3.1", + "svelte-preprocess": "^6.0.2", + "tailwindcss": "^3.4.5", + "tslib": "^2.6.3", + "typescript": "^5.5.3", + "vite": "^5.4.0", + "zod": "^3.23.8" }, "type": "module", "dependencies": { + "canvas": "^2.11.2", "lodash.isequal": "^4.5.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.18.10/xlsx-0.18.10.tgz" } diff --git a/packages/client/prettier.config.cjs b/packages/client/prettier.config.cjs deleted file mode 100644 index 5f35d01b..00000000 --- a/packages/client/prettier.config.cjs +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - plugins: [require('prettier-plugin-tailwindcss')], -}; diff --git a/packages/client/src/app.css b/packages/client/src/app.css index c853d77f..7a96cb54 100644 --- a/packages/client/src/app.css +++ b/packages/client/src/app.css @@ -14,9 +14,22 @@ html { } :root { - font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, - Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', - 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif; + font-family: + 'Pretendard Variable', + Pretendard, + -apple-system, + BlinkMacSystemFont, + system-ui, + Roboto, + 'Helvetica Neue', + 'Segoe UI', + 'Apple SD Gothic Neo', + 'Noto Sans KR', + 'Malgun Gothic', + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Segoe UI Symbol', + sans-serif; @apply text-gray-700; } diff --git a/packages/client/src/app.html b/packages/client/src/app.html index 4e53b26c..f2da757e 100644 --- a/packages/client/src/app.html +++ b/packages/client/src/app.html @@ -1,4 +1,4 @@ - + diff --git a/packages/client/src/components/atom/Button.svelte b/packages/client/src/components/atom/Button.svelte index 4c2d1d6f..9c2e65d5 100644 --- a/packages/client/src/components/atom/Button.svelte +++ b/packages/client/src/components/atom/Button.svelte @@ -20,8 +20,8 @@ on:mouseenter on:mouseleave on:keydown - on:keypress on:keyup + role="button" {href} tabindex="0" class="{clazz} flex flex-shrink-0 diff --git a/packages/client/src/components/atom/DepartmentSelection.svelte b/packages/client/src/components/atom/DepartmentSelection.svelte index ce9aeaf0..152862de 100644 --- a/packages/client/src/components/atom/DepartmentSelection.svelte +++ b/packages/client/src/components/atom/DepartmentSelection.svelte @@ -2,6 +2,17 @@ import { afterUpdate, getContext, onMount } from 'svelte'; import type { Writable } from 'svelte/store'; + function timeCalc(activateFrom: Date, activateTo: Date): string { + const fromDate = activateFrom ? `${activateFrom.getMonth() + 1}/${activateFrom.getDate()}` : ''; + const toDate = activateTo ? `${activateTo.getMonth() + 1}/${activateTo.getDate()}` : ''; + const fromMinutes = activateFrom ? `${activateFrom.getMinutes()}`.padStart(2, '0') : ''; + const fromTime = activateFrom ? `${activateFrom.getHours()}:${fromMinutes}` : ''; + const toMinutes = activateTo ? `${activateTo.getMinutes()}`.padStart(2, '0') : ''; + const toTime = activateTo ? `${activateTo.getHours()}:${toMinutes}` : ''; + const isToDateDifferent = toDate && toDate !== fromDate; + return `${fromDate} ${fromTime} ~ ${isToDateDifferent ? `${toDate} ` : ''}${toTime}`; + } + export let id: string; export let selected: boolean = false; export let departmentText: string; @@ -16,7 +27,7 @@ const ctx = getContext<{ currentId: Writable; - add: ({ id: string, selected: boolean }) => void; + add: ({ id, selected }: { id: string, selected: boolean }) => void; update: (id: string) => void; change: (direction: number) => void; }>('DepartmentSelectionGroup'); @@ -36,17 +47,6 @@ onMount(() => { return () => unsubscribe(); }); - - function timeCalc(activateFrom: Date, activateTo: Date): string { - const fromDate = activateFrom ? `${activateFrom.getMonth() + 1}/${activateFrom.getDate()}` : ''; - const toDate = activateTo ? `${activateTo.getMonth() + 1}/${activateTo.getDate()}` : ''; - const fromMinutes = activateFrom ? `${activateFrom.getMinutes()}`.padStart(2, '0') : ''; - const fromTime = activateFrom ? `${activateFrom.getHours()}:${fromMinutes}` : ''; - const toMinutes = activateTo ? `${activateTo.getMinutes()}`.padStart(2, '0') : ''; - const toTime = activateTo ? `${activateTo.getHours()}:${toMinutes}` : ''; - const isToDateDifferent = toDate && toDate !== fromDate; - return `${fromDate} ${fromTime} ~ ${isToDateDifferent ? `${toDate} ` : ''}${toTime}`; - } + {/if} + {:else} + + {/if} + diff --git a/packages/client/src/components/atom/NavigationCollapseButton.svelte b/packages/client/src/components/atom/NavigationCollapseButton.svelte index 3f63c515..f69a59df 100644 --- a/packages/client/src/components/atom/NavigationCollapseButton.svelte +++ b/packages/client/src/components/atom/NavigationCollapseButton.svelte @@ -6,7 +6,7 @@ let clazz = ''; export { clazz as class }; - let { collapsed, set } = getContext<{ + const { collapsed, set } = getContext<{ collapsed: Writable; set: (isCollapsed: boolean) => void; }>('Sidebar'); diff --git a/packages/client/src/components/atom/SelectionListItem.svelte b/packages/client/src/components/atom/SelectionListItem.svelte index 77a885cf..ce46053b 100644 --- a/packages/client/src/components/atom/SelectionListItem.svelte +++ b/packages/client/src/components/atom/SelectionListItem.svelte @@ -11,7 +11,7 @@ const ctx = getContext<{ currentId: Writable; - add: ({ id: string, selected: boolean }) => void; + add: ({ id, selected }: { id: string, selected: boolean }) => void; update: (id: string) => void; change: (direction: number) => void; }>('ListItemGroup'); diff --git a/packages/client/src/components/atom/SelectionListItemGroup.svelte b/packages/client/src/components/atom/SelectionListItemGroup.svelte index 8920d495..581f5a63 100644 --- a/packages/client/src/components/atom/SelectionListItemGroup.svelte +++ b/packages/client/src/components/atom/SelectionListItemGroup.svelte @@ -31,7 +31,7 @@ items = [...items, { id, selected }]; }, update: (id: string) => { - selectedIndex = items.map(({ id }) => id).indexOf(id); + selectedIndex = items.map(({ id: v }) => v).indexOf(id); }, change: (direction: number) => { let index = currentIndex + direction; @@ -53,6 +53,6 @@ }); -
+
diff --git a/packages/client/src/components/atom/TabGroup.svelte b/packages/client/src/components/atom/TabGroup.svelte index 045d8725..9d55bfe6 100644 --- a/packages/client/src/components/atom/TabGroup.svelte +++ b/packages/client/src/components/atom/TabGroup.svelte @@ -28,7 +28,7 @@ items = [...items, { id, selected }]; }, update: (id: string) => { - selectedIndex = items.map(({ id }) => id).indexOf(id); + selectedIndex = items.map(({ id: v }) => v).indexOf(id); }, change: (direction: number) => { let index = currentIndex + direction; diff --git a/packages/client/src/components/atom/TabItem.svelte b/packages/client/src/components/atom/TabItem.svelte index be6e7b42..d7985f26 100644 --- a/packages/client/src/components/atom/TabItem.svelte +++ b/packages/client/src/components/atom/TabItem.svelte @@ -11,7 +11,7 @@ const ctx = getContext<{ currentId: Writable; - add: ({ id: string, selected: boolean }) => void; + add: ({ id, selected }: { id: string, selected: boolean }) => void; update: (id: string) => void; change: (direction: number) => void; }>('TabGroup'); diff --git a/packages/client/src/components/atom/Tag.svelte b/packages/client/src/components/atom/Tag.svelte index 9434a920..c7cf66ce 100644 --- a/packages/client/src/components/atom/Tag.svelte +++ b/packages/client/src/components/atom/Tag.svelte @@ -4,6 +4,6 @@ export { clazz as class }; -
+
diff --git a/packages/client/src/components/atom/form/TextArea.svelte b/packages/client/src/components/atom/form/TextArea.svelte new file mode 100644 index 00000000..0374b740 --- /dev/null +++ b/packages/client/src/components/atom/form/TextArea.svelte @@ -0,0 +1,31 @@ + + +
+ + +