diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 00000000..38adffa6 --- /dev/null +++ b/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? diff --git a/client/README.md b/client/README.md new file mode 100644 index 00000000..3a75be98 --- /dev/null +++ b/client/README.md @@ -0,0 +1,59 @@ +# client + +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=johnsoncodehk.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.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=johnsoncodehk.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 +npm install +``` + +### Compile and Hot-Reload for Development + +```sh +npm run dev +``` + +### Type-Check, Compile and Minify for Production + +```sh +npm run build +``` + +### Run Unit Tests with [Vitest](https://vitest.dev/) + +```sh +npm run test:unit +``` + +### Run End-to-End Tests with [Cypress](https://www.cypress.io/) + +```sh +npm run build +npm run test:e2e # or `npm run test:e2e:ci` for headless testing +``` + +### Lint with [ESLint](https://eslint.org/) + +```sh +npm run lint +``` diff --git a/client/cypress.json b/client/cypress.json new file mode 100644 index 00000000..6ba19871 --- /dev/null +++ b/client/cypress.json @@ -0,0 +1,3 @@ +{ + "baseUrl": "http://localhost:5050" +} diff --git a/client/package.json b/client/package.json new file mode 100644 index 00000000..762691ee --- /dev/null +++ b/client/package.json @@ -0,0 +1,43 @@ +{ + "name": "client", + "version": "0.0.0", + "scripts": { + "dev": "vite", + "build": "vue-tsc --noEmit && vite build", + "preview": "vite preview --port 5050", + "test:unit": "vitest --environment jsdom", + "test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'", + "test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'", + "typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false", + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore" + }, + "dependencies": { + "pinia": "^2.0.13", + "vue": "^3.2.31", + "vue-router": "^4.0.14" + }, + "devDependencies": { + "@rushstack/eslint-patch": "^1.1.0", + "@types/jsdom": "^16.2.14", + "@types/node": "^16.11.26", + "@vitejs/plugin-vue": "^2.3.1", + "@vue/eslint-config-prettier": "^7.0.0", + "@vue/eslint-config-typescript": "^10.0.0", + "@vue/test-utils": "^2.0.0-rc.18", + "@vue/tsconfig": "^0.1.3", + "autoprefixer": "^10.4.4", + "cypress": "^9.5.3", + "eslint": "^8.5.0", + "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-vue": "^8.2.0", + "jsdom": "^19.0.0", + "postcss": "^8.4.12", + "prettier": "^2.5.1", + "start-server-and-test": "^1.14.0", + "tailwindcss": "^3.0.24", + "typescript": "~4.6.3", + "vite": "^2.9.1", + "vitest": "^0.8.1", + "vue-tsc": "^0.33.9" + } +} diff --git a/client/postcss.config.js b/client/postcss.config.js new file mode 100644 index 00000000..33ad091d --- /dev/null +++ b/client/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/client/public/favicon.ico b/client/public/favicon.ico new file mode 100644 index 00000000..df36fcfb Binary files /dev/null and b/client/public/favicon.ico differ diff --git a/client/src/App.vue b/client/src/App.vue new file mode 100644 index 00000000..7de68e9b --- /dev/null +++ b/client/src/App.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/client/src/components/HelloWorld.vue b/client/src/components/HelloWorld.vue new file mode 100644 index 00000000..aa2f7f1b --- /dev/null +++ b/client/src/components/HelloWorld.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/client/src/index.css b/client/src/index.css new file mode 100644 index 00000000..b5c61c95 --- /dev/null +++ b/client/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/client/src/main.ts b/client/src/main.ts new file mode 100644 index 00000000..3ce383d7 --- /dev/null +++ b/client/src/main.ts @@ -0,0 +1,14 @@ +import { createApp } from 'vue' +import { createPinia } from 'pinia' + +import App from './App.vue' +import router from './router' + +import './index.css' + +const app = createApp(App) + +app.use(createPinia()) +app.use(router) + +app.mount('#app') diff --git a/client/src/router/index.ts b/client/src/router/index.ts new file mode 100644 index 00000000..a49ae507 --- /dev/null +++ b/client/src/router/index.ts @@ -0,0 +1,23 @@ +import { createRouter, createWebHistory } from 'vue-router' +import HomeView from '../views/HomeView.vue' + +const router = createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: '/', + name: 'home', + component: HomeView + }, + { + path: '/about', + name: 'about', + // route level code-splitting + // this generates a separate chunk (About.[hash].js) for this route + // which is lazy-loaded when the route is visited. + component: () => import('../views/AboutView.vue') + } + ] +}) + +export default router diff --git a/client/tailwind.config.js b/client/tailwind.config.js new file mode 100644 index 00000000..5c1b974d --- /dev/null +++ b/client/tailwind.config.js @@ -0,0 +1,10 @@ +module.exports = { + content: [ + "./index.html", + "./src/**/*.{vue,js,ts,jsx,tsx}", + ], + theme: { + extend: {}, + }, + plugins: [], +} diff --git a/client/tsconfig.json b/client/tsconfig.json new file mode 100644 index 00000000..24f21b06 --- /dev/null +++ b/client/tsconfig.json @@ -0,0 +1,14 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.vite-config.json" + }, + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.vitest.json" + } + ] +}