This commit is contained in:
神仙都没用 2024-08-13 17:29:12 +08:00
parent 164c27e3bc
commit 705d4c34f2
9 changed files with 67 additions and 37 deletions

View File

@ -5,4 +5,8 @@ export declare function createEps(query?: {
service: {};
list: Eps.Entity[];
isUpdate: boolean;
} | {
service: {};
list: never[];
isUpdate?: undefined;
}>;

View File

@ -9,6 +9,7 @@
reqUrl: "",
demo: false,
eps: {
enable: true,
api: "",
dist: "./build/cool",
mapping: [
@ -493,21 +494,29 @@
}
// 创建 eps
async function createEps(query) {
// 获取数据
await getData(query?.list || []);
// 创建 service
createService();
// 创建目录
createDir(getEpsPath(), true);
// 创建 json 文件
const isUpdate = createJson();
// 创建描述文件
createDescribe({ service, list });
return {
service,
list,
isUpdate,
};
if (config.eps.enable) {
// 获取数据
await getData(query?.list || []);
// 创建 service
createService();
// 创建目录
createDir(getEpsPath(), true);
// 创建 json 文件
const isUpdate = createJson();
// 创建描述文件
createDescribe({ service, list });
return {
service,
list,
isUpdate,
};
}
else {
return {
service: {},
list: [],
};
}
}
function createTag(code, id) {
@ -872,7 +881,9 @@ if (typeof window !== 'undefined') {
config.reqUrl = options.proxy["/dev/"].target;
// Eps
if (options.eps) {
const { dist, mapping, api } = options.eps;
const { dist, mapping, api, enable = true } = options.eps;
// 是否开启
config.eps.enable = enable;
// 类型
if (api) {
config.eps.api = api;

View File

@ -1,6 +1,6 @@
{
"name": "@cool-vue/vite-plugin",
"version": "7.2.1",
"version": "7.2.2",
"description": "cool-admin、cool-uni builder",
"main": "/dist/index.js",
"scripts": {

View File

@ -5,6 +5,7 @@ export const config: Config.Data = {
reqUrl: "",
demo: false,
eps: {
enable: true,
api: "",
dist: "./build/cool",
mapping: [

View File

@ -473,24 +473,31 @@ function createService() {
// 创建 eps
export async function createEps(query?: { list: any[] }) {
// 获取数据
await getData(query?.list || []);
if (config.eps.enable) {
// 获取数据
await getData(query?.list || []);
// 创建 service
createService();
// 创建 service
createService();
// 创建目录
createDir(getEpsPath(), true);
// 创建目录
createDir(getEpsPath(), true);
// 创建 json 文件
const isUpdate = createJson();
// 创建 json 文件
const isUpdate = createJson();
// 创建描述文件
createDescribe({ service, list });
// 创建描述文件
createDescribe({ service, list });
return {
service,
list,
isUpdate,
};
return {
service,
list,
isUpdate,
};
} else {
return {
service: {},
list: [],
};
}
}

View File

@ -14,7 +14,10 @@ export function cool(options: Config.Options) {
// Eps
if (options.eps) {
const { dist, mapping, api } = options.eps;
const { dist, mapping, api, enable = true } = options.eps;
// 是否开启
config.eps.enable = enable;
// 类型
if (api) {

View File

@ -62,6 +62,7 @@ export namespace Ctx {
export namespace Config {
type Type = "app" | "admin";
interface Eps {
enable: boolean;
api: "app" | "admin" | (string & {});
dist: string;
mapping: {

View File

@ -1,6 +1,6 @@
<template>
<el-scrollbar class="plugins__wrapper">
<div class="plugins" @dragover="onDragover" @drop="onDrop">
<el-scrollbar class="plugins__wrapper" @dragover="onDragover" @drop="onDrop">
<div class="plugins">
<el-tabs v-model="tab.active" type="card" @tab-change="tab.onChange">
<el-tab-pane label="已安装插件" name="installed"> </el-tab-pane>
<el-tab-pane label="插件市场" name="shop"> </el-tab-pane>
@ -114,7 +114,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
import { Plus, Setting } from "@element-plus/icons-vue";
import { marked } from "marked";
import { useForm } from "@cool-vue/crud";
import { merge, template } from "lodash-es";
import { merge } from "lodash-es";
const { service, refs, setRefs } = useCool();
const Form = useForm();

View File

@ -24,7 +24,10 @@ export default ({ mode }: ConfigEnv): UserConfig => {
// vueDevTools(),
cool({
type: "admin",
proxy
proxy,
eps: {
enable: true
}
}),
visualizer({
open: false,