diff --git a/Makefile b/Makefile index c7859da7..79f65ac5 100644 --- a/Makefile +++ b/Makefile @@ -194,7 +194,7 @@ lint-client: cd fittrackee_client && $(NPM) lint lint-client-fix: - cd fittrackee_client && $(NPM) lint-fix + cd fittrackee_client && $(NPM) format lint-python: $(PYTEST) --isort --black -m "isort or black" fittrackee e2e --ignore=fittrackee/migrations @@ -233,7 +233,7 @@ serve-dev: serve-client: # for dev environments - cd fittrackee_client && PORT=3000 $(NPM) serve + cd fittrackee_client && PORT=3000 $(NPM) dev serve-python: # for dev environments @@ -269,6 +269,9 @@ type-check: echo 'Running mypy...' $(MYPY) fittrackee +type-check-client: + cd fittrackee_client && $(NPM) type-check + upgrade-db: $(FTCLI) db upgrade diff --git a/fittrackee_client/.env b/fittrackee_client/.env index 93c2b687..1309d972 100644 --- a/fittrackee_client/.env +++ b/fittrackee_client/.env @@ -1,2 +1,2 @@ -VUE_APP_API_URL=http://localhost:5000 +VITE_APP_API_URL=http://localhost:5000 PORT=3000 \ No newline at end of file diff --git a/fittrackee_client/.eslintrc.cjs b/fittrackee_client/.eslintrc.cjs new file mode 100644 index 00000000..b5aa77c3 --- /dev/null +++ b/fittrackee_client/.eslintrc.cjs @@ -0,0 +1,18 @@ +/* eslint-env node */ +require('@rushstack/eslint-patch/modern-module-resolution') + +module.exports = { + root: true, + 'extends': [ + 'plugin:vue/vue3-essential', + 'eslint:recommended', + '@vue/eslint-config-typescript', + '@vue/eslint-config-prettier/skip-formatting' + ], + parserOptions: { + ecmaVersion: 'latest' + }, + "rules": { + "vue/multi-word-component-names": "off" + } +} diff --git a/fittrackee_client/.gitignore b/fittrackee_client/.gitignore new file mode 100644 index 00000000..58bbedcd --- /dev/null +++ b/fittrackee_client/.gitignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist +dist-ssr +coverage +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? \ No newline at end of file diff --git a/fittrackee_client/.prettierrc b/fittrackee_client/.prettierrc.json similarity index 81% rename from fittrackee_client/.prettierrc rename to fittrackee_client/.prettierrc.json index 55ae9dd1..35abc8f6 100644 --- a/fittrackee_client/.prettierrc +++ b/fittrackee_client/.prettierrc.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/prettierrc", "tabWidth": 2, "semi": false, "singleQuote": true, @@ -9,4 +10,4 @@ "printWidth": 80, "endOfLine": "auto", "vueIndentScriptAndStyle": true -} +} \ No newline at end of file diff --git a/fittrackee_client/README.md b/fittrackee_client/README.md index 3f553d90..11e13e74 100644 --- a/fittrackee_client/README.md +++ b/fittrackee_client/README.md @@ -1,29 +1,46 @@ # fittrackee_client -## Project setup -``` -yarn install +This template should help get you started developing with Vue 3 in Vite. + +## Recommended IDE Setup + +[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). + +## Type Support for `.vue` Imports in TS + +TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. + +If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: + +1. Disable the built-in TypeScript Extension + 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette + 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` +2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. + +## Customize configuration + +See [Vite Configuration Reference](https://vitejs.dev/config/). + +## Project Setup + +```sh +yarn ``` -### Compiles and hot-reloads for development -``` -yarn serve +### Compile and Hot-Reload for Development + +```sh +yarn dev ``` -### Compiles and minifies for production -``` +### Type-Check, Compile and Minify for Production + +```sh yarn build ``` -### Run your unit tests -``` -yarn test:unit -``` +### Lint with [ESLint](https://eslint.org/) -### Lints and fixes files -``` +```sh yarn lint ``` - -### Customize configuration -See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/fittrackee_client/babel.config.js b/fittrackee_client/babel.config.js deleted file mode 100644 index c1b783ea..00000000 --- a/fittrackee_client/babel.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - presets: ['@vue/cli-plugin-babel/preset'], -} diff --git a/fittrackee_client/env.d.ts b/fittrackee_client/env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/fittrackee_client/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/fittrackee_client/index.html b/fittrackee_client/index.html new file mode 100644 index 00000000..1fa7e9e4 --- /dev/null +++ b/fittrackee_client/index.html @@ -0,0 +1,15 @@ + + + + + + + + + Vite App + + +
+ + + diff --git a/fittrackee_client/package.json b/fittrackee_client/package.json index a833992b..3c9f9ad8 100644 --- a/fittrackee_client/package.json +++ b/fittrackee_client/package.json @@ -3,127 +3,63 @@ "version": "0.7.25", "private": true, "scripts": { - "serve": "vue-cli-service serve", - "build": "vue-cli-service build", - "test:unit": "vue-cli-service test:unit", - "lint": "vue-cli-service lint", - "lint-fix": "vue-cli-service lint --fix", - "i18n:report": "vue-cli-service i18n:report --src \"./src/**/*.?(js|vue)\" --locales \"./src/locales/**/*.json\"" + "dev": "vite", + "build": "run-p type-check \"build-only {@}\" --", + "preview": "vite preview", + "build-only": "vite build", + "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "format": "prettier --write src/" }, "dependencies": { "@tmcw/togeojson": "^5.8.1", - "@vue-leaflet/vue-leaflet": "0.9.0", + "@vue-leaflet/vue-leaflet": "^0.10.1", "@zxcvbn-ts/core": "^3.0.4", - "@zxcvbn-ts/language-common": "^3.0.3", + "@zxcvbn-ts/language-common": "^3.0.4", "@zxcvbn-ts/language-de": "^3.0.2", "@zxcvbn-ts/language-en": "^3.0.2", "@zxcvbn-ts/language-es-es": "^3.0.2", "@zxcvbn-ts/language-fr": "^3.0.2", "@zxcvbn-ts/language-it": "^3.0.2", "@zxcvbn-ts/language-pl": "^3.0.2", - "axios": "^1.5.1", + "axios": "^1.6.1", "chart.js": "^4.4.0", "chartjs-plugin-datalabels": "^2.2.0", - "core-js": "^3.33.0", - "date-fns": "2.29.3", + "core-js": "^3.33.2", + "date-fns": "2.30.0", "date-fns-tz": "^2.0.0", "leaflet": "^1.9.4", - "linkify-html": "^4.1.1", - "linkifyjs": "^4.1.1", - "register-service-worker": "^1.7.1", + "linkify-html": "^4.1.2", + "linkifyjs": "^4.1.2", "sanitize-html": "^2.11.0", "snarkdown": "^2.0.0", - "vue": "3.2.47", - "vue-chart-3": "3.1.1", + "vue": "^3.3.8", + "vue-chart-3": "^3.1.8", "vue-fullscreen": "^3.1.1", - "vue-i18n": "^9.5.0", + "vue-i18n": "^9.6.5", "vue-router": "^4.2.5", "vuex": "^4.1.0" }, "devDependencies": { "@intlify/vue-i18n-loader": "^4.2.0", - "@types/chai": "^4.3.6", - "@types/mocha": "^10.0.2", - "@types/sanitize-html": "^2.9.1", - "@typescript-eslint/eslint-plugin": "^5.60.0", - "@typescript-eslint/parser": "^5.60.0", - "@vue/cli-plugin-babel": "~5.0.8", - "@vue/cli-plugin-eslint": "~5.0.8", - "@vue/cli-plugin-pwa": "~5.0.8", - "@vue/cli-plugin-router": "~5.0.8", - "@vue/cli-plugin-typescript": "~5.0.8", - "@vue/cli-plugin-unit-mocha": "~5.0.8", - "@vue/cli-plugin-vuex": "~5.0.8", - "@vue/cli-service": "~5.0.8", - "@vue/eslint-config-typescript": "^11.0.3", - "@vue/test-utils": "^2.4.1", + "@rushstack/eslint-patch": "^1.3.3", + "@tsconfig/node18": "^18.2.2", + "@types/chai": "^4.3.10", + "@types/mocha": "^10.0.4", + "@types/node": "^20.9.0", + "@types/sanitize-html": "^2.9.4", + "@vitejs/plugin-vue": "^4.4.0", + "@vue/eslint-config-prettier": "^8.0.0", + "@vue/eslint-config-typescript": "^12.0.0", + "@vue/tsconfig": "^0.4.0", "chai": "^4.3.10", - "eslint": "8.42.0", - "eslint-config-prettier": "^8.10.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.28.1", - "eslint-plugin-prettier": "^4.2.1", + "eslint": "^8.49.0", "eslint-plugin-vue": "^9.17.0", - "prettier": "^2.8.8", - "sass": "^1.68.0", - "sass-loader": "^13.3.2", - "typescript": "5.0.4", - "vue-cli-plugin-i18n": "~2.3.2" - }, - "eslintConfig": { - "root": true, - "env": { - "node": true - }, - "extends": [ - "plugin:vue/vue3-essential", - "eslint:recommended", - "@vue/typescript/recommended", - "plugin:import/recommended", - "plugin:import/typescript" - ], - "globals": { - "defineProps": "readonly", - "defineEmits": "readonly", - "defineExpose": "readonly", - "withDefaults": "readonly" - }, - "settings": { - "import/resolver": "typescript" - }, - "parserOptions": { - "ecmaVersion": 2020, - "parser": "@typescript-eslint/parser" - }, - "rules": { - "import/order": [ - "error", - { - "newlines-between": "always", - "alphabetize": { - "order": "asc", - "caseInsensitive": true - } - } - ], - "vue/multi-word-component-names": "off" - }, - "overrides": [ - { - "files": [ - "**/__tests__/*.{j,t}s?(x)", - "**/tests/unit/**/*.spec.{j,t}s?(x)" - ], - "env": { - "mocha": true - } - } - ] - }, - "browserslist": [ - "> 1%", - "last 2 versions", - "not dead", - "not ie 11" - ] + "npm-run-all2": "^6.1.1", + "prettier": "^3.0.3", + "sass": "^1.69.5", + "typescript": "~5.2.0", + "vite": "^4.4.11", + "vue-tsc": "^1.8.19" + } } diff --git a/fittrackee_client/public/index.html b/fittrackee_client/public/index.html deleted file mode 100644 index 4835c894..00000000 --- a/fittrackee_client/public/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - <%= htmlWebpackPlugin.options.title %> - - - -
- - - diff --git a/fittrackee_client/src/App.vue b/fittrackee_client/src/App.vue index a5c90e46..4cc7167a 100644 --- a/fittrackee_client/src/App.vue +++ b/fittrackee_client/src/App.vue @@ -29,13 +29,14 @@ - diff --git a/fittrackee_client/src/components/Statistics/StatsSportsMenu.vue b/fittrackee_client/src/components/Statistics/StatsSportsMenu.vue index e2110e17..67a95cd0 100644 --- a/fittrackee_client/src/components/Statistics/StatsSportsMenu.vue +++ b/fittrackee_client/src/components/Statistics/StatsSportsMenu.vue @@ -8,7 +8,7 @@ > \ No newline at end of file + diff --git a/fittrackee_client/src/views/StatisticsView.vue b/fittrackee_client/src/views/StatisticsView.vue index 959167ce..8a7cb262 100644 --- a/fittrackee_client/src/views/StatisticsView.vue +++ b/fittrackee_client/src/views/StatisticsView.vue @@ -18,13 +18,14 @@