forked from rocicorp/replicache-yjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continuous deployment.
- Loading branch information
Showing
12 changed files
with
82 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
publish-reflect.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ dist | |
next-env.d.ts | ||
.reflect/ | ||
**/*.tgz | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const { spawn } = require("child_process"); | ||
const fs = require("fs"); | ||
|
||
const appBaseName = "reflect-type"; | ||
const refName = getEnv( | ||
process.env.VERCEL_GIT_COMMIT_REF, | ||
"VERCEL_GIT_COMMIT_REF" | ||
); | ||
|
||
const appName = `${appBaseName}-${refName}` | ||
.toLowerCase() | ||
.replace(/^[^a-z]/, "") | ||
.replace(/[^a-z0-9-]/g, "-"); | ||
|
||
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 url = lines[success + 1]; | ||
|
||
fs.writeFileSync("./.env", `NEXT_PUBLIC_REFLECT_SERVER=${url}`); | ||
} | ||
|
||
function runCommand(command, args) { | ||
console.log("running command: " + command + " " + args.join(" ")); | ||
return new Promise((resolve, reject) => { | ||
const child = spawn(command, args); | ||
|
||
let output = ""; | ||
child.stdout.on("data", (data) => { | ||
output += data; | ||
process.stdout.write(data); | ||
}); | ||
|
||
child.stderr.on("data", (data) => { | ||
process.stderr.write(data); | ||
}); | ||
|
||
child.on("close", (code) => { | ||
if (code !== 0) { | ||
reject(new Error(`Command failed with exit code ${code}`)); | ||
} else { | ||
resolve(output); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
function getEnv(v, name) { | ||
if (!v) { | ||
throw new Error("Missing required env var: " + name); | ||
} | ||
return v; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"buildCommand": "turbo run build --force && node publish-reflect.js", | ||
"installCommand": "npm install" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters