chore(deps): update vite related dependency for play and docs (#18809)

* chore(deps): update vite related dependency for play and docs

* fix: type error

* fix: unocss

* chore: add port

* fix: types

---------

Co-authored-by: warmthsea <2586244885@qq.com>
This commit is contained in:
qiang 2024-11-08 09:38:27 +08:00 committed by GitHub
parent 906141b4d2
commit ead1002533
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 1595 additions and 2694 deletions

View File

@ -1,15 +0,0 @@
import { resolveConfig } from 'vite'
import type { VitePluginPWAAPI } from 'vite-plugin-pwa'
const rebuildPwa = async () => {
const config = await resolveConfig({}, 'build', 'production')
const pwaPlugin: VitePluginPWAAPI = config.plugins.find((i) => {
return i.name === 'vite-plugin-pwa'
})?.api
if (pwaPlugin && pwaPlugin.generateSW && !pwaPlugin.disabled) {
await pwaPlugin.generateSW()
}
}
rebuildPwa()

View File

@ -3,7 +3,7 @@
"private": true,
"scripts": {
"dev": "pnpm gen-locale && vitepress dev .",
"build": "NODE_ENV=production && vitepress build . && tsx .vitepress/build/rebuild-pwa.ts",
"build": "NODE_ENV=production && vitepress build .",
"serve": "NODE_ENV=production vitepress serve . --port 5001",
"gen-locale": "rimraf .vitepress/i18n && tsx .vitepress/build/crowdin-generate.ts",
"crowdin-credentials": "tsx .vitepress/build/crowdin-credentials.ts"
@ -27,18 +27,17 @@
"@element-plus/build-utils": "workspace:*",
"@iconify-json/ri": "^1.1.3",
"@mdit-vue/shared": "^2.1.3",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"@vitejs/plugin-vue-jsx": "^4.0.1",
"chalk": "^4.1.2",
"consola": "^2.15.3",
"escape-html": "^1.0.3",
"fast-glob": "^3.2.11",
"markdown-it-container": "^3.0.0",
"unocss": "0.33.5",
"unplugin-icons": "^0.14.6",
"unplugin-vue-components": "^0.27.3",
"vite-plugin-inspect": "^0.5.0",
"vite-plugin-mkcert": "^1.7.2",
"vite-plugin-pwa": "^0.12.0",
"unocss": "0.63.6",
"unplugin-icons": "^0.14.15",
"unplugin-vue-components": "^0.27.4",
"vite-plugin-inspect": "^0.8.7",
"vite-plugin-mkcert": "^1.17.6",
"vitepress": "^1.2.3"
}
}

View File

@ -15,9 +15,8 @@
"element-plus": ["../packages/element-plus"],
"~/*": ["./.vitepress/vitepress/*"]
},
"types": ["../typings/global"],
"jsx": "preserve"
},
"include": ["**/*", ".vitepress/**/*"],
"include": ["**/*", ".vitepress/**/*", "../typings/global.d.ts"],
"exclude": ["node_modules"]
}

View File

@ -2,8 +2,12 @@ import { defineConfig, presetAttributify, presetIcons, presetUno } from 'unocss'
export default defineConfig({
presets: [presetUno(), presetAttributify(), presetIcons()],
include: [`./**/*`],
exclude: [`./node_modules/**/*`, `./.vitepress/cache/**/*`],
content: {
pipeline: {
include: [`./**/*`],
exclude: [`./node_modules/**/*`, `./.vitepress/cache/**/*`],
},
},
theme: {
breakpoints: {
sm: '640px',

View File

@ -111,7 +111,6 @@
"tsx": "^4.7.1",
"type-fest": "^2.14.0",
"typescript": "~5.5.4",
"unplugin-element-plus": "^0.4.0",
"unplugin-vue-macros": "^2.7.11",
"vitest": "^2.0.5",
"vue": "^3.2.37",

View File

@ -1,10 +1,14 @@
import { createApp } from 'vue'
import { Component, createApp } from 'vue'
import '@element-plus/theme-chalk/src/dark/css-vars.scss'
import '@element-plus/theme-chalk/src/notification.scss'
import '@element-plus/theme-chalk/src/message-box.scss'
import '@element-plus/theme-chalk/src/message.scss'
;(async () => {
const apps = import.meta.glob('./src/*.vue')
const apps = import.meta.glob<
true,
string,
() => Promise<{ default: Component }>
>('./src/*.vue')
const name = location.pathname.replace(/^\//, '') || 'App'
const file = apps[`./src/${name}.vue`]
if (!file) {

View File

@ -12,10 +12,10 @@
"vue": "^3.2.37"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.3.3",
"unplugin-vue-components": "0.21.2",
"vite": "^2.9.15",
"vite-plugin-inspect": "^0.5.0",
"vite-plugin-mkcert": "^1.7.2"
"@vitejs/plugin-vue": "^5.1.4",
"unplugin-vue-components": "0.27.4",
"vite": "^5.4.10",
"vite-plugin-inspect": "^0.8.7",
"vite-plugin-mkcert": "^1.17.6"
}
}

View File

@ -32,11 +32,9 @@ export default defineConfig(async ({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
let { dependencies } = getPackageDependencies(epPackage)
dependencies = dependencies.filter((dep) => !dep.startsWith('@types/')) // exclude dts deps
const optimizeDeps = (
await glob(['dayjs/(locale|plugin)/*.js'], {
cwd: path.resolve(projRoot, 'node_modules'),
})
)
const optimizeDeps = await glob(['dayjs/(locale|plugin)/*.js'], {
cwd: path.resolve(projRoot, 'node_modules'),
})
return {
css: {
@ -60,8 +58,9 @@ export default defineConfig(async ({ mode }) => {
],
},
server: {
port: 3000,
host: true,
https: !!env.HTTPS,
https: !!env.HTTPS ? {} : false,
},
build: {
sourcemap: true,
@ -78,7 +77,10 @@ export default defineConfig(async ({ mode }) => {
esbuildPlugin(),
Components({
include: `${__dirname}/**`,
resolvers: ElementPlusResolver({ importStyle: 'sass' }),
resolvers: ElementPlusResolver({
version: '2.0.0-dev.1',
importStyle: 'sass',
}),
dts: false,
}),
mkcert(),

File diff suppressed because it is too large Load Diff