Project Archived
Fitness Tracker is for tracking workouts, exercises, and measurements as well as charting results.
Might need to rethink how I'm doing some of this. Going to experiment with Web App Template again.
ACTIVE WORKOUT
- WIP
MISC
- Inspect fields with lists should use
<li>
(mostly for long id arrays) - Validate that checking for value change on chart time watcher didn't break it
- Exporting while you have active workout should:
- Warn the user, but they can continue and...
- Update core records active to false
- Delete sub records that are active
Install the project dependencies.
npm i
Launch the dev server site.
npm run dev
Build the project dist
directory.
npm run build
Preview application using built dist
artifacts.
npm run preview
Run tests.
npm test
Run tests with coverage report.
npm test:coverage
Removes previous GitHub Pages deployment.
npm run deploy:clean-gh-pages
Build and deploy the dist
directory to GitHub Pages.
npm run deploy:gh-pages
Check for outdated packages.
npm outdated
Update packages based on package.json
version settings. Test updates to ensure they worked.
npm upgrade
Details on the steps I took to create this project.
-
Create an empty repository in GitHub with a
PROJECT_NAME
-
Run
npm init vue@3
in your local Projects directory:- Name the project
PROJECT_NAME
- TypeScript - Yes
- JSX - No
- Vue Router - Yes
- Pinia - Yes
- Vitest - Yes
- End-to-End Testing - No
- ESLint - Yes
- Prettier - Yes
- Name the project
-
Install dependencies:
npm i slugify
- For making URL slug from textnpm i dexie
- IndexedDB wrappernpm i yup
- Data validationnpm i -D gh-pages
- GitHub Pages deploymentnpm i @vueuse/core
- Vue component utilitiesnpm i chart.js vue-chartjs
- Chart.js with a Vue wrappernpm i -D @types/chart.js
npm i quasar @quasar/extras
- Vue component frameworknpm i -D @quasar/vite-plugin
-
Use Quasar configurator tool to help setup Quasar:
- https://quasar.dev/start/vite-plugin
- Roboto font - YES
- Material Icons - YES
- Material Icons (Outlined) - YES
- Auto-import component case - pascal
- Quasar Config Object
-
Update
main.ts
with the Quasar configurator tool generated code:import { createApp } from 'vue' import { createPinia } from 'pinia' import { Meta, Dialog, Notify, Quasar } from 'quasar' import router from '@/router' import App from '@/App.vue' import '@quasar/extras/roboto-font/roboto-font.css' import '@quasar/extras/material-icons/material-icons.css' import '@quasar/extras/material-icons-outlined/material-icons-outlined.css' import 'quasar/dist/quasar.css' // import '@/assets/global.css' // Can create this later to hold global styles const app = createApp(App) app.use(createPinia()) app.use(router) app.use(Quasar, { plugins: { Meta, Dialog, // Uses a custom component (SimpleDialog.vue) Notify, }, config: { dark: true, /** * Defined app brand colors. * @see https://quasar.dev/style/color-palette * @see https://quasar.dev/quasar-utils/color-utils */ brand: { primary: '#1976d2', // indigo (Primary Brand Color) secondary: '#607d8b', // blue-grey (LOG) accent: '#673ab7', // deep-purple-6 (DEBUG) info: '#0d47a1', // blue-10 (INFO) warning: '#ff6f00', // amber-10 (WARN) negative: '#C10015', // negative (ERROR) positive: '#4caf50', // green dark: '#1d1d1d', 'dark-page': '#121212', }, notify: { textColor: 'white', position: 'top', multiLine: false, timeout: 4000, actions: [ { label: 'Dismiss', color: 'white', }, ], }, // loading: {...}, // default set of options for Loading Quasar plugin // loadingBar: { ... }, // settings for LoadingBar Quasar plugin // // ..and many more (check Installation card on each Quasar component/directive/plugin) }, } as any) // Assumes you have a <div id="app"></div> in your index.html app.mount('#app')
-
Update
vite.config.js
with the Quasar configurator tool generated code:import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' import { quasar, transformAssetUrls } from '@quasar/vite-plugin' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue({ template: { transformAssetUrls } }), quasar({ autoImportComponentCase: 'pascal' }), ], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, /** * This should be your GitHub repo name. You can find it on the GitHub URL. * @example * https://github.com/my-username/my-app-repo * my-app-repo */ base: '/REPO_NAME/', })
-
Additional scripts for
package.json
file. Thedeploy
script makes a copy of theindex.html
indist
as404.html
to address complications related to routing. This let's you avoid using hash based routing.{ "scripts": { "test": "vitest", "deploy:clean-gh-pages": "gh-pages-clean gh-pages -d dist -m Deployment", "deploy:gh-pages": "npm run build && npm version patch && cd dist && cp index.html 404.html && cd .. && gh-pages -d dist -m Deployment" } }
-
Define the
ECMAScript
version you want TypeScript to use in thetsconfig
files:{ "compilerOptions": { "target": "es2022", "lib": ["es2022", "dom"], "ignoreDeprecations": "5.0" } }
-
Setup
.prettierrc.json
config file:{ "$schema": "https://json.schemastore.org/prettierrc", "printWidth": 100, "tabWidth": 2, "useTabs": false, "semi": false, "singleQuote": true, "quoteProps": "as-needed", "jsxSingleQuote": true, "trailingComma": "es5", "bracketSpacing": true, "bracketSameLine": false, "arrowParens": "always", "proseWrap": "always", "htmlWhitespaceSensitivity": "css", "vueIndentScriptAndStyle": false, "endOfLine": "lf" }
-
Setup
.eslintrc.cjs
config file:/* 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: { '@typescript-eslint/no-explicit-any': 'off', }, }
-
Setup other config files as desired:
/.vscode/extensions.json
- Include extensions you recommend for your project.gitignore
.prettierignore
-
Replace
~/index.html
with a the one before since we are usinguseMeta
:<!DOCTYPE html> <html lang="en"> <head> <!-- Define head values on useMeta in App.vue --> </head> <body> <div id="app"></div> <script type="module" src="/src/main.ts"></script> </body> </html>
-
Update the
manifest.json
file in~/public
with the project name and start URL -
Update
useMeta
in~/src/App.vue
-
Add icons to the
~/public
directory (likefavicon.ico
) -
Run
git init
inside your project directory -
Commit all changes to the project into it's initial commit
-
Run the follow commands to push the new project to your GitHub repo:
git remote add origin https://github.com/GITHUB_USER/PROJECT_NAME.git git branch -M main git push -u origin main
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
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)
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 that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensions
from VSCode's command palette - Find
TypeScript and JavaScript Language Features
, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Window
from the command palette.
See Vite Configuration Reference.
App favicon was generated using the following graphics from Twemoji:
- Graphics Title: 1f3cb-fe0f-200d-2642-fe0f.svg
- Graphics Author: Copyright 2020 Twitter, Inc and other contributors (https://github.com/twitter/twemoji)
- Graphics Source: https://github.com/twitter/twemoji/blob/master/assets/svg/1f3cb-fe0f-200d-2642-fe0f.svg
- Graphics License: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)