inflight-cli 2.1.2 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import * as p from "@clack/prompts";
2
2
  import pc from "picocolors";
3
+ import { execSync } from "child_process";
3
4
  import { parseGitRepo, getGitRoot } from "../lib/git.js";
4
5
  import { writeVercelConfig } from "../lib/config.js";
5
6
  import { ensureVercelCli, ensureVercelAuth, readLocalVercelProject, writeLocalVercelProject, getVercelProjectDetail, fetchAllProjectsWithLinks, matchProjectsByRepo, createVercelProject, getBranchAlias, getRecentDeployments, } from "../lib/vercel.js";
@@ -120,6 +121,27 @@ async function createProjectFlow(projects, ctx) {
120
121
  try {
121
122
  const created = await createVercelProject(token, teamId, gitRepo.name, `${gitRepo.owner}/${gitRepo.name}`, gitRepo.provider);
122
123
  spinner.stop(`Created ${pc.bold(created.name)}`);
124
+ // Trigger first deployment by pushing an empty commit
125
+ try {
126
+ execSync('git commit --allow-empty -m "Trigger Vercel deployment"', { cwd: process.cwd(), stdio: "pipe" });
127
+ execSync("git push", { cwd: process.cwd(), stdio: "pipe" });
128
+ }
129
+ catch {
130
+ p.log.info("Push to git to trigger your first deployment.");
131
+ return { teamId, projectId: created.id, projectName: created.name };
132
+ }
133
+ // Poll until a deployment appears
134
+ const pollSpinner = p.spinner();
135
+ pollSpinner.start("Waiting for deployment...");
136
+ for (let i = 0; i < 30; i++) {
137
+ await new Promise((r) => setTimeout(r, 2000));
138
+ const deps = await getRecentDeployments(token, teamId, created.id);
139
+ if (deps.length > 0) {
140
+ pollSpinner.stop("Deployment started.");
141
+ return { teamId, projectId: created.id, projectName: created.name };
142
+ }
143
+ }
144
+ pollSpinner.stop("Deployment may take a moment to appear.");
123
145
  return { teamId, projectId: created.id, projectName: created.name };
124
146
  }
125
147
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inflight-cli",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Get feedback directly on your staging URL",
5
5
  "bin": {
6
6
  "inflight": "dist/index.js",