refactor(project): @vben/vite-connect is reconfigured to support synchronization
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
# @vben-core/forward
|
||||
|
||||
该目录内的包,可直接被app所引用
|
||||
该目录内的包,可直接被app所引用,其是项目基础功能的一层抽象。允许轻微的副作用耦合,如`locales`的集成。
|
||||
|
||||
## 注意事项
|
||||
|
||||
- `forward` 内的包不允许相互引用,有相互引用的情况请考虑是否放到`packages/effects`下
|
||||
|
@@ -4,6 +4,8 @@ import {
|
||||
type InternalAxiosRequestConfig,
|
||||
} from 'axios';
|
||||
|
||||
const errorHandler = (res: Error) => Promise.reject(res);
|
||||
|
||||
class InterceptorManager {
|
||||
private axiosInstance: AxiosInstance;
|
||||
|
||||
@@ -19,7 +21,7 @@ class InterceptorManager {
|
||||
) {
|
||||
this.axiosInstance.interceptors.request.use(
|
||||
fulfilled,
|
||||
rejected || ((res) => Promise.reject(res)),
|
||||
rejected || errorHandler,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,7 +33,7 @@ class InterceptorManager {
|
||||
) {
|
||||
this.axiosInstance.interceptors.response.use(
|
||||
fulfilled,
|
||||
rejected || ((res) => Promise.reject(res)),
|
||||
rejected || errorHandler,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -3,10 +3,20 @@
|
||||
*/
|
||||
const VBEN_GITHUB_URL = 'https://github.com/vbenjs/vue-vben-admin';
|
||||
|
||||
/**
|
||||
* @zh_CN 文档地址
|
||||
*/
|
||||
const VBEN_DOC_URL = 'https://doc.vben.pro';
|
||||
|
||||
/**
|
||||
* @zh_CN Vben Logo
|
||||
*/
|
||||
const VBEN_LOGO_URL =
|
||||
'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/logo-v1.webp';
|
||||
|
||||
export { VBEN_GITHUB_URL, VBEN_LOGO_URL };
|
||||
/**
|
||||
* @zh_CN Vben Admin 首页地址
|
||||
*/
|
||||
const VBEN_PREVIEW_URL = 'https://vben.pro';
|
||||
|
||||
export { VBEN_DOC_URL, VBEN_GITHUB_URL, VBEN_LOGO_URL, VBEN_PREVIEW_URL };
|
||||
|
@@ -1,7 +1,9 @@
|
||||
import { defineConfig } from '@vben/vite-config';
|
||||
|
||||
export default defineConfig({
|
||||
vite: {
|
||||
publicDir: 'src/scss-bem',
|
||||
},
|
||||
export default defineConfig(async () => {
|
||||
return {
|
||||
vite: {
|
||||
publicDir: 'src/scss-bem',
|
||||
},
|
||||
};
|
||||
});
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
`effects` 目录专门用于存放与副作用相关的代码和逻辑。如果你的包具有以下特点,建议将其放置在 `effects` 目录下:
|
||||
|
||||
- 使用状态管理框架 Pinia,并包含处理副作用(如异步操作、API 调用)的部分。
|
||||
- 使用状态管理框架 `pinia`,并包含处理副作用(如异步操作、API 调用)的部分。
|
||||
- 使用 `@vben-core/preferences` 处理用户偏好设置,涉及本地存储或浏览器缓存逻辑(如使用 `localStorage`)。
|
||||
- 处理导航、页面跳转等场景,需要管理路由变化的逻辑。
|
||||
- 包含与特定组件库紧密耦合或依赖大型仓库的部分。
|
||||
|
@@ -3,6 +3,11 @@ import type { AboutProps, DescriptionItem } from './about';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import {
|
||||
VBEN_DOC_URL,
|
||||
VBEN_GITHUB_URL,
|
||||
VBEN_PREVIEW_URL,
|
||||
} from '@vben/constants';
|
||||
import { VbenLink, VbenRenderContent } from '@vben-core/shadcn-ui';
|
||||
|
||||
interface Props extends AboutProps {}
|
||||
@@ -27,7 +32,6 @@ const {
|
||||
devDependencies = {},
|
||||
homepage,
|
||||
license,
|
||||
repositoryUrl,
|
||||
version,
|
||||
// vite inject-metadata 插件注入的全局变量
|
||||
// eslint-disable-next-line no-undef
|
||||
@@ -47,24 +51,17 @@ const vbenDescriptionItems: DescriptionItem[] = [
|
||||
title: '最后构建时间',
|
||||
},
|
||||
{
|
||||
// TODO:
|
||||
content: h(VbenLink, { href: homepage }, { default: () => '点击查看' }),
|
||||
title: '主页',
|
||||
},
|
||||
{
|
||||
// TODO:
|
||||
content: h(
|
||||
VbenLink,
|
||||
{ href: repositoryUrl },
|
||||
{ default: () => '点击查看' },
|
||||
),
|
||||
content: h(VbenLink, { href: VBEN_DOC_URL }, { default: () => '点击查看' }),
|
||||
title: '文档地址',
|
||||
},
|
||||
{
|
||||
// TODO:
|
||||
content: h(
|
||||
VbenLink,
|
||||
{ href: repositoryUrl },
|
||||
{ href: VBEN_PREVIEW_URL },
|
||||
{ default: () => '点击查看' },
|
||||
),
|
||||
title: '预览地址',
|
||||
@@ -72,7 +69,7 @@ const vbenDescriptionItems: DescriptionItem[] = [
|
||||
{
|
||||
content: h(
|
||||
VbenLink,
|
||||
{ href: repositoryUrl },
|
||||
{ href: VBEN_GITHUB_URL },
|
||||
{ default: () => '点击查看' },
|
||||
),
|
||||
title: 'Github',
|
||||
@@ -113,7 +110,7 @@ const devDependenciesItems = Object.keys(devDependencies).map((key) => ({
|
||||
{{ title }}
|
||||
</h3>
|
||||
<p class="text-foreground/80 mt-3 text-sm leading-6">
|
||||
<VbenLink :href="repositoryUrl">
|
||||
<VbenLink :href="VBEN_GITHUB_URL">
|
||||
{{ name }}
|
||||
</VbenLink>
|
||||
{{ description }}
|
||||
|
@@ -1,16 +1,18 @@
|
||||
import { defineConfig } from '@vben/vite-config';
|
||||
|
||||
export default defineConfig({
|
||||
vite: {
|
||||
build: {
|
||||
lib: {
|
||||
entry: {
|
||||
antd: 'src/antd/index.ts',
|
||||
index: 'src/index.ts',
|
||||
export default defineConfig(async () => {
|
||||
return {
|
||||
vite: {
|
||||
build: {
|
||||
lib: {
|
||||
entry: {
|
||||
antd: 'src/antd/index.ts',
|
||||
index: 'src/index.ts',
|
||||
},
|
||||
fileName: (_format, name) => `${name}.mjs`,
|
||||
},
|
||||
fileName: (_format, name) => `${name}.mjs`,
|
||||
},
|
||||
publicDir: 'src/bem',
|
||||
},
|
||||
publicDir: 'src/bem',
|
||||
},
|
||||
};
|
||||
});
|
||||
|
Reference in New Issue
Block a user