From 24b795e924b3190eeb7effd07ad8e296569c3f72 Mon Sep 17 00:00:00 2001 From: mhsnet Date: Wed, 28 Aug 2024 13:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E6=81=AF=E5=AE=98=E7=BD=91=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=AA=A8=E6=9E=B6=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yxgw-web/.eslintrc.cjs | 26 ++++++ yxgw-web/.gitignore | 30 ++++++ yxgw-web/.prettierrc.json | 8 ++ yxgw-web/.vscode/extensions.json | 7 ++ yxgw-web/README.md | 61 ++++++++++++ yxgw-web/cypress.config.ts | 8 ++ yxgw-web/cypress/e2e/example.cy.ts | 8 ++ yxgw-web/cypress/e2e/tsconfig.json | 8 ++ yxgw-web/cypress/fixtures/example.json | 5 + yxgw-web/cypress/support/commands.ts | 39 ++++++++ yxgw-web/cypress/support/e2e.ts | 20 ++++ yxgw-web/env.d.ts | 1 + yxgw-web/index.html | 13 +++ yxgw-web/package.json | 48 ++++++++++ yxgw-web/public/favicon.ico | Bin 0 -> 4286 bytes yxgw-web/src/App.vue | 85 +++++++++++++++++ yxgw-web/src/assets/base.css | 86 +++++++++++++++++ yxgw-web/src/assets/logo.svg | 1 + yxgw-web/src/assets/main.css | 35 +++++++ yxgw-web/src/components/HelloWorld.vue | 41 ++++++++ yxgw-web/src/components/TheWelcome.vue | 88 ++++++++++++++++++ yxgw-web/src/components/WelcomeItem.vue | 87 +++++++++++++++++ .../components/__tests__/HelloWorld.spec.ts | 11 +++ .../src/components/icons/IconCommunity.vue | 7 ++ .../components/icons/IconDocumentation.vue | 7 ++ .../src/components/icons/IconEcosystem.vue | 7 ++ yxgw-web/src/components/icons/IconSupport.vue | 7 ++ yxgw-web/src/components/icons/IconTooling.vue | 19 ++++ yxgw-web/src/main.ts | 14 +++ yxgw-web/src/router/index.ts | 23 +++++ yxgw-web/src/stores/counter.ts | 12 +++ yxgw-web/src/views/AboutView.vue | 15 +++ yxgw-web/src/views/HomeView.vue | 9 ++ yxgw-web/tsconfig.app.json | 14 +++ yxgw-web/tsconfig.json | 17 ++++ yxgw-web/tsconfig.node.json | 19 ++++ yxgw-web/tsconfig.vitest.json | 11 +++ yxgw-web/vite.config.ts | 20 ++++ yxgw-web/vitest.config.ts | 14 +++ 39 files changed, 931 insertions(+) create mode 100644 yxgw-web/.eslintrc.cjs create mode 100644 yxgw-web/.gitignore create mode 100644 yxgw-web/.prettierrc.json create mode 100644 yxgw-web/.vscode/extensions.json create mode 100644 yxgw-web/README.md create mode 100644 yxgw-web/cypress.config.ts create mode 100644 yxgw-web/cypress/e2e/example.cy.ts create mode 100644 yxgw-web/cypress/e2e/tsconfig.json create mode 100644 yxgw-web/cypress/fixtures/example.json create mode 100644 yxgw-web/cypress/support/commands.ts create mode 100644 yxgw-web/cypress/support/e2e.ts create mode 100644 yxgw-web/env.d.ts create mode 100644 yxgw-web/index.html create mode 100644 yxgw-web/package.json create mode 100644 yxgw-web/public/favicon.ico create mode 100644 yxgw-web/src/App.vue create mode 100644 yxgw-web/src/assets/base.css create mode 100644 yxgw-web/src/assets/logo.svg create mode 100644 yxgw-web/src/assets/main.css create mode 100644 yxgw-web/src/components/HelloWorld.vue create mode 100644 yxgw-web/src/components/TheWelcome.vue create mode 100644 yxgw-web/src/components/WelcomeItem.vue create mode 100644 yxgw-web/src/components/__tests__/HelloWorld.spec.ts create mode 100644 yxgw-web/src/components/icons/IconCommunity.vue create mode 100644 yxgw-web/src/components/icons/IconDocumentation.vue create mode 100644 yxgw-web/src/components/icons/IconEcosystem.vue create mode 100644 yxgw-web/src/components/icons/IconSupport.vue create mode 100644 yxgw-web/src/components/icons/IconTooling.vue create mode 100644 yxgw-web/src/main.ts create mode 100644 yxgw-web/src/router/index.ts create mode 100644 yxgw-web/src/stores/counter.ts create mode 100644 yxgw-web/src/views/AboutView.vue create mode 100644 yxgw-web/src/views/HomeView.vue create mode 100644 yxgw-web/tsconfig.app.json create mode 100644 yxgw-web/tsconfig.json create mode 100644 yxgw-web/tsconfig.node.json create mode 100644 yxgw-web/tsconfig.vitest.json create mode 100644 yxgw-web/vite.config.ts create mode 100644 yxgw-web/vitest.config.ts diff --git a/yxgw-web/.eslintrc.cjs b/yxgw-web/.eslintrc.cjs new file mode 100644 index 0000000..6617ed2 --- /dev/null +++ b/yxgw-web/.eslintrc.cjs @@ -0,0 +1,26 @@ +/* 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' + ], + overrides: [ + { + files: [ + 'cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}', + 'cypress/support/**/*.{js,ts,jsx,tsx}' + ], + 'extends': [ + 'plugin:cypress/recommended' + ] + } + ], + parserOptions: { + ecmaVersion: 'latest' + } +} diff --git a/yxgw-web/.gitignore b/yxgw-web/.gitignore new file mode 100644 index 0000000..8ee54e8 --- /dev/null +++ b/yxgw-web/.gitignore @@ -0,0 +1,30 @@ +# 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? + +*.tsbuildinfo diff --git a/yxgw-web/.prettierrc.json b/yxgw-web/.prettierrc.json new file mode 100644 index 0000000..66e2335 --- /dev/null +++ b/yxgw-web/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": false, + "tabWidth": 2, + "singleQuote": true, + "printWidth": 100, + "trailingComma": "none" +} \ No newline at end of file diff --git a/yxgw-web/.vscode/extensions.json b/yxgw-web/.vscode/extensions.json new file mode 100644 index 0000000..93ea3e7 --- /dev/null +++ b/yxgw-web/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + "recommendations": [ + "Vue.volar", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode" + ] +} diff --git a/yxgw-web/README.md b/yxgw-web/README.md new file mode 100644 index 0000000..81fd63c --- /dev/null +++ b/yxgw-web/README.md @@ -0,0 +1,61 @@ +# yxgw-web + +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://vitejs.dev/config/). + +## Project Setup + +```sh +yarn +``` + +### Compile and Hot-Reload for Development + +```sh +yarn dev +``` + +### Type-Check, Compile and Minify for Production + +```sh +yarn build +``` + +### Run Unit Tests with [Vitest](https://vitest.dev/) + +```sh +yarn test:unit +``` + +### Run End-to-End Tests with [Cypress](https://www.cypress.io/) + +```sh +yarn test:e2e:dev +``` + +This runs the end-to-end tests against the Vite development server. +It is much faster than the production build. + +But it's still recommended to test the production build with `test:e2e` before deploying (e.g. in CI environments): + +```sh +yarn build +yarn test:e2e +``` + +### Lint with [ESLint](https://eslint.org/) + +```sh +yarn lint +``` diff --git a/yxgw-web/cypress.config.ts b/yxgw-web/cypress.config.ts new file mode 100644 index 0000000..0f66080 --- /dev/null +++ b/yxgw-web/cypress.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'cypress' + +export default defineConfig({ + e2e: { + specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}', + baseUrl: 'http://localhost:4173' + } +}) diff --git a/yxgw-web/cypress/e2e/example.cy.ts b/yxgw-web/cypress/e2e/example.cy.ts new file mode 100644 index 0000000..7554c35 --- /dev/null +++ b/yxgw-web/cypress/e2e/example.cy.ts @@ -0,0 +1,8 @@ +// https://on.cypress.io/api + +describe('My First Test', () => { + it('visits the app root url', () => { + cy.visit('/') + cy.contains('h1', 'You did it!') + }) +}) diff --git a/yxgw-web/cypress/e2e/tsconfig.json b/yxgw-web/cypress/e2e/tsconfig.json new file mode 100644 index 0000000..c94f1d4 --- /dev/null +++ b/yxgw-web/cypress/e2e/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["./**/*", "../support/**/*"], + "compilerOptions": { + "isolatedModules": false, + "types": ["cypress"] + } +} diff --git a/yxgw-web/cypress/fixtures/example.json b/yxgw-web/cypress/fixtures/example.json new file mode 100644 index 0000000..02e4254 --- /dev/null +++ b/yxgw-web/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/yxgw-web/cypress/support/commands.ts b/yxgw-web/cypress/support/commands.ts new file mode 100644 index 0000000..9b7bb8e --- /dev/null +++ b/yxgw-web/cypress/support/commands.ts @@ -0,0 +1,39 @@ +/// +// *********************************************** +// This example commands.ts shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) +// +// declare global { +// namespace Cypress { +// interface Chainable { +// login(email: string, password: string): Chainable +// drag(subject: string, options?: Partial): Chainable +// dismiss(subject: string, options?: Partial): Chainable +// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable +// } +// } +// } + +export {} diff --git a/yxgw-web/cypress/support/e2e.ts b/yxgw-web/cypress/support/e2e.ts new file mode 100644 index 0000000..d68db96 --- /dev/null +++ b/yxgw-web/cypress/support/e2e.ts @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') diff --git a/yxgw-web/env.d.ts b/yxgw-web/env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/yxgw-web/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/yxgw-web/index.html b/yxgw-web/index.html new file mode 100644 index 0000000..a888544 --- /dev/null +++ b/yxgw-web/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite App + + +
+ + + diff --git a/yxgw-web/package.json b/yxgw-web/package.json new file mode 100644 index 0000000..395a347 --- /dev/null +++ b/yxgw-web/package.json @@ -0,0 +1,48 @@ +{ + "name": "yxgw-web", + "version": "0.0.0", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "run-p type-check \"build-only {@}\" --", + "preview": "vite preview", + "test:unit": "vitest", + "test:e2e": "start-server-and-test preview http://localhost:4173 'cypress run --e2e'", + "test:e2e:dev": "start-server-and-test 'vite dev --port 4173' http://localhost:4173 'cypress open --e2e'", + "build-only": "vite build", + "type-check": "vue-tsc --build --force", + "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "format": "prettier --write src/" + }, + "dependencies": { + "pinia": "^2.1.7", + "vue": "^3.4.29", + "vue-router": "^4.3.3" + }, + "devDependencies": { + "@rushstack/eslint-patch": "^1.8.0", + "@tsconfig/node20": "^20.1.4", + "@types/jsdom": "^21.1.7", + "@types/node": "^20.14.5", + "@vitejs/plugin-vue": "^5.0.5", + "@vitejs/plugin-vue-jsx": "^4.0.0", + "@vue/eslint-config-prettier": "^9.0.0", + "@vue/eslint-config-typescript": "^13.0.0", + "@vue/test-utils": "^2.4.6", + "@vue/tsconfig": "^0.5.1", + "cypress": "^13.12.0", + "eslint": "^8.57.0", + "eslint-plugin-cypress": "^3.3.0", + "eslint-plugin-vue": "^9.23.0", + "jsdom": "^24.1.0", + "npm-run-all2": "^6.2.0", + "prettier": "^3.2.5", + "start-server-and-test": "^2.0.4", + "typescript": "~5.4.0", + "vite": "^5.3.1", + "vite-plugin-vue-devtools": "^7.3.1", + "vitest": "^1.6.0", + "vue-tsc": "^2.0.21" + } +} diff --git a/yxgw-web/public/favicon.ico b/yxgw-web/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/yxgw-web/src/App.vue b/yxgw-web/src/App.vue new file mode 100644 index 0000000..7905b05 --- /dev/null +++ b/yxgw-web/src/App.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/yxgw-web/src/assets/base.css b/yxgw-web/src/assets/base.css new file mode 100644 index 0000000..8816868 --- /dev/null +++ b/yxgw-web/src/assets/base.css @@ -0,0 +1,86 @@ +/* color palette from */ +:root { + --vt-c-white: #ffffff; + --vt-c-white-soft: #f8f8f8; + --vt-c-white-mute: #f2f2f2; + + --vt-c-black: #181818; + --vt-c-black-soft: #222222; + --vt-c-black-mute: #282828; + + --vt-c-indigo: #2c3e50; + + --vt-c-divider-light-1: rgba(60, 60, 60, 0.29); + --vt-c-divider-light-2: rgba(60, 60, 60, 0.12); + --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); + --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); + + --vt-c-text-light-1: var(--vt-c-indigo); + --vt-c-text-light-2: rgba(60, 60, 60, 0.66); + --vt-c-text-dark-1: var(--vt-c-white); + --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); +} + +/* semantic color variables for this project */ +:root { + --color-background: var(--vt-c-white); + --color-background-soft: var(--vt-c-white-soft); + --color-background-mute: var(--vt-c-white-mute); + + --color-border: var(--vt-c-divider-light-2); + --color-border-hover: var(--vt-c-divider-light-1); + + --color-heading: var(--vt-c-text-light-1); + --color-text: var(--vt-c-text-light-1); + + --section-gap: 160px; +} + +@media (prefers-color-scheme: dark) { + :root { + --color-background: var(--vt-c-black); + --color-background-soft: var(--vt-c-black-soft); + --color-background-mute: var(--vt-c-black-mute); + + --color-border: var(--vt-c-divider-dark-2); + --color-border-hover: var(--vt-c-divider-dark-1); + + --color-heading: var(--vt-c-text-dark-1); + --color-text: var(--vt-c-text-dark-2); + } +} + +*, +*::before, +*::after { + box-sizing: border-box; + margin: 0; + font-weight: normal; +} + +body { + min-height: 100vh; + color: var(--color-text); + background: var(--color-background); + transition: + color 0.5s, + background-color 0.5s; + line-height: 1.6; + font-family: + Inter, + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + Oxygen, + Ubuntu, + Cantarell, + 'Fira Sans', + 'Droid Sans', + 'Helvetica Neue', + sans-serif; + font-size: 15px; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} diff --git a/yxgw-web/src/assets/logo.svg b/yxgw-web/src/assets/logo.svg new file mode 100644 index 0000000..7565660 --- /dev/null +++ b/yxgw-web/src/assets/logo.svg @@ -0,0 +1 @@ + diff --git a/yxgw-web/src/assets/main.css b/yxgw-web/src/assets/main.css new file mode 100644 index 0000000..36fb845 --- /dev/null +++ b/yxgw-web/src/assets/main.css @@ -0,0 +1,35 @@ +@import './base.css'; + +#app { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + font-weight: normal; +} + +a, +.green { + text-decoration: none; + color: hsla(160, 100%, 37%, 1); + transition: 0.4s; + padding: 3px; +} + +@media (hover: hover) { + a:hover { + background-color: hsla(160, 100%, 37%, 0.2); + } +} + +@media (min-width: 1024px) { + body { + display: flex; + place-items: center; + } + + #app { + display: grid; + grid-template-columns: 1fr 1fr; + padding: 0 2rem; + } +} diff --git a/yxgw-web/src/components/HelloWorld.vue b/yxgw-web/src/components/HelloWorld.vue new file mode 100644 index 0000000..38d821e --- /dev/null +++ b/yxgw-web/src/components/HelloWorld.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/yxgw-web/src/components/TheWelcome.vue b/yxgw-web/src/components/TheWelcome.vue new file mode 100644 index 0000000..49d8f73 --- /dev/null +++ b/yxgw-web/src/components/TheWelcome.vue @@ -0,0 +1,88 @@ + + + diff --git a/yxgw-web/src/components/WelcomeItem.vue b/yxgw-web/src/components/WelcomeItem.vue new file mode 100644 index 0000000..6d7086a --- /dev/null +++ b/yxgw-web/src/components/WelcomeItem.vue @@ -0,0 +1,87 @@ + + + diff --git a/yxgw-web/src/components/__tests__/HelloWorld.spec.ts b/yxgw-web/src/components/__tests__/HelloWorld.spec.ts new file mode 100644 index 0000000..2533202 --- /dev/null +++ b/yxgw-web/src/components/__tests__/HelloWorld.spec.ts @@ -0,0 +1,11 @@ +import { describe, it, expect } from 'vitest' + +import { mount } from '@vue/test-utils' +import HelloWorld from '../HelloWorld.vue' + +describe('HelloWorld', () => { + it('renders properly', () => { + const wrapper = mount(HelloWorld, { props: { msg: 'Hello Vitest' } }) + expect(wrapper.text()).toContain('Hello Vitest') + }) +}) diff --git a/yxgw-web/src/components/icons/IconCommunity.vue b/yxgw-web/src/components/icons/IconCommunity.vue new file mode 100644 index 0000000..2dc8b05 --- /dev/null +++ b/yxgw-web/src/components/icons/IconCommunity.vue @@ -0,0 +1,7 @@ + diff --git a/yxgw-web/src/components/icons/IconDocumentation.vue b/yxgw-web/src/components/icons/IconDocumentation.vue new file mode 100644 index 0000000..6d4791c --- /dev/null +++ b/yxgw-web/src/components/icons/IconDocumentation.vue @@ -0,0 +1,7 @@ + diff --git a/yxgw-web/src/components/icons/IconEcosystem.vue b/yxgw-web/src/components/icons/IconEcosystem.vue new file mode 100644 index 0000000..c3a4f07 --- /dev/null +++ b/yxgw-web/src/components/icons/IconEcosystem.vue @@ -0,0 +1,7 @@ + diff --git a/yxgw-web/src/components/icons/IconSupport.vue b/yxgw-web/src/components/icons/IconSupport.vue new file mode 100644 index 0000000..7452834 --- /dev/null +++ b/yxgw-web/src/components/icons/IconSupport.vue @@ -0,0 +1,7 @@ + diff --git a/yxgw-web/src/components/icons/IconTooling.vue b/yxgw-web/src/components/icons/IconTooling.vue new file mode 100644 index 0000000..660598d --- /dev/null +++ b/yxgw-web/src/components/icons/IconTooling.vue @@ -0,0 +1,19 @@ + + diff --git a/yxgw-web/src/main.ts b/yxgw-web/src/main.ts new file mode 100644 index 0000000..5dcad83 --- /dev/null +++ b/yxgw-web/src/main.ts @@ -0,0 +1,14 @@ +import './assets/main.css' + +import { createApp } from 'vue' +import { createPinia } from 'pinia' + +import App from './App.vue' +import router from './router' + +const app = createApp(App) + +app.use(createPinia()) +app.use(router) + +app.mount('#app') diff --git a/yxgw-web/src/router/index.ts b/yxgw-web/src/router/index.ts new file mode 100644 index 0000000..a49ae50 --- /dev/null +++ b/yxgw-web/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/yxgw-web/src/stores/counter.ts b/yxgw-web/src/stores/counter.ts new file mode 100644 index 0000000..b6757ba --- /dev/null +++ b/yxgw-web/src/stores/counter.ts @@ -0,0 +1,12 @@ +import { ref, computed } from 'vue' +import { defineStore } from 'pinia' + +export const useCounterStore = defineStore('counter', () => { + const count = ref(0) + const doubleCount = computed(() => count.value * 2) + function increment() { + count.value++ + } + + return { count, doubleCount, increment } +}) diff --git a/yxgw-web/src/views/AboutView.vue b/yxgw-web/src/views/AboutView.vue new file mode 100644 index 0000000..756ad2a --- /dev/null +++ b/yxgw-web/src/views/AboutView.vue @@ -0,0 +1,15 @@ + + + diff --git a/yxgw-web/src/views/HomeView.vue b/yxgw-web/src/views/HomeView.vue new file mode 100644 index 0000000..d5c0217 --- /dev/null +++ b/yxgw-web/src/views/HomeView.vue @@ -0,0 +1,9 @@ + + + diff --git a/yxgw-web/tsconfig.app.json b/yxgw-web/tsconfig.app.json new file mode 100644 index 0000000..e14c754 --- /dev/null +++ b/yxgw-web/tsconfig.app.json @@ -0,0 +1,14 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], + "exclude": ["src/**/__tests__/*"], + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/yxgw-web/tsconfig.json b/yxgw-web/tsconfig.json new file mode 100644 index 0000000..5304731 --- /dev/null +++ b/yxgw-web/tsconfig.json @@ -0,0 +1,17 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.node.json" + }, + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.vitest.json" + } + ], + "compilerOptions": { + "module": "NodeNext" + } +} diff --git a/yxgw-web/tsconfig.node.json b/yxgw-web/tsconfig.node.json new file mode 100644 index 0000000..f094063 --- /dev/null +++ b/yxgw-web/tsconfig.node.json @@ -0,0 +1,19 @@ +{ + "extends": "@tsconfig/node20/tsconfig.json", + "include": [ + "vite.config.*", + "vitest.config.*", + "cypress.config.*", + "nightwatch.conf.*", + "playwright.config.*" + ], + "compilerOptions": { + "composite": true, + "noEmit": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + + "module": "ESNext", + "moduleResolution": "Bundler", + "types": ["node"] + } +} diff --git a/yxgw-web/tsconfig.vitest.json b/yxgw-web/tsconfig.vitest.json new file mode 100644 index 0000000..571995d --- /dev/null +++ b/yxgw-web/tsconfig.vitest.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.app.json", + "exclude": [], + "compilerOptions": { + "composite": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.vitest.tsbuildinfo", + + "lib": [], + "types": ["node", "jsdom"] + } +} diff --git a/yxgw-web/vite.config.ts b/yxgw-web/vite.config.ts new file mode 100644 index 0000000..a8978fd --- /dev/null +++ b/yxgw-web/vite.config.ts @@ -0,0 +1,20 @@ +import { fileURLToPath, URL } from 'node:url' + +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' +import vueDevTools from 'vite-plugin-vue-devtools' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + vue(), + vueJsx(), + vueDevTools(), + ], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)) + } + } +}) diff --git a/yxgw-web/vitest.config.ts b/yxgw-web/vitest.config.ts new file mode 100644 index 0000000..4b1c897 --- /dev/null +++ b/yxgw-web/vitest.config.ts @@ -0,0 +1,14 @@ +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)) + } + }) +)