mirror of
https://github.com/certd/certd.git
synced 2026-08-03 12:05:06 +08:00
chore: 增加清理依赖缓存提示
This commit is contained in:
@@ -52,7 +52,7 @@ export abstract class BaseAccess implements IAccess {
|
|||||||
|
|
||||||
async importRuntime(specifier: string) {
|
async importRuntime(specifier: string) {
|
||||||
if (!this.runtimeDepsService) {
|
if (!this.runtimeDepsService) {
|
||||||
return await import(specifier);
|
throw new Error("runtimeDepsService 未初始化");
|
||||||
}
|
}
|
||||||
return await this.runtimeDepsService.importRuntime(specifier, this.ctx.logger);
|
return await this.runtimeDepsService.importRuntime(specifier, this.ctx.logger);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,11 +150,11 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
|
|||||||
logger!: ILogger;
|
logger!: ILogger;
|
||||||
http!: HttpClient;
|
http!: HttpClient;
|
||||||
accessService!: IAccessService;
|
accessService!: IAccessService;
|
||||||
runtimeDepsService?: IRuntimeDepsService;
|
runtimeDepsService!: IRuntimeDepsService;
|
||||||
|
|
||||||
async importRuntime(specifier: string) {
|
async importRuntime(specifier: string) {
|
||||||
if (!this.runtimeDepsService) {
|
if (!this.runtimeDepsService) {
|
||||||
return await import(specifier);
|
throw new Error("runtimeDepsService 未初始化");
|
||||||
}
|
}
|
||||||
return await this.runtimeDepsService.importRuntime(specifier, this.logger);
|
return await this.runtimeDepsService.importRuntime(specifier, this.logger);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export abstract class AbstractDnsProvider<T = any> implements IDnsProvider<T> {
|
|||||||
|
|
||||||
async importRuntime(specifier: string) {
|
async importRuntime(specifier: string) {
|
||||||
if (!this.runtimeDepsService) {
|
if (!this.runtimeDepsService) {
|
||||||
return await import(specifier);
|
throw new Error("runtimeDepsService 未初始化");
|
||||||
}
|
}
|
||||||
return await this.runtimeDepsService.importRuntime(specifier, this.logger);
|
return await this.runtimeDepsService.importRuntime(specifier, this.logger);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export default {
|
|||||||
pluginBetaWarning: "Custom plugins are in BETA and may have breaking changes in future",
|
pluginBetaWarning: "Custom plugins are in BETA and may have breaking changes in future",
|
||||||
pleaseSelectRecord: "Please select records first",
|
pleaseSelectRecord: "Please select records first",
|
||||||
clearRuntimeDeps: "Clear Runtime Deps Cache",
|
clearRuntimeDeps: "Clear Runtime Deps Cache",
|
||||||
clearRuntimeDepsConfirm: "Are you sure to clear the runtime dependencies cache? Required dependencies will be reinstalled on the next pipeline execution.",
|
clearRuntimeDepsTooltip: "Restart the certd container after clearing, otherwise cached modules will not be reloaded",
|
||||||
clearRuntimeDepsSuccess: "Runtime dependencies cache cleared successfully",
|
clearRuntimeDepsConfirm: "Are you sure to clear the runtime dependencies cache? Please restart the certd container afterwards to ensure dependencies are reloaded.",
|
||||||
|
clearRuntimeDepsSuccess: "Runtime dependencies cache cleared successfully, please restart the certd container",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export default {
|
|||||||
pluginBetaWarning: "自定义插件处于BETA测试版,后续可能会有破坏性变更",
|
pluginBetaWarning: "自定义插件处于BETA测试版,后续可能会有破坏性变更",
|
||||||
pleaseSelectRecord: "请先勾选记录",
|
pleaseSelectRecord: "请先勾选记录",
|
||||||
clearRuntimeDeps: "清理第三方依赖缓存",
|
clearRuntimeDeps: "清理第三方依赖缓存",
|
||||||
clearRuntimeDepsConfirm: "确定要清理第三方依赖缓存吗?清理后下次执行流水线时将重新安装所需依赖。",
|
clearRuntimeDepsTooltip: "清除后需重启 certd 容器,否则已缓存模块不会重新读取",
|
||||||
clearRuntimeDepsSuccess: "第三方依赖缓存清理成功",
|
clearRuntimeDepsConfirm: "确定要清理第三方依赖缓存吗?清理后请重启 certd 容器以确保重新加载依赖。",
|
||||||
|
clearRuntimeDepsSuccess: "第三方依赖缓存清理成功,请重启 certd 容器",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||||||
show: true,
|
show: true,
|
||||||
icon: "ion:trash-outline",
|
icon: "ion:trash-outline",
|
||||||
text: t("certd.clearRuntimeDeps"),
|
text: t("certd.clearRuntimeDeps"),
|
||||||
|
tooltip: { title: t("certd.clearRuntimeDepsTooltip") },
|
||||||
type: "primary",
|
type: "primary",
|
||||||
danger: true,
|
danger: true,
|
||||||
async click() {
|
async click() {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
"tsc": "tsc --skipLibCheck",
|
"tsc": "tsc --skipLibCheck",
|
||||||
"slimming": "node ./slimming.js",
|
"slimming": "node ./slimming.js",
|
||||||
"pub": "echo 1",
|
"pub": "echo 1",
|
||||||
"compile": "tsc --skipLibCheck --watch",
|
"compile": "",
|
||||||
"lint1": "eslint --fix"
|
"lint1": "eslint --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -441,16 +441,20 @@ export class RuntimeDepsService {
|
|||||||
|
|
||||||
private getDefineByPluginKey(pluginKey: string, owner?: RuntimeDependencyPluginDefine): RuntimeDependencyPluginDefine {
|
private getDefineByPluginKey(pluginKey: string, owner?: RuntimeDependencyPluginDefine): RuntimeDependencyPluginDefine {
|
||||||
const parts = pluginKey.split(":");
|
const parts = pluginKey.split(":");
|
||||||
const [pluginType, subtype, name] = parts;
|
let [pluginType, subtype, name] = parts;
|
||||||
if (parts.length < 2 || (pluginType === "addon" && parts.length !== 3) || (pluginType !== "addon" && parts.length !== 2)) {
|
if (parts.length === 2) {
|
||||||
|
name = subtype;
|
||||||
|
}else if (parts.length === 3) {
|
||||||
|
//无修改
|
||||||
|
} else {
|
||||||
const ownerName = owner?.name || pluginKey;
|
const ownerName = owner?.name || pluginKey;
|
||||||
throw new Error(`插件依赖格式错误: ${ownerName} 依赖 ${pluginKey},请使用 plugin:name、access:name、notification:name、dnsProvider:name 或 addon:subtype:name 格式`);
|
throw new Error(`插件依赖格式错误: ${ownerName} 依赖 ${pluginKey},请使用 plugin:name、access:name、notification:name、dnsProvider:name 或 addon:subtype:name 格式`);
|
||||||
}
|
}
|
||||||
const registryMap: Record<string, { registry: Registry<any>; key: string; pluginType: string; addonType?: string }> = {
|
const registryMap: Record<string, { registry: Registry<any>; key: string; pluginType: string; addonType?: string }> = {
|
||||||
plugin: { registry: pluginRegistry, key: subtype, pluginType: "plugin" },
|
plugin: { registry: pluginRegistry, key: name, pluginType: "plugin" },
|
||||||
access: { registry: accessRegistry, key: subtype, pluginType: "access" },
|
access: { registry: accessRegistry, key: name, pluginType: "access" },
|
||||||
notification: { registry: notificationRegistry, key: subtype, pluginType: "notification" },
|
notification: { registry: notificationRegistry, key: name, pluginType: "notification" },
|
||||||
dnsProvider: { registry: dnsProviderRegistry, key: subtype, pluginType: "dnsProvider" },
|
dnsProvider: { registry: dnsProviderRegistry, key: name, pluginType: "dnsProvider" },
|
||||||
addon: { registry: addonRegistry, key: `${subtype}:${name}`, pluginType: "addon", addonType: subtype },
|
addon: { registry: addonRegistry, key: `${subtype}:${name}`, pluginType: "addon", addonType: subtype },
|
||||||
};
|
};
|
||||||
const target = registryMap[pluginType];
|
const target = registryMap[pluginType];
|
||||||
|
|||||||
Reference in New Issue
Block a user