chore: 清理无用测试文件并更新配置与文档

This commit is contained in:
xiaojunnuo
2026-06-27 00:20:33 +08:00
parent 4dff48e807
commit cfba7b4daa
8 changed files with 36 additions and 189 deletions
@@ -52,7 +52,7 @@ describe("RuntimeDepsService", () => {
} as any;
const plugins: RuntimeDependencyPluginDefine[] = [{ name: "a", dependPackages: { foo: "^1.0.0" } }];
const result = await service.ensureInstalled(plugins);
const result = await service.ensureInstalled({ plugins });
assert.equal(result.registryUrl, "https://registry.npmmirror.com");
assert.ok(fs.existsSync(path.join(rootDir, "package.json")));
@@ -78,7 +78,7 @@ describe("RuntimeDepsService", () => {
},
} as any;
await service.ensureDependencies({ directPkg: "^1.0.0" });
await service.ensureDependencies({ dependencies: { directPkg: "^1.0.0" } });
const manifest = JSON.parse(fs.readFileSync(path.join(rootDir, "package.json"), "utf8"));
assert.deepEqual(manifest.dependencies, { directPkg: "^1.0.0" });
@@ -238,8 +238,8 @@ describe("RuntimeDepsService", () => {
},
} as any;
await service.ensureInstalled([{ name: "a", pluginType: "deploy", dependPackages: { foo: "^1.0.0" } }]);
await service.ensureInstalled([{ name: "b", pluginType: "deploy", dependPackages: { bar: "^2.0.0" } }]);
await service.ensureInstalled({ plugins: [{ name: "a", pluginType: "deploy", dependPackages: { foo: "^1.0.0" } }] });
await service.ensureInstalled({ plugins: [{ name: "b", pluginType: "deploy", dependPackages: { bar: "^2.0.0" } }] });
const manifest = JSON.parse(fs.readFileSync(path.join(rootDir, "package.json"), "utf8"));
assert.deepEqual(manifest.dependencies, {
@@ -399,7 +399,7 @@ describe("RuntimeDepsService", () => {
},
} as any;
await service.ensureInstalled([{ name: "a", dependPackages: { foo: "^1.0.0" } }]);
await service.ensureInstalled({ plugins: [{ name: "a", dependPackages: { foo: "^1.0.0" } }] });
const state = JSON.parse(fs.readFileSync(path.join(rootDir, "install-state.json"), "utf8"));
assert.equal(state.nodeVersion, process.version);
@@ -436,7 +436,7 @@ describe("RuntimeDepsService", () => {
serviceA.commandRunner = commandRunner as any;
serviceB.commandRunner = commandRunner as any;
await Promise.all([serviceA.ensureInstalled([{ name: "a", dependPackages: { foo: "^1.0.0" } }]), serviceB.ensureInstalled([{ name: "a", dependPackages: { foo: "^1.0.0" } }])]);
await Promise.all([serviceA.ensureInstalled({ plugins: [{ name: "a", dependPackages: { foo: "^1.0.0" } }] }), serviceB.ensureInstalled({ plugins: [{ name: "a", dependPackages: { foo: "^1.0.0" } }] })]);
assert.equal(installCount, 1);
});
@@ -468,7 +468,7 @@ describe("RuntimeDepsService", () => {
},
} as any;
await service.ensureInstalled([{ name: "a", dependPackages: { foo: "^1.0.0" } }]);
await service.ensureInstalled({ plugins: [{ name: "a", dependPackages: { foo: "^1.0.0" } }] });
} finally {
if (oldNodeOptions == null) {
delete process.env.NODE_OPTIONS;
@@ -1,9 +1,10 @@
import { HttpClient } from "@certd/basic";
import { AbstractTaskPlugin, CertTargetItem, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
import { CertTargetItem, IsTaskPlugin, PageSearch, pluginGroups, RunStrategy, TaskInput, TaskOutput } from "@certd/pipeline";
import { CertApplyPluginNames, CertInfo } from "@certd/plugin-cert";
import { createCertDomainGetterInputDefine } from "@certd/plugin-lib";
import { BaotaClient } from "../lib/client.js";
import { AbstractPlusTaskPlugin } from "@certd/plugin-plus";
import { BaotaAccess } from "../access.js";
import { BaotaClient } from "../lib/client.js";
/**
* 宝塔-全自动部署插件
@@ -17,8 +18,9 @@ import { BaotaAccess } from "../access.js";
group: pluginGroups.panel.key,
desc: "根据证书域名自动匹配宝塔站点,全自动部署SSL证书。新增加速域名自动感知,自动新增部署",
runStrategy: RunStrategy.AlwaysRun,
needPlus: true,
})
export class BaotaAutoDeploySiteCert extends AbstractTaskPlugin {
export class BaotaAutoDeploySiteCert extends AbstractPlusTaskPlugin {
/** 域名证书 */
@TaskInput({
title: "域名证书",
@@ -37,7 +39,7 @@ export class BaotaAutoDeploySiteCert extends AbstractTaskPlugin {
/** 宝塔授权 */
@TaskInput({
title: "宝塔授权",
helper: "baota的接口密钥",
helper: "将自动查找证书匹配的站点,检查证书即将过期的站点并更新",
component: {
name: "access-selector",
type: "baota",
@@ -55,7 +57,7 @@ export class BaotaAutoDeploySiteCert extends AbstractTaskPlugin {
async onInstance() {}
async execute(): Promise<any> {
this.logger.info("开始宝塔全自动部署证书");
this.logger.info(`开始宝塔全自动部署证书: ${this.certDomains.join(",")}`);
const access = await this.getAccess<BaotaAccess>(this.accessId);
const http: HttpClient = this.ctx.http;
const client = new BaotaClient(access, http);