Add local-first execution authoring support
This commit is contained in:
@@ -11,6 +11,7 @@ import { parseQx, walkSyntax } from "./source.js";
|
||||
import type { StructuralRequest } from "./structural-plan.js";
|
||||
import { addImplementation } from "./implementation-edit.js";
|
||||
import { reactPlatformTypes } from "../bindings/react-platform.js";
|
||||
import { executionScaffold, isExecutionScaffold } from "./execution-scaffold.js";
|
||||
|
||||
type Source = { repository: string; commit: string };
|
||||
type PackageEditModel = {
|
||||
@@ -21,7 +22,7 @@ type PackageEditModel = {
|
||||
exports: { name: string; id: string; file: string; migration?: boolean }[];
|
||||
};
|
||||
export type ScaffoldRecipe = {
|
||||
template?: "typescript" | "typescript-react";
|
||||
template?: "typescript" | "typescript-react" | "typescript-execution";
|
||||
source: Source;
|
||||
directory?: string;
|
||||
name?: string;
|
||||
@@ -81,6 +82,13 @@ export const scaffoldRecipe = async (
|
||||
if (spec.directory && !/^[A-Za-z0-9_-][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_-][A-Za-z0-9_.-]*)*$/.test(spec.directory))
|
||||
throw new Error("Scaffold directory must be contained");
|
||||
const prefix = spec.directory ? `${spec.directory}/` : "";
|
||||
if (
|
||||
spec.template === "typescript-execution" ||
|
||||
(command !== "package" && (await isExecutionScaffold(root, prefix)))
|
||||
) {
|
||||
if (spec.tools) Object.values(spec.tools).forEach(source);
|
||||
return executionScaffold(root, command, spec, prefix, nixSource);
|
||||
}
|
||||
const files: StructuralRequest["files"] = [];
|
||||
const create = (file: string, content: string) => files.push({ file: prefix + file, create: content });
|
||||
const generated = (file: string, content: string) => files.push({ file: prefix + file, generated: content });
|
||||
|
||||
Reference in New Issue
Block a user