create-whop-kit 1.0.0 → 1.0.2

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.
@@ -56,7 +56,6 @@ function getVercelUser() {
56
56
  }
57
57
  async function vercelLogin() {
58
58
  p.log.info("You'll be redirected to Vercel to sign in (or create an account).");
59
- p.log.info(pc.dim("This is needed to deploy your app."));
60
59
  console.log("");
61
60
  const ok = execInteractive("vercel login");
62
61
  console.log("");
@@ -70,52 +69,57 @@ async function vercelLink(projectDir) {
70
69
  return ok;
71
70
  }
72
71
  async function vercelDeploy(projectDir) {
73
- const s = p.spinner();
74
- s.start("Vercel: deploying to production (this may take a few minutes)...");
75
- const result = exec("vercel deploy --prod --yes", projectDir, 3e5);
76
- if (!result.success) {
77
- s.stop("Vercel deployment failed");
78
- const errorOutput = result.stderr || result.stdout;
79
- if (errorOutput) {
80
- const trimmed = errorOutput.length > 600 ? "..." + errorOutput.slice(-600) : errorOutput;
81
- p.log.error(pc.dim(trimmed));
82
- }
72
+ p.log.step("Vercel: deploying to production...");
73
+ console.log("");
74
+ const ok = execInteractive("vercel deploy --prod --yes", projectDir);
75
+ console.log("");
76
+ if (!ok) {
77
+ p.log.error("Vercel deployment failed. Check the build output above.");
83
78
  return null;
84
79
  }
85
- const lines = result.stdout.split("\n");
86
- let url = "";
87
- for (const line of lines) {
88
- if (line.includes("Aliased:") || line.includes("Production:")) {
89
- const match = line.match(/https:\/\/[^\s\[\]]+/);
90
- if (match) {
91
- url = match[0];
92
- if (line.includes("Aliased:")) break;
80
+ const s = p.spinner();
81
+ s.start("Getting deployment URL...");
82
+ const ls = exec("vercel ls --json", projectDir, 15e3);
83
+ if (ls.success) {
84
+ try {
85
+ const data = JSON.parse(ls.stdout);
86
+ const prod = Array.isArray(data) ? data.find((d) => d.target === "production") : null;
87
+ if (prod?.url) {
88
+ const url = `https://${prod.url}`;
89
+ s.stop(`Deployed to ${pc.cyan(url)}`);
90
+ return url;
93
91
  }
92
+ } catch {
94
93
  }
95
94
  }
96
- if (!url) {
97
- const urls = [];
98
- for (const line of lines) {
99
- const match = line.match(/https:\/\/[^\s\[\]]+\.vercel\.app/);
100
- if (match) urls.push(match[0]);
101
- }
102
- if (urls.length > 0) {
103
- urls.sort((a, b) => a.length - b.length);
104
- url = urls[0];
95
+ const inspect = exec("vercel inspect --json", projectDir, 15e3);
96
+ if (inspect.success) {
97
+ const urlMatch = inspect.stdout.match(/https:\/\/[^\s"]+\.vercel\.app/);
98
+ if (urlMatch) {
99
+ s.stop(`Deployed to ${pc.cyan(urlMatch[0])}`);
100
+ return urlMatch[0];
105
101
  }
106
102
  }
107
- if (url) {
108
- s.stop(`Deployed to ${pc.cyan(url)}`);
109
- return url;
110
- }
111
- for (const line of lines) {
112
- const match = line.match(/https:\/\/[^\s\[\]]+/);
113
- if (match && !match[0].includes("github.com") && !match[0].includes("vercel.com/")) {
114
- s.stop(`Deployed to ${pc.cyan(match[0])}`);
115
- return match[0];
103
+ try {
104
+ const { readFileSync } = await import("fs");
105
+ const { join } = await import("path");
106
+ const projectJson = JSON.parse(
107
+ readFileSync(join(projectDir, ".vercel", "project.json"), "utf-8")
108
+ );
109
+ if (projectJson.projectId) {
110
+ const proj = exec(`vercel project inspect ${projectJson.projectId} --json`, projectDir, 15e3);
111
+ if (proj.success) {
112
+ const urlMatch = proj.stdout.match(/https:\/\/[^\s"]+\.vercel\.app/);
113
+ if (urlMatch) {
114
+ s.stop(`Deployed to ${pc.cyan(urlMatch[0])}`);
115
+ return urlMatch[0];
116
+ }
117
+ }
116
118
  }
119
+ } catch {
117
120
  }
118
- s.stop("Deployed but could not extract URL");
121
+ s.stop("Deployed (extracting URL...)");
122
+ p.log.info("The deployment URL was shown in the build output above.");
119
123
  const manual = await p.text({
120
124
  message: "Paste your Vercel production URL",
121
125
  placeholder: "https://your-app.vercel.app",
@@ -188,19 +192,21 @@ async function createGitHubRepo(projectDir, projectName) {
188
192
  }
189
193
  s = p2.spinner();
190
194
  s.start("Pushing code to GitHub...");
195
+ const branchResult = exec("git branch --show-current", projectDir);
196
+ const branch = branchResult.success ? branchResult.stdout.trim() : "main";
191
197
  let pushOk = false;
192
- for (const delay of [0, 5e3, 1e4]) {
198
+ for (const delay of [0, 3e3, 7e3]) {
193
199
  if (delay > 0) {
194
- s.stop(`Waiting for GitHub to propagate (${delay / 1e3}s)...`);
200
+ s.stop(`Waiting for GitHub to propagate...`);
195
201
  await new Promise((r) => setTimeout(r, delay));
196
202
  s = p2.spinner();
197
203
  s.start("Pushing code to GitHub...");
198
204
  }
199
- pushOk = exec("git push -u origin main", projectDir, 3e4).success;
205
+ pushOk = exec(`git push -u origin ${branch}`, projectDir, 3e4).success;
200
206
  if (pushOk) break;
201
207
  }
202
208
  if (!pushOk) {
203
- s.stop("Could not push (push manually with: git push -u origin main)");
209
+ s.stop(`Could not push (try manually: git push -u origin ${branch})`);
204
210
  } else {
205
211
  s.stop("Code pushed to GitHub");
206
212
  }
@@ -346,6 +346,7 @@ function updatePackageName(projectDir, name) {
346
346
  }
347
347
  function initGit(projectDir) {
348
348
  exec("git init", projectDir);
349
+ exec("git branch -m main", projectDir);
349
350
  exec("git add -A", projectDir);
350
351
  exec('git commit -m "initial: scaffolded with create-whop-kit"', projectDir);
351
352
  }
@@ -683,7 +684,7 @@ var init_default = defineCommand({
683
684
  });
684
685
  if (!isCancelled(deployChoice) && deployChoice === "deploy") {
685
686
  deployAttempted = true;
686
- const { runDeployPipeline } = await import("./deploy-IDZMWMUP.js");
687
+ const { runDeployPipeline } = await import("./deploy-SGJRYA53.js");
687
688
  deployResult = await runDeployPipeline({
688
689
  projectDir,
689
690
  projectName,
package/dist/cli-kit.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-HOQ5QQ2M.js";
10
10
  import {
11
11
  runDeployPipeline
12
- } from "./chunk-OC5BYIPC.js";
12
+ } from "./chunk-DI33L34J.js";
13
13
  import {
14
14
  detectPackageManager,
15
15
  exec
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runDeployPipeline
4
- } from "./chunk-OC5BYIPC.js";
4
+ } from "./chunk-DI33L34J.js";
5
5
  import "./chunk-42L7PRMT.js";
6
6
  export {
7
7
  runDeployPipeline
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-whop-kit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Scaffold and manage Whop-powered apps with whop-kit",
5
5
  "type": "module",
6
6
  "license": "MIT",