From ad5e2d43c46fa4893eae9a0b0b6866241af2334f Mon Sep 17 00:00:00 2001 From: Aaron Boodman Date: Thu, 22 Feb 2024 17:05:18 -1000 Subject: [PATCH] moa --- examples/tiptap/publish-reflect.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/examples/tiptap/publish-reflect.js b/examples/tiptap/publish-reflect.js index c46b632..d04caf6 100644 --- a/examples/tiptap/publish-reflect.js +++ b/examples/tiptap/publish-reflect.js @@ -16,21 +16,20 @@ const appName = `${appBaseName}-${refName}` publish(); async function publish() { - const output = await runCommand("npx", [ - "reflect", - "publish", - "--server-path=./src/reflect/index.ts", - "--reflect-channel=canary", - `--app=${appName}`, - "--auth-key-from-env=REFLECT_AUTH_KEY", - ]); - const lines = output.toString().split("\n"); - const success = lines.findIndex((line) => - line.includes("🎁 Published successfully to:") + const output = JSON.parse( + await runCommand("npx", [ + "reflect", + "publish", + "--server-path=./src/reflect/index.ts", + "--reflect-channel=canary", + `--app=${appName}`, + "--auth-key-from-env=REFLECT_AUTH_KEY", + "--output=json", + ]) ); - const url = lines[success + 1]; - - fs.writeFileSync("./.env", `NEXT_PUBLIC_REFLECT_URL=${url}`); + if (output.success) { + fs.writeFileSync("./.env", `NEXT_PUBLIC_REFLECT_URL=${output.url}`); + } console.log("wrote env file at: ", path.resolve("./.env")); console.log(fs.readFileSync("./.env").toString());