From c07383a1f7e8518dec7899a004a8fbe2c25c698a Mon Sep 17 00:00:00 2001 From: Bernhard Seefeld Date: Wed, 5 Mar 2025 16:27:42 -0800 Subject: [PATCH] moved recipe saving to runner (so storage and this are together) --- typescript/packages/common-charm/src/charm.ts | 4 ++-- typescript/packages/common-charm/src/index.ts | 3 +-- typescript/packages/common-cli/google-importer.ts | 10 ++++++++-- typescript/packages/common-cli/main.ts | 9 +++++---- typescript/packages/common-runner/src/index.ts | 1 + .../syncRecipe.ts => common-runner/src/recipe-sync.ts} | 4 ++-- 6 files changed, 19 insertions(+), 12 deletions(-) rename typescript/packages/{common-charm/src/syncRecipe.ts => common-runner/src/recipe-sync.ts} (95%) diff --git a/typescript/packages/common-charm/src/charm.ts b/typescript/packages/common-charm/src/charm.ts index 93012d006..a31178e01 100644 --- a/typescript/packages/common-charm/src/charm.ts +++ b/typescript/packages/common-charm/src/charm.ts @@ -18,9 +18,9 @@ import { idle, isCell, run, + syncRecipeBlobby, } from "@commontools/runner"; -import { syncRecipeBlobby } from "./syncRecipe.ts"; -import { storage, getSpace, Space } from "@commontools/runner"; +import { getSpace, Space, storage } from "@commontools/runner"; import { DID, Identity, Signer } from "@commontools/identity"; export type Charm = { diff --git a/typescript/packages/common-charm/src/index.ts b/typescript/packages/common-charm/src/index.ts index 7369516a9..60f61a746 100644 --- a/typescript/packages/common-charm/src/index.ts +++ b/typescript/packages/common-charm/src/index.ts @@ -1,12 +1,11 @@ export { type Charm, CharmManager } from "./charm.ts"; -export { saveRecipe, setBobbyServerUrl } from "./syncRecipe.ts"; export { buildRecipe, tsToExports } from "./localBuild.ts"; export { castNewRecipe, compileAndRunRecipe, compileRecipe, - iterate, extend, + iterate, saveNewRecipeVersion, } from "./iterate.ts"; export { getIframeRecipe, type IFrameRecipe } from "./iframe/recipe.ts"; diff --git a/typescript/packages/common-cli/google-importer.ts b/typescript/packages/common-cli/google-importer.ts index f7ca810e2..eafd55acf 100644 --- a/typescript/packages/common-cli/google-importer.ts +++ b/typescript/packages/common-cli/google-importer.ts @@ -1,7 +1,13 @@ // Load .env file import { parseArgs } from "@std/cli/parse-args"; -import { CharmManager, setBobbyServerUrl, storage } from "@commontools/charm"; -import { Cell, getEntityId, isStream } from "@commontools/runner"; +import { CharmManager } from "@commontools/charm"; +import { + Cell, + getEntityId, + isStream, + setBobbyServerUrl, + storage, +} from "@commontools/runner"; import { Charm } from "@commontools/charm"; /** diff --git a/typescript/packages/common-cli/main.ts b/typescript/packages/common-cli/main.ts index 8fb8a3a44..ed9842d52 100644 --- a/typescript/packages/common-cli/main.ts +++ b/typescript/packages/common-cli/main.ts @@ -1,11 +1,12 @@ // Load .env file import { parseArgs } from "@std/cli/parse-args"; +import { CharmManager, compileRecipe } from "@commontools/charm"; import { - CharmManager, - compileRecipe, + getEntityId, + isStream, setBobbyServerUrl, -} from "@commontools/charm"; -import { storage, getEntityId, isStream } from "@commontools/runner"; + storage, +} from "@commontools/runner"; import { Identity } from "@commontools/identity"; const { space, charmId, recipeFile, cause, quit } = parseArgs(Deno.args, { diff --git a/typescript/packages/common-runner/src/index.ts b/typescript/packages/common-runner/src/index.ts index e1c5c5dec..33d896d27 100644 --- a/typescript/packages/common-runner/src/index.ts +++ b/typescript/packages/common-runner/src/index.ts @@ -44,3 +44,4 @@ export { export { type AddCancel, type Cancel, noOp, useCancelGroup } from "./cancel.ts"; export { getSpace, type Space } from "./space.ts"; export { storage } from "./storage.ts"; +export { setBobbyServerUrl, syncRecipeBlobby } from "./recipe-sync.ts"; diff --git a/typescript/packages/common-charm/src/syncRecipe.ts b/typescript/packages/common-runner/src/recipe-sync.ts similarity index 95% rename from typescript/packages/common-charm/src/syncRecipe.ts rename to typescript/packages/common-runner/src/recipe-sync.ts index 7570c9861..2fde0aa5a 100644 --- a/typescript/packages/common-charm/src/syncRecipe.ts +++ b/typescript/packages/common-runner/src/recipe-sync.ts @@ -6,7 +6,7 @@ import { getRecipeSpec, getRecipeSrc, } from "@commontools/runner"; -import { buildRecipe } from "./localBuild.ts"; +import { buildRecipe } from "../../common-charm/src/localBuild.ts"; let BLOBBY_SERVER_URL = "/api/storage/blobby"; @@ -52,7 +52,7 @@ export async function syncRecipeBlobby(id: string) { recipesKnownToStorage.add(recipeId); } -export async function saveRecipe( +async function saveRecipe( id: string, src: string, spec?: string,