feat(FN-3883): fix dependency-graph plugin exports and add CLI bundle entry
Fixed the `@fusion-plugin/dependency-graph` plugin's exports and build entry points so it bundles correctly with the CLI, added test coverage for plugin enable success and error-state toasts, and included the plugin's dist in the CLI bundle via tsup config. Fusion-Task-Id: FN-3883
This commit is contained in:
@@ -2,7 +2,6 @@ import { mkdtempSync } from "node:fs";
|
||||
import { rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { PluginLoader, PluginStore } from "@fusion/core";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import plugin from "../index";
|
||||
@@ -25,10 +24,15 @@ describe("dependency graph plugin index", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("loads src/index.ts via Node dynamic import", async () => {
|
||||
const moduleUrl = pathToFileURL(join(process.cwd(), "src/index.ts")).href;
|
||||
const module = await import(moduleUrl);
|
||||
expect(module.default?.manifest?.id).toBe("fusion-plugin-dependency-graph");
|
||||
it("is loadable through package exports", async () => {
|
||||
const entryModule = await import("@fusion-plugin-examples/dependency-graph");
|
||||
expect(entryModule.default?.manifest?.id).toBe("fusion-plugin-dependency-graph");
|
||||
expect(entryModule.default?.dashboardViews?.[0]).toEqual(
|
||||
expect.objectContaining({ componentPath: "./dashboard-view" }),
|
||||
);
|
||||
|
||||
const viewModule = await import("@fusion-plugin-examples/dependency-graph/dashboard-view");
|
||||
expect(typeof viewModule.default).toBe("function");
|
||||
});
|
||||
|
||||
it("is loadable by PluginLoader without throwing", async () => {
|
||||
@@ -38,7 +42,7 @@ describe("dependency graph plugin index", () => {
|
||||
const pluginStore = new PluginStore(rootDir, { inMemoryDb: true, centralGlobalDir: rootDir });
|
||||
await pluginStore.init();
|
||||
|
||||
const pluginPath = join(process.cwd(), "src/index.ts");
|
||||
const pluginPath = join(process.cwd(), "dist/index.js");
|
||||
await pluginStore.registerPlugin({ manifest: plugin.manifest, path: pluginPath });
|
||||
|
||||
const loader = new PluginLoader({
|
||||
|
||||
@@ -4,6 +4,17 @@ declare module "@fusion/dashboard/app/utils/taskStuck" {
|
||||
export function isTaskStuck(task: Task, taskStuckTimeoutMs?: number, lastFetchTimeMs?: number): boolean;
|
||||
}
|
||||
|
||||
declare module "@fusion/dashboard/app/plugins/types" {
|
||||
import type { Task, TaskDetail, WorkflowStep } from "@fusion/core";
|
||||
|
||||
export interface PluginDashboardViewContext {
|
||||
tasks: Task[];
|
||||
projectId?: string;
|
||||
workflowSteps?: WorkflowStep[];
|
||||
openTaskDetail?: (task: Task | TaskDetail) => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "@fusion/dashboard/app/components/TaskCard" {
|
||||
import type { Column, Task, TaskDetail } from "@fusion/core";
|
||||
import type { ReactElement } from "react";
|
||||
|
||||
@@ -16,4 +16,6 @@ export function DependencyGraphDashboardView({ context }: { context?: PluginDash
|
||||
});
|
||||
}
|
||||
|
||||
export default DependencyGraphDashboardView;
|
||||
|
||||
export { DependencyGraph };
|
||||
|
||||
Reference in New Issue
Block a user