mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
22 lines
625 B
TypeScript
22 lines
625 B
TypeScript
import { useMutation } from "@tanstack/react-query";
|
|
import { buildProject } from "@/lib/build";
|
|
import { useFS } from "./useFS";
|
|
import { useFSPaths } from "./useFSPaths";
|
|
import { useAppContext } from "./useAppContext";
|
|
|
|
export function useBuildProject(projectId: string) {
|
|
const { fs } = useFS();
|
|
const { projectsPath } = useFSPaths();
|
|
const { config } = useAppContext();
|
|
|
|
return useMutation({
|
|
mutationFn: async () => {
|
|
return await buildProject({
|
|
fs,
|
|
projectPath: `${projectsPath}/${projectId}`,
|
|
domParser: new DOMParser(),
|
|
esmUrl: config.esmUrl,
|
|
});
|
|
},
|
|
});
|
|
} |