Skip to content

Commit

Permalink
moa
Browse files Browse the repository at this point in the history
  • Loading branch information
aboodman committed Feb 23, 2024
1 parent e61dd19 commit ad5e2d4
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions examples/tiptap/publish-reflect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit ad5e2d4

Please sign in to comment.