chore: update vite project

This commit is contained in:
mutoe 2023-09-06 19:55:16 +08:00 committed by Dongsen
parent 94a8774756
commit 9361ea9df5
9 changed files with 42 additions and 68 deletions

View File

@ -7,11 +7,4 @@ export default defineConfig({
baseUrl: 'http://localhost:4173',
defaultCommandTimeout: 8000,
},
component: {
specPattern: 'src/**/*.{cy,spec}.{js,ts,jsx,tsx}',
devServer: {
framework: 'vue',
bundler: 'vite',
},
},
})

View File

@ -10,8 +10,8 @@
"lint:script": "eslint \"{src/**/*.{ts,vue},cypress/**/*.ts}\"",
"lint:tsc": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "concurrently \"npm run lint:tsc\" \"npm run lint:script\"",
"test:unit": "cypress open --component",
"test:unit:ci": "cypress run --component --quiet --reporter spec",
"test:unit": "echo \"TODO: migrate to vitest\"",
"test:unit:ci": "echo \"TODO: migrate to vitest\"",
"test:e2e": "npm run build && concurrently -rk -s first \"npm run serve\" \"cypress open --e2e -c baseUrl=http://localhost:4137\"",
"test:e2e:local": "cypress open --e2e -c baseUrl=http://localhost:5173",
"test:e2e:ci": "npm run build && concurrently -rk -s first \"npm run serve\" \"cypress run --e2e -c baseUrl=http://localhost:4137\"",
@ -27,13 +27,11 @@
"vue-router": "^4.1.6"
},
"devDependencies": {
"@cypress/vue": "^5.0.3",
"@mutoe/eslint-config-preset-vue": "~2.1.2",
"@pinia/testing": "^0.0.14",
"@testing-library/cypress": "^8.0.7",
"@types/marked": "^4.0.8",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/tsconfig": "^0.1.3",
"@vitejs/plugin-vue": "^4.3.4",
"concurrently": "^7.6.0",
"cypress": "^11.2.0",
"eslint": "^8.31.0",
@ -43,9 +41,9 @@
"lint-staged": "^13.1.0",
"rollup-plugin-analyzer": "^4.0.0",
"swagger-typescript-api": "^12.0.2",
"typescript": "~4.9.4",
"vite": "^4.0.3",
"vue-tsc": "^1.0.19"
"typescript": "~5.0.4",
"vite": "^4.4.9",
"vue-tsc": "^1.8.8"
},
"lint-staged": {
"src/**/*.{ts,vue}": "eslint --fix",

1
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@ -1,14 +0,0 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/**/*.spec.ts", "src/***/*.spec.tsx"],
"compilerOptions": {
"baseUrl": ".",
"lib": ["ESNext", "DOM", "DOM.Iterable"]
},
"references": [
{
"path": "./tsconfig.config.json"
}
]
}

View File

@ -1,8 +0,0 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*", ".eslintrc.js"],
"compilerOptions": {
"composite": true,
"types": ["node"]
}
}

View File

@ -1,17 +0,0 @@
{
"extends": "./tsconfig.app.json",
"include": [
"env.d.ts",
"src/**/*",
"src/**/*.vue",
"cypress/support/component.*",
"cypress/support/commands.ts",
"cypress/fixtures/**/*"
],
"exclude": [],
"compilerOptions": {
"composite": true,
"types": ["cypress", "@testing-library/cypress"],
"noEmit": true
}
}

View File

@ -1,14 +1,25 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.config.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.cypress-ct.json"
}
]
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}

10
tsconfig.node.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

View File

@ -1,4 +1,4 @@
import { fileURLToPath, URL } from 'url'
import { fileURLToPath, URL } from 'node:url'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import analyzer from 'rollup-plugin-analyzer'
@ -7,7 +7,7 @@ import analyzer from 'rollup-plugin-analyzer'
export default defineConfig({
resolve: {
alias: {
src: fileURLToPath(new URL('./src', import.meta.url)),
src: fileURLToPath(new URL('src', import.meta.url)),
},
},
plugins: [