create-whop-kit 0.9.1 → 0.9.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.
@@ -167,33 +167,45 @@ async function ghLogin() {
167
167
  return ok;
168
168
  }
169
169
  async function createGitHubRepo(projectDir, projectName) {
170
- const s = p2.spinner();
170
+ let s = p2.spinner();
171
171
  s.start("Creating private GitHub repository...");
172
- const result = exec(
173
- `gh repo create ${projectName} --private --source=. --push`,
172
+ const createResult = exec(
173
+ `gh repo create ${projectName} --private --source=.`,
174
174
  projectDir,
175
175
  6e4
176
176
  );
177
- if (!result.success) {
178
- s.stop("Could not create repo");
179
- const stderr = result.stderr || result.stdout;
177
+ if (!createResult.success) {
178
+ const stderr = createResult.stderr || createResult.stdout;
180
179
  if (stderr.includes("already exists")) {
181
- p2.log.warning(`Repository "${projectName}" already exists on GitHub.`);
180
+ s.stop(`Repository "${projectName}" already exists`);
182
181
  exec(`git remote add origin https://github.com/$(gh api user --jq .login)/${projectName}.git`, projectDir);
183
- const pushResult = exec("git push -u origin main", projectDir, 3e4);
184
- if (pushResult.success) {
185
- const remote = exec("gh repo view --json url --jq .url", projectDir);
186
- return remote.success ? remote.stdout.trim() : null;
187
- }
182
+ } else {
183
+ s.stop("Could not create GitHub repo");
184
+ if (stderr) p2.log.error(pc2.dim(stderr.substring(0, 200)));
185
+ return null;
188
186
  }
189
- return null;
187
+ } else {
188
+ s.stop("GitHub repo created");
189
+ }
190
+ s = p2.spinner();
191
+ s.start("Pushing code to GitHub...");
192
+ let pushOk = exec("git push -u origin main", projectDir, 3e4).success;
193
+ if (!pushOk) {
194
+ s.stop("Push failed, retrying...");
195
+ await new Promise((r) => setTimeout(r, 3e3));
196
+ s = p2.spinner();
197
+ s.start("Retrying push...");
198
+ pushOk = exec("git push -u origin main", projectDir, 3e4).success;
199
+ }
200
+ if (!pushOk) {
201
+ s.stop("Could not push (push manually with: git push -u origin main)");
202
+ } else {
203
+ s.stop("Code pushed to GitHub");
190
204
  }
191
205
  const repoUrl = exec("gh repo view --json url --jq .url", projectDir);
192
- if (repoUrl.success) {
193
- s.stop(`GitHub repo created: ${pc2.cyan(repoUrl.stdout.trim())}`);
206
+ if (repoUrl.success && repoUrl.stdout.trim()) {
194
207
  return repoUrl.stdout.trim();
195
208
  }
196
- s.stop("GitHub repo created");
197
209
  return `https://github.com/${projectName}`;
198
210
  }
199
211
  function getGitHubOrgs() {
@@ -410,6 +422,8 @@ async function runDeployPipeline(options) {
410
422
  if (!p3.isCancel(connectWhop) && connectWhop) {
411
423
  p3.note(
412
424
  [
425
+ `We need a Company API key to create your OAuth app and webhooks.`,
426
+ "",
413
427
  `${pc3.bold("1.")} Go to the Whop Developer Dashboard`,
414
428
  ` ${pc3.cyan("https://whop.com/dashboard/developer")}`,
415
429
  "",
@@ -418,13 +432,17 @@ async function runDeployPipeline(options) {
418
432
  `${pc3.bold("3.")} Name it anything (e.g. "${projectName}")`,
419
433
  "",
420
434
  `${pc3.bold("4.")} Select these permissions:`,
421
- ` ${pc3.green("\u2022")} developer:create_app`,
422
- ` ${pc3.green("\u2022")} developer:manage_api_key`,
423
- ` ${pc3.green("\u2022")} developer:manage_webhook`,
435
+ ` ${pc3.green("\u2022")} developer:create_app ${pc3.dim("\u2014 create the OAuth app")}`,
436
+ ` ${pc3.green("\u2022")} developer:update_app ${pc3.dim("\u2014 configure redirect URIs")}`,
437
+ ` ${pc3.green("\u2022")} developer:manage_api_key ${pc3.dim("\u2014 get the app credentials")}`,
438
+ ` ${pc3.green("\u2022")} developer:manage_webhook ${pc3.dim("\u2014 set up payment webhooks")}`,
439
+ "",
440
+ `${pc3.bold("5.")} Create the key and paste it below`,
424
441
  "",
425
- `${pc3.bold("5.")} Create the key and paste it below`
442
+ `${pc3.dim("This key is used once to set everything up.")}`,
443
+ `${pc3.dim("Your app uses OAuth (openid, profile, email) for user sign-in.")}`
426
444
  ].join("\n"),
427
- "Create a Company API Key"
445
+ "Whop Company API Key"
428
446
  );
429
447
  openUrl("https://whop.com/dashboard/developer");
430
448
  let apiKey = options.whopCompanyKey ?? "";
@@ -675,7 +675,7 @@ var init_default = defineCommand({
675
675
  })();
676
676
  if (shouldDeploy) {
677
677
  deployAttempted = true;
678
- const { runDeployPipeline } = await import("./deploy-64CNJIBD.js");
678
+ const { runDeployPipeline } = await import("./deploy-RKFHMMX4.js");
679
679
  deployResult = await runDeployPipeline({
680
680
  projectDir,
681
681
  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-KXM3AHGK.js";
12
+ } from "./chunk-WU4NOKT4.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-KXM3AHGK.js";
4
+ } from "./chunk-WU4NOKT4.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": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Scaffold and manage Whop-powered apps with whop-kit",
5
5
  "type": "module",
6
6
  "license": "MIT",