chore: Switch from TypeScript to build with tsdown, speeds up pnpm build by 5-10x.

This commit is contained in:
cpojer
2026-01-31 15:25:06 +09:00
parent d2a852b982
commit 67945e8d62
25 changed files with 553 additions and 234 deletions

View File

@@ -98,7 +98,7 @@ describe("installPluginFromArchive", () => {
JSON.stringify({
name: "@openclaw/voice-call",
version: "0.0.1",
openclaw: { extensions: ["./dist/index.js"] },
openclaw: { extensions: ["./dist/index.mjs"] },
}),
"utf-8",
);
@@ -112,7 +112,10 @@ describe("installPluginFromArchive", () => {
const extensionsDir = path.join(stateDir, "extensions");
const { installPluginFromArchive } = await import("./install.js");
const result = await installPluginFromArchive({ archivePath, extensionsDir });
const result = await installPluginFromArchive({
archivePath,
extensionsDir,
});
expect(result.ok).toBe(true);
if (!result.ok) return;
expect(result.pluginId).toBe("voice-call");
@@ -131,7 +134,7 @@ describe("installPluginFromArchive", () => {
JSON.stringify({
name: "@openclaw/voice-call",
version: "0.0.1",
openclaw: { extensions: ["./dist/index.js"] },
openclaw: { extensions: ["./dist/index.mjs"] },
}),
"utf-8",
);
@@ -145,8 +148,14 @@ describe("installPluginFromArchive", () => {
const extensionsDir = path.join(stateDir, "extensions");
const { installPluginFromArchive } = await import("./install.js");
const first = await installPluginFromArchive({ archivePath, extensionsDir });
const second = await installPluginFromArchive({ archivePath, extensionsDir });
const first = await installPluginFromArchive({
archivePath,
extensionsDir,
});
const second = await installPluginFromArchive({
archivePath,
extensionsDir,
});
expect(first.ok).toBe(true);
expect(second.ok).toBe(false);
@@ -165,16 +174,19 @@ describe("installPluginFromArchive", () => {
JSON.stringify({
name: "@openclaw/zipper",
version: "0.0.1",
openclaw: { extensions: ["./dist/index.js"] },
openclaw: { extensions: ["./dist/index.mjs"] },
}),
);
zip.file("package/dist/index.js", "export {};");
zip.file("package/dist/index.mjs", "export {};");
const buffer = await zip.generateAsync({ type: "nodebuffer" });
fs.writeFileSync(archivePath, buffer);
const extensionsDir = path.join(stateDir, "extensions");
const { installPluginFromArchive } = await import("./install.js");
const result = await installPluginFromArchive({ archivePath, extensionsDir });
const result = await installPluginFromArchive({
archivePath,
extensionsDir,
});
expect(result.ok).toBe(true);
if (!result.ok) return;
@@ -194,7 +206,7 @@ describe("installPluginFromArchive", () => {
JSON.stringify({
name: "@openclaw/voice-call",
version: "0.0.1",
openclaw: { extensions: ["./dist/index.js"] },
openclaw: { extensions: ["./dist/index.mjs"] },
}),
"utf-8",
);
@@ -212,7 +224,7 @@ describe("installPluginFromArchive", () => {
JSON.stringify({
name: "@openclaw/voice-call",
version: "0.0.2",
openclaw: { extensions: ["./dist/index.js"] },
openclaw: { extensions: ["./dist/index.mjs"] },
}),
"utf-8",
);
@@ -263,7 +275,10 @@ describe("installPluginFromArchive", () => {
const extensionsDir = path.join(stateDir, "extensions");
const { installPluginFromArchive } = await import("./install.js");
const result = await installPluginFromArchive({ archivePath, extensionsDir });
const result = await installPluginFromArchive({
archivePath,
extensionsDir,
});
expect(result.ok).toBe(false);
if (result.ok) return;
expect(result.error).toContain("openclaw.extensions");