Skip to content

Commit

Permalink
add typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Atipat Pankong committed Jun 23, 2024
1 parent 8b3b910 commit 67712af
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 13 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</noscript>
<div id="app"></div>

<script type="module" src="src/main.js"></script>
<script type="module" src="src/main.ts"></script>
<!-- built files will be auto injected -->
<div id="divadsensedisplaynone">
<!-- put here all adsense code -->
Expand Down
3 changes: 0 additions & 3 deletions jsconfig.json

This file was deleted.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"build": "NODE_OPTIONS=--openssl-legacy-provider vite build",
"serve": "NODE_OPTIONS=--openssl-legacy-provider vite preview",
"lint": "eslint --fix src",
"prepare": "husky install"
"prepare": "husky install",
"type-check": "vue-tsc --noEmit"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
Expand All @@ -23,7 +24,9 @@
"vuex": "^4.1.0"
},
"devDependencies": {
"@babel/types": "^7.24.7",
"@eslint/compat": "^1.1.0",
"@types/node": "^20.14.8",
"@vitejs/plugin-vue": "^5.0.5",
"autoprefixer": "^10.4.19",
"eslint": "^9.5.0",
Expand All @@ -35,7 +38,8 @@
"prettier": "^3.3.2",
"tailwindcss": "^3.4.4",
"typescript": "^5.5.2",
"vite": "^5.3.1"
"vite": "^5.3.1",
"vue-tsc": "^2.0.22"
},
"browserslist": [
"> 1%",
Expand Down
8 changes: 5 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@
</div>
</template>

<script>
<script lang="ts">
import { defineComponent } from 'vue'
import { mapGetters, mapActions, mapMutations } from 'vuex'
import KuFooter from '@/components/KuFooter.vue'
export default {
export default defineComponent({
name: 'App',
components: {
KuFooter,
Expand Down Expand Up @@ -119,7 +121,7 @@ export default {
this.clearAuthData()
},
},
}
})
</script>

<style>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions src/router/index.js → src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const Schedule = () => import('@/pages/Schedule.vue')
const NotFound = () => import('@/pages/NotFound.vue')
const Unit = () => import('@/components/Unit.vue')
const Login = () => import('@/pages/Login.vue')

const routes = [
const routes: RouteRecordRaw[] = [
{
path: '/',
redirect: '/login',
Expand Down Expand Up @@ -45,6 +45,7 @@ router.beforeEach((to, from, next) => {
if (!localStorage.getItem('accessToken')) {
next({
path: '/login',
replace: true,
})
} else {
next()
Expand Down
5 changes: 5 additions & 0 deletions src/shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module '*.vue' {
import { defineComponent } from 'vue'
const Component: ReturnType<typeof defineComponent>
export default Component
}
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"baseUrl": "./src",
"outDir": "dist",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"isolatedModules": true,
"noEmit": true,
"paths": {
"@/*": ["src/*"]
},
"types": ["vite/client", "node"]
},
"include": ["./src/**/*", "vite.config.ks"],
"exclude": ["node_modules", "dist", "public", "scripts"]
}
File renamed without changes.
141 changes: 139 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"@babel/highlight" "^7.24.7"
picocolors "^1.0.0"

"@babel/helper-string-parser@^7.24.7":
version "7.24.7"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz#4d2d0f14820ede3b9807ea5fc36dfc8cd7da07f2"
integrity sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==

"@babel/helper-validator-identifier@^7.24.7":
version "7.24.7"
resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz"
Expand All @@ -35,6 +40,15 @@
resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz"
integrity sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==

"@babel/types@^7.24.7":
version "7.24.7"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.7.tgz#6027fe12bc1aa724cd32ab113fb7f1988f1f66f2"
integrity sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==
dependencies:
"@babel/helper-string-parser" "^7.24.7"
"@babel/helper-validator-identifier" "^7.24.7"
to-fast-properties "^2.0.0"

"@esbuild/aix-ppc64@0.21.5":
version "0.21.5"
resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz#c7184a326533fcdf1b8ee0733e21c713b975575f"
Expand Down Expand Up @@ -390,6 +404,13 @@
resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz"
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==

"@types/node@^20.14.8":
version "20.14.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.8.tgz#45c26a2a5de26c3534a9504530ddb3b27ce031ac"
integrity sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==
dependencies:
undici-types "~5.26.4"

"@types/parse-json@^4.0.0":
version "4.0.2"
resolved "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz"
Expand All @@ -400,6 +421,27 @@
resolved "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.0.5.tgz"
integrity sha512-LOjm7XeIimLBZyzinBQ6OSm3UBCNVCpLkxGC0oWmm2YPzVZoxMsdvNVimLTBzpAnR9hl/yn1SHGuRfe6/Td9rQ==

"@volar/language-core@2.3.1", "@volar/language-core@~2.3.1":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-2.3.1.tgz#0968218ca3210b9d1151b44ac0ad6944562ce3bc"
integrity sha512-25CZ3ulM6jWgQsPQjKb7maKDlryvXWvsl7ytw4uj1Yyy17BgdiTWqMuNSxIODC3+/7IBOOGYoINC/1OOLACLLw==
dependencies:
"@volar/source-map" "2.3.1"

"@volar/source-map@2.3.1":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-2.3.1.tgz#3404ef0f9f9b53bffc253c2345566f64a998d3d8"
integrity sha512-fU3IL19wRy5S5OaGq67ejSl+/xdMuOHgp9Rsp3OiOhLyg25CctLYDdGZ9Y3+MJ1iqTLDh94PdvdR1BZX6I0hNQ==

"@volar/typescript@~2.3.1":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-2.3.1.tgz#ffdbd361844ad9b3b6f45a4a173b3d384385792e"
integrity sha512-OrUV6dYt/1h92+aWElexra6dp++gF/IEddvwyxeobyYfKAoKDUMsWU0iJCj0clZlfdyYaLmNEAkulJlVimxnOw==
dependencies:
"@volar/language-core" "2.3.1"
path-browserify "^1.0.1"
vscode-uri "^3.0.8"

"@vue/compiler-core@3.4.29":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.29.tgz"
Expand All @@ -411,6 +453,17 @@
estree-walker "^2.0.2"
source-map-js "^1.2.0"

"@vue/compiler-core@3.4.30":
version "3.4.30"
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.4.30.tgz#a554978f68199a0f254ad5159e9665370c8c1250"
integrity sha512-ZL8y4Xxdh8O6PSwfdZ1IpQ24PjTAieOz3jXb/MDTfDtANcKBMxg1KLm6OX2jofsaQGYfIVzd3BAG22i56/cF1w==
dependencies:
"@babel/parser" "^7.24.7"
"@vue/shared" "3.4.30"
entities "^4.5.0"
estree-walker "^2.0.2"
source-map-js "^1.2.0"

"@vue/compiler-dom@3.4.29":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.29.tgz"
Expand All @@ -419,6 +472,14 @@
"@vue/compiler-core" "3.4.29"
"@vue/shared" "3.4.29"

"@vue/compiler-dom@^3.4.0":
version "3.4.30"
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.4.30.tgz#5af9a5f6f0752f7882d4eba0795e4d00525006dc"
integrity sha512-+16Sd8lYr5j/owCbr9dowcNfrHd+pz+w2/b5Lt26Oz/kB90C9yNbxQ3bYOvt7rI2bxk0nqda39hVcwDFw85c2Q==
dependencies:
"@vue/compiler-core" "3.4.30"
"@vue/shared" "3.4.30"

"@vue/compiler-sfc@3.4.29":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.29.tgz"
Expand Down Expand Up @@ -447,6 +508,20 @@
resolved "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.3.tgz"
integrity sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==

"@vue/language-core@2.0.22":
version "2.0.22"
resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-2.0.22.tgz#2f8164ecc83f85f27301521d0a6ce37cc59bb23a"
integrity sha512-dNTAAtEOuMiz7N1s5tKpypnVVCtawxVSF5BukD0ELcYSw+DSbrSlYYSw8GuwvurodCeYFSHsmslE+c2sYDNoiA==
dependencies:
"@volar/language-core" "~2.3.1"
"@vue/compiler-dom" "^3.4.0"
"@vue/shared" "^3.4.0"
computeds "^0.0.1"
minimatch "^9.0.3"
muggle-string "^0.4.1"
path-browserify "^1.0.1"
vue-template-compiler "^2.7.14"

"@vue/reactivity@3.4.29":
version "3.4.29"
resolved "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.29.tgz"
Expand Down Expand Up @@ -485,6 +560,11 @@
resolved "https://registry.npmjs.org/@vue/shared/-/shared-3.4.29.tgz"
integrity sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA==

"@vue/shared@3.4.30", "@vue/shared@^3.4.0":
version "3.4.30"
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.4.30.tgz#72acfe8df65139dcf298e965fb2ab1cff419e400"
integrity sha512-CLg+f8RQCHQnKvuHY9adMsMaQOcqclh6Z5V9TaoMgy0ut0tz848joZ7/CYFFyF/yZ5i2yaw7Fn498C+CNZVHIg==

acorn-jsx@^5.3.2:
version "5.3.2"
resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz"
Expand Down Expand Up @@ -764,6 +844,11 @@ commander@^8.2.0:
resolved "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==

computeds@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/computeds/-/computeds-0.0.1.tgz#215b08a4ba3e08a11ff6eee5d6d8d7166a97ce2e"
integrity sha512-7CEBgcMjVmitjYo5q8JTJVra6X5mQ20uTThdK+0kR7UEaDrAWEQcRiBtWJzga4eRpP6afNwwLsX2SET2JhVB1Q==

concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
Expand Down Expand Up @@ -811,6 +896,11 @@ csstype@^3.1.3:
resolved "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz"
integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==

de-indent@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
integrity sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==

debug@^4.3.1, debug@^4.3.2, debug@^4.3.4:
version "4.3.5"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz"
Expand Down Expand Up @@ -1225,6 +1315,11 @@ hasown@^2.0.2:
dependencies:
function-bind "^1.1.2"

he@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==

html2canvas@^1.0.0-alpha.12:
version "1.4.1"
resolved "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz"
Expand Down Expand Up @@ -1519,7 +1614,7 @@ minimatch@^3.0.5, minimatch@^3.1.2:
dependencies:
brace-expansion "^1.1.7"

minimatch@^9.0.4:
minimatch@^9.0.3, minimatch@^9.0.4:
version "9.0.4"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz"
integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==
Expand All @@ -1536,6 +1631,11 @@ ms@2.1.2:
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

muggle-string@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/muggle-string/-/muggle-string-0.4.1.tgz#3b366bd43b32f809dc20659534dd30e7c8a0d328"
integrity sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ==

mz@^2.7.0:
version "2.7.0"
resolved "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz"
Expand Down Expand Up @@ -1656,6 +1756,11 @@ parse-json@^5.0.0:
json-parse-even-better-errors "^2.3.0"
lines-and-columns "^1.1.6"

path-browserify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==

path-exists@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz"
Expand Down Expand Up @@ -1879,7 +1984,7 @@ semver-compare@^1.0.0:
resolved "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz"
integrity sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==

semver@^7.3.6, semver@^7.6.0:
semver@^7.3.6, semver@^7.5.4, semver@^7.6.0:
version "7.6.2"
resolved "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz"
integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==
Expand Down Expand Up @@ -2083,6 +2188,11 @@ through@^2.3.8:
resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==

to-fast-properties@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==

to-regex-range@^5.0.1:
version "5.0.1"
resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz"
Expand Down Expand Up @@ -2122,6 +2232,11 @@ typescript@^5.5.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507"
integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

update-browserslist-db@^1.0.16:
version "1.0.16"
resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz"
Expand Down Expand Up @@ -2160,6 +2275,11 @@ vite@^5.3.1:
optionalDependencies:
fsevents "~2.3.3"

vscode-uri@^3.0.8:
version "3.0.8"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f"
integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==

vue-eslint-parser@^9.4.2:
version "9.4.3"
resolved "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.4.3.tgz"
Expand Down Expand Up @@ -2187,6 +2307,23 @@ vue-router@^4.2.5:
dependencies:
"@vue/devtools-api" "^6.5.1"

vue-template-compiler@^2.7.14:
version "2.7.16"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz#c81b2d47753264c77ac03b9966a46637482bb03b"
integrity sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==
dependencies:
de-indent "^1.0.2"
he "^1.2.0"

vue-tsc@^2.0.22:
version "2.0.22"
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-2.0.22.tgz#ddfef6b3a016d1b986008a3b8702f7e667db128c"
integrity sha512-lMBIwPBO0sxCcmvu45yt1b035AaQ8/XSXQDk8m75y4j0jSXY/y/XzfEtssQ9JMS47lDaR10O3/926oCs8OeGUw==
dependencies:
"@volar/typescript" "~2.3.1"
"@vue/language-core" "2.0.22"
semver "^7.5.4"

vue@^3.0.0, vue@^3.3.9:
version "3.4.29"
resolved "https://registry.npmjs.org/vue/-/vue-3.4.29.tgz"
Expand Down

0 comments on commit 67712af

Please sign in to comment.