mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 04:03:10 +08:00
feat: Feature/pro docs (#70)
* chore: merge main * feat: update docs * feat: remove coze-assistant * feat: add watermark plugin * feat: update preferences * feat: update docs --------- Co-authored-by: vince <vince292007@gmail.com>
This commit is contained in:
@@ -34,20 +34,20 @@
|
||||
"nitropack": "^2.9.7",
|
||||
"resolve.exports": "^2.0.2",
|
||||
"vite-plugin-lib-inject-css": "^2.1.1",
|
||||
"vite-plugin-pwa": "^0.20.0",
|
||||
"vite-plugin-vue-devtools": "^7.3.6"
|
||||
"vite-plugin-pwa": "^0.20.1",
|
||||
"vite-plugin-vue-devtools": "^7.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/html-minifier-terser": "^7.0.2",
|
||||
"@vben/node-utils": "workspace:*",
|
||||
"@vitejs/plugin-vue": "^5.0.5",
|
||||
"@vitejs/plugin-vue": "^5.1.1",
|
||||
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
||||
"dayjs": "^1.11.12",
|
||||
"dotenv": "^16.4.5",
|
||||
"rollup": "^4.19.0",
|
||||
"rollup": "^4.19.1",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.77.8",
|
||||
"vite": "^5.3.4",
|
||||
"vite": "^5.3.5",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-dts": "4.0.0-beta.1",
|
||||
"vite-plugin-html": "^3.2.2"
|
||||
|
@@ -94,7 +94,7 @@ function createCssOptions(injectGlobalScss = true) {
|
||||
const relativePath = relative(root, filepath);
|
||||
// apps下的包注入全局样式
|
||||
if (relativePath.startsWith('apps/')) {
|
||||
return `@import "@vben/styles/global";\n${content}`;
|
||||
return `@import (reference) "@vben/styles/global";\n${content}`;
|
||||
}
|
||||
return content;
|
||||
},
|
||||
|
@@ -7,16 +7,16 @@ const isDevelopment = process.env.NODE_ENV === 'development';
|
||||
const getDefaultPwaOptions = (name: string): Partial<PwaPluginOptions> => ({
|
||||
manifest: {
|
||||
description:
|
||||
'Vue Vben Admin is a modern admin dashboard template based on Vue 3. ',
|
||||
'Vben Admin is a modern admin dashboard template based on Vue 3. ',
|
||||
icons: [
|
||||
{
|
||||
sizes: '192x192',
|
||||
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-192.png',
|
||||
src: 'https://unpkg.com/@vbenjs/static-source@0.1.5/source/pwa-icon-192.png',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
sizes: '512x512',
|
||||
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-512.png',
|
||||
src: 'https://unpkg.com/@vbenjs/static-source@0.1.5/source/pwa-icon-512.png',
|
||||
type: 'image/png',
|
||||
},
|
||||
],
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { fs } from '@vben/node-utils';
|
||||
import { fs, readPackageJSON } from '@vben/node-utils';
|
||||
|
||||
import { type PluginOption } from 'vite';
|
||||
|
||||
@@ -15,8 +15,9 @@ async function viteInjectAppLoadingPlugin(
|
||||
loadingTemplate = 'loading.html',
|
||||
): Promise<PluginOption | undefined> {
|
||||
const loadingHtml = await getLoadingRawByHtmlTemplate(loadingTemplate);
|
||||
const { version } = await readPackageJSON(process.cwd());
|
||||
const envRaw = isBuild ? 'prod' : 'dev';
|
||||
const cacheName = `'${env.VITE_APP_NAMESPACE}-${envRaw}-preferences-theme'`;
|
||||
const cacheName = `'${env.VITE_APP_NAMESPACE}-${version}-${envRaw}-preferences-theme'`;
|
||||
|
||||
// 获取缓存的主题
|
||||
// 保证黑暗主题下,刷新页面时,loading也是黑暗主题
|
||||
|
@@ -74,6 +74,7 @@ async function viteMetadataPlugin(
|
||||
license,
|
||||
version,
|
||||
}),
|
||||
'import.meta.env.VITE_APP_VERSION': JSON.stringify(version),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
@@ -30,7 +30,7 @@ async function viteLicensePlugin(
|
||||
handler: (_options: NormalizedOutputOptions, bundle: OutputBundle) => {
|
||||
const date = dateUtil().format('YYYY-MM-DD ');
|
||||
const copyrightText = `/*!
|
||||
* Vue Vben Admin
|
||||
* Vben Admin
|
||||
* Version: ${version}
|
||||
* Author: vben
|
||||
* Copyright (C) 2024 Vben
|
||||
|
@@ -56,24 +56,40 @@ async function loadAndConvertEnv(
|
||||
match = 'VITE_',
|
||||
confFiles = getConfFiles(),
|
||||
): Promise<
|
||||
{ appTitle: string; port: number } & Partial<ApplicationPluginOptions>
|
||||
{
|
||||
appTitle: string;
|
||||
base: string;
|
||||
port: number;
|
||||
} & Partial<ApplicationPluginOptions>
|
||||
> {
|
||||
const envConfig = await loadEnv(match, confFiles);
|
||||
const visualizer = envConfig.visualizer || '';
|
||||
const pwa = envConfig.pwa || '';
|
||||
const compress = envConfig.VITE_COMPRESS || '';
|
||||
const {
|
||||
VITE_BASE,
|
||||
VITE_COMPRESS,
|
||||
VITE_DEVTOOLS,
|
||||
VITE_GLOB_APP_TITLE,
|
||||
VITE_INJECT_APP_LOADING,
|
||||
VITE_NITRO_MOCK,
|
||||
VITE_PORT,
|
||||
VITE_PWA,
|
||||
VITE_VISUALIZER,
|
||||
} = envConfig;
|
||||
const compress = VITE_COMPRESS || '';
|
||||
const compressTypes = compress
|
||||
.split(',')
|
||||
.filter((item) => item === 'brotli' || item === 'gzip');
|
||||
|
||||
return {
|
||||
appTitle: envConfig?.VITE_GLOB_APP_TITLE ?? 'Vben Admin',
|
||||
appTitle: VITE_GLOB_APP_TITLE ?? 'Vben Admin',
|
||||
base: VITE_BASE || '/',
|
||||
compress: !!compress,
|
||||
compressTypes: compressTypes as ('brotli' | 'gzip')[],
|
||||
nitroMock: !!envConfig.VITE_NITRO_MOCK,
|
||||
port: Number(envConfig.VITE_PORT) || 5173,
|
||||
pwa: !!pwa,
|
||||
visualizer: !!visualizer,
|
||||
devtools: VITE_DEVTOOLS === 'true',
|
||||
injectAppLoading: VITE_INJECT_APP_LOADING === 'true',
|
||||
nitroMock: VITE_NITRO_MOCK === 'true',
|
||||
port: Number(VITE_PORT) || 5173,
|
||||
pwa: VITE_PWA === 'true',
|
||||
visualizer: VITE_VISUALIZER === 'true',
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user