From 175e3971918ef2e01d8e9634873fe68f2407a6fc Mon Sep 17 00:00:00 2001 From: Liviu Burcusel Date: Thu, 11 Sep 2025 15:08:48 +0200 Subject: [PATCH] Project start --- .gitignore | 32 ++++++++++++++++++++++ README.md | 39 ++++++++++++++++++++++++++ env.d.ts | 1 + index.html | 17 ++++++++++++ package.json | 38 ++++++++++++++++++++++++++ public/favicon.ico | Bin 0 -> 1150 bytes src/App.vue | 29 ++++++++++++++++++++ src/assets/base.css | 0 src/assets/main.css | 0 src/components/HelloWorld.vue | 41 ++++++++++++++++++++++++++++ src/main.ts | 11 ++++++++ src/router/index.ts | 23 ++++++++++++++++ src/views/AboutView.vue | 5 ++++ src/views/HomeView.vue | 5 ++++ tests/components/HelloWorld.spec.ts | 11 ++++++++ tests/views/AboutView.spec.ts | 11 ++++++++ tests/views/HomeView.spec.ts | 11 ++++++++ tsconfig.app.json | 12 ++++++++ tsconfig.json | 14 ++++++++++ tsconfig.node.json | 19 +++++++++++++ tsconfig.vitest.json | 11 ++++++++ vite.config.ts | 19 +++++++++++++ vitest.config.ts | 17 ++++++++++++ 23 files changed, 366 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 env.d.ts create mode 100644 index.html create mode 100644 package.json create mode 100644 public/favicon.ico create mode 100644 src/App.vue create mode 100644 src/assets/base.css create mode 100644 src/assets/main.css create mode 100644 src/components/HelloWorld.vue create mode 100644 src/main.ts create mode 100644 src/router/index.ts create mode 100644 src/views/AboutView.vue create mode 100644 src/views/HomeView.vue create mode 100644 tests/components/HelloWorld.spec.ts create mode 100644 tests/views/AboutView.spec.ts create mode 100644 tests/views/HomeView.spec.ts create mode 100644 tsconfig.app.json create mode 100644 tsconfig.json create mode 100644 tsconfig.node.json create mode 100644 tsconfig.vitest.json create mode 100644 vite.config.ts create mode 100644 vitest.config.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85e6bd5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# 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 +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +*.tsbuildinfo + +# Temporary exclusion +package-lock.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..2881c77 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# dexie-test + +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). + +## 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 [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. + +## Customize configuration + +See [Vite Configuration Reference](https://vite.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 +``` diff --git a/env.d.ts b/env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/index.html b/index.html new file mode 100644 index 0000000..f099868 --- /dev/null +++ b/index.html @@ -0,0 +1,17 @@ + + + + + + + Dexie Test + + + +
+ + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..e5bfda5 --- /dev/null +++ b/package.json @@ -0,0 +1,38 @@ +{ + "name": "dexie-test", + "version": "0.0.0", + "private": true, + "type": "module", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "scripts": { + "dev": "vite", + "build": "run-p type-check \"build-only {@}\" --", + "preview": "vite preview", + "test:unit": "vitest run", + "coverage": "vitest run --coverage", + "build-only": "vite build", + "type-check": "vue-tsc --build" + }, + "dependencies": { + "vue": "^3.5.18", + "vue-router": "^4.5.1" + }, + "devDependencies": { + "@tsconfig/node22": "^22.0.2", + "@types/jsdom": "^21.1.7", + "@types/node": "^22.16.5", + "@vitejs/plugin-vue": "^6.0.1", + "@vitest/coverage-v8": "^3.2.4", + "@vue/test-utils": "^2.4.6", + "@vue/tsconfig": "^0.7.0", + "jsdom": "^26.1.0", + "npm-run-all2": "^8.0.4", + "typescript": "~5.8.0", + "vite": "^7.0.6", + "vite-plugin-vue-devtools": "^8.0.0", + "vitest": "^3.2.4", + "vue-tsc": "^3.0.4" + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..40be01055b837b0bc09ff362f52ecd4aa1848d9d GIT binary patch literal 1150 zcmc&!PiT^17=N5iC;pqt6xW;*D4PzVV}CXlq$Ku7CwiF?9*howhop9p=Aja16q^LX zpu>o~1O|g(VCYm(%*$Zv^e}emFsN`eMg;Nodu^Yr@YbRC=66b;Nai`l}bg?Xtd`8e$RmO zNhA_+kXxlvTE69a&yWO{WezVz}!r7WcB3ZH9?U}i`x%EgS@?v9S}F&hwp^VM?QY5)ta(cENie^L0y?ZAh5o;xcDra&0a%3 z2YvXCll*qOZM4~J4WrS>p*{}w9IGWBk3U4O_WSUcz~AEIS1OfDjE5Zd%x3d@gTe61 z@Au!s99=(-ujBg%UlVK=(Bs!UzgDYFn@pyT)oPudoSY=&LE&(i&Dmwt&t~T=X6H2e zHa;>k@($lW5Z}V{tJSJxbaeD7;+KIEe7*Jgd<*RU*jxZ#nIC~b(1D*Vov?g@Gt2bP>p=lyg#J%IZn+)aEsZ=;J}PL$aY literal 0 HcmV?d00001 diff --git a/src/App.vue b/src/App.vue new file mode 100644 index 0000000..e51274f --- /dev/null +++ b/src/App.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/assets/base.css b/src/assets/base.css new file mode 100644 index 0000000..e69de29 diff --git a/src/assets/main.css b/src/assets/main.css new file mode 100644 index 0000000..e69de29 diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue new file mode 100644 index 0000000..d174cf8 --- /dev/null +++ b/src/components/HelloWorld.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..5a5dbdb --- /dev/null +++ b/src/main.ts @@ -0,0 +1,11 @@ +import './assets/main.css' + +import { createApp } from 'vue' +import App from './App.vue' +import router from './router' + +const app = createApp(App) + +app.use(router) + +app.mount('#app') diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..1e79428 --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,23 @@ +import { createRouter, createWebHashHistory } from "vue-router"; +import HomeView from "../views/HomeView.vue"; + +const router = createRouter({ + history: createWebHashHistory(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/src/views/AboutView.vue b/src/views/AboutView.vue new file mode 100644 index 0000000..26d6aea --- /dev/null +++ b/src/views/AboutView.vue @@ -0,0 +1,5 @@ + diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue new file mode 100644 index 0000000..a6b78c3 --- /dev/null +++ b/src/views/HomeView.vue @@ -0,0 +1,5 @@ + diff --git a/tests/components/HelloWorld.spec.ts b/tests/components/HelloWorld.spec.ts new file mode 100644 index 0000000..1a54a1f --- /dev/null +++ b/tests/components/HelloWorld.spec.ts @@ -0,0 +1,11 @@ +import { describe, it, expect } from "vitest"; + +import { mount } from "@vue/test-utils"; +import HelloWorld from "../../src/components/HelloWorld.vue"; + +describe("HelloWorld", () => { + const wrapper = mount(HelloWorld, { props: { msg: "Hello Vitest" } }); + it("renders properly", () => { + expect(wrapper.text()).toContain("Hello Vitest"); + }); +}); diff --git a/tests/views/AboutView.spec.ts b/tests/views/AboutView.spec.ts new file mode 100644 index 0000000..1031c3a --- /dev/null +++ b/tests/views/AboutView.spec.ts @@ -0,0 +1,11 @@ +import { describe, it, expect } from "vitest"; + +import { mount } from "@vue/test-utils"; +import AboutView from "../../src/views/AboutView.vue"; + +describe("AboutView", () => { + const wrapper = mount(AboutView); + it("renders properly", () => { + expect(wrapper.text()).toContain("This is an about page"); + }); +}); diff --git a/tests/views/HomeView.spec.ts b/tests/views/HomeView.spec.ts new file mode 100644 index 0000000..ed5826a --- /dev/null +++ b/tests/views/HomeView.spec.ts @@ -0,0 +1,11 @@ +import { describe, it, expect } from "vitest"; + +import { mount } from "@vue/test-utils"; +import HomeView from "../../src/views/HomeView.vue"; + +describe("HomeView", () => { + const wrapper = mount(HomeView); + it("renders properly", () => { + expect(wrapper.text()).toContain("This is home page"); + }); +}); diff --git a/tsconfig.app.json b/tsconfig.app.json new file mode 100644 index 0000000..f7e2e54 --- /dev/null +++ b/tsconfig.app.json @@ -0,0 +1,12 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], + "exclude": ["tests/**/*.spec.ts"], + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..100cf6a --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.node.json" + }, + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.vitest.json" + } + ] +} diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..a83dfc9 --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,19 @@ +{ + "extends": "@tsconfig/node22/tsconfig.json", + "include": [ + "vite.config.*", + "vitest.config.*", + "cypress.config.*", + "nightwatch.conf.*", + "playwright.config.*", + "eslint.config.*" + ], + "compilerOptions": { + "noEmit": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + + "module": "ESNext", + "moduleResolution": "Bundler", + "types": ["node"] + } +} diff --git a/tsconfig.vitest.json b/tsconfig.vitest.json new file mode 100644 index 0000000..2342266 --- /dev/null +++ b/tsconfig.vitest.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.app.json", + "include": ["tests/**/*.spec.ts", "env.d.ts"], + "exclude": [], + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo", + + "lib": [], + "types": ["node", "jsdom"] + } +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..648cde1 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,19 @@ +import { fileURLToPath, URL } from "node:url"; + +import { defineConfig } from "vite"; +import vue from "@vitejs/plugin-vue"; +import vueDevTools from "vite-plugin-vue-devtools"; + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [vue(), vueDevTools()], + resolve: { + alias: { + "@": fileURLToPath(new URL("./src", import.meta.url)), + }, + }, + server: { + host: "0.0.0.0", + port: 3000, + }, +}); diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..eb6638b --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,17 @@ +import { fileURLToPath } from 'node:url' +import { mergeConfig, defineConfig, configDefaults } from 'vitest/config' +import viteConfig from './vite.config' + +export default mergeConfig( + viteConfig, + defineConfig({ + test: { + environment: 'jsdom', + exclude: [...configDefaults.exclude, 'e2e/**'], + root: fileURLToPath(new URL('./', import.meta.url)), + coverage: { + reporter: ['text', 'lcov'] + } + }, + }), +)