From 27874adf274050e693214064918d2d07afa5b4a9 Mon Sep 17 00:00:00 2001 From: Christian Cueni Date: Wed, 13 Apr 2022 14:57:20 +0200 Subject: [PATCH] Add client --- client/.gitignore | 28 +++++++ client/README.md | 59 +++++++++++++ client/cypress.json | 3 + client/package.json | 43 ++++++++++ client/postcss.config.js | 6 ++ client/public/favicon.ico | Bin 0 -> 4286 bytes client/src/App.vue | 119 +++++++++++++++++++++++++++ client/src/components/HelloWorld.vue | 40 +++++++++ client/src/index.css | 3 + client/src/main.ts | 14 ++++ client/src/router/index.ts | 23 ++++++ client/tailwind.config.js | 10 +++ client/tsconfig.json | 14 ++++ 13 files changed, 362 insertions(+) create mode 100644 client/.gitignore create mode 100644 client/README.md create mode 100644 client/cypress.json create mode 100644 client/package.json create mode 100644 client/postcss.config.js create mode 100644 client/public/favicon.ico create mode 100644 client/src/App.vue create mode 100644 client/src/components/HelloWorld.vue create mode 100644 client/src/index.css create mode 100644 client/src/main.ts create mode 100644 client/src/router/index.ts create mode 100644 client/tailwind.config.js create mode 100644 client/tsconfig.json 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 0000000000000000000000000000000000000000..df36fcfb72584e00488330b560ebcf34a41c64c2 GIT binary patch literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S literal 0 HcmV?d00001 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" + } + ] +}