Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions packages/database/scripts/createEnv.mts
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,22 @@ const makeBranchEnv = async (vercel: Vercel, vercelToken: string) => {
};

const makeProductionEnv = async (vercel: Vercel, vercelToken: string) => {
const result = await vercel.deployments.getDeployments({
const result = await vercel.projects.getProjectDomains({
...baseParams,
projectId: projectIdOrName,
limit: 1,
target: "production",
state: "READY",
idOrName: projectIdOrName,
production: "true",
});
if (result.deployments.length == 0) {
throw new Error("No production deployment found");
const domains = result.domains.filter(
(d) => !d.redirect && d.apexName.indexOf("vercel") < 0,
);
if (domains.length === 0) {
throw new Error("No production domains found");
}
if (domains.length > 1) {
console.log(domains);
throw new Error("Too many production domains found");
}
const url = result.deployments[0]!.url;
const url = domains[0]!.name;
execSync(
`vercel -t ${vercelToken} env pull --environment production .env.production`,
);
Expand Down