Export template source from 3ac0870810e7bf32e6f262f4b81f11ce7470e784:quixos-instance/packages/project-react-runtime
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { derived, type RuntimeContext } from "@quixos/camino-package-runtime";
|
||||
|
||||
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const componentSourcePath = path.join(dirname, "project-component.mjs");
|
||||
|
||||
export const source = async () => await fs.readFile(componentSourcePath, "utf8");
|
||||
|
||||
export const createComponent = (context: RuntimeContext) => context.objectId;
|
||||
|
||||
export const props = derived(async (context: RuntimeContext) => {
|
||||
const named = context.interface("port:project-react:named");
|
||||
const tasks = context.interface("port:project-react:tasks");
|
||||
return {
|
||||
project_id: named.objectId,
|
||||
component_id: context.objectId,
|
||||
name: await named.live("operation:named:name:get"),
|
||||
tasks: await tasks.invoke("operation:project-tasks:tasks:resolve"),
|
||||
};
|
||||
});
|
||||
|
||||
export const stopWatch = () => null;
|
||||
Reference in New Issue
Block a user