create-whop-kit 0.4.0 → 0.4.1
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.
- package/README.md +83 -20
- package/dist/{chunk-M4AXERQP.js → chunk-KO52YVBE.js} +9 -0
- package/dist/cli-create.js +63 -24
- package/dist/cli-kit.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,41 +1,104 @@
|
|
|
1
1
|
# create-whop-kit
|
|
2
2
|
|
|
3
|
-
Scaffold
|
|
3
|
+
Scaffold and manage [Whop](https://whop.com)-powered apps with [whop-kit](https://www.npmjs.com/package/whop-kit).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Create a new project
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npx create-whop-kit my-app
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Interactive prompts guide you through:
|
|
12
12
|
|
|
13
|
-
1. **What you
|
|
14
|
-
2. **
|
|
15
|
-
3. **
|
|
13
|
+
1. **What are you building?** — SaaS (full dashboard + billing) or Blank (just auth + webhooks)
|
|
14
|
+
2. **Which framework?** — Next.js or Astro
|
|
15
|
+
3. **Which database?** — Neon (auto-provisioned), Prisma Postgres (instant), Supabase, manual URL, or skip
|
|
16
|
+
4. **Whop credentials** — App ID, API key, webhook secret (optional, can use setup wizard later)
|
|
16
17
|
|
|
17
|
-
The CLI clones
|
|
18
|
+
The CLI clones a template, provisions your database, writes `.env.local`, installs dependencies, and initializes git.
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
### Non-interactive mode
|
|
20
21
|
|
|
21
22
|
```bash
|
|
22
|
-
#
|
|
23
|
-
npx create-whop-kit my-app
|
|
23
|
+
# Skip all prompts
|
|
24
|
+
npx create-whop-kit my-app --framework nextjs --type saas --db neon --yes
|
|
25
|
+
|
|
26
|
+
# With credentials
|
|
27
|
+
npx create-whop-kit my-app --framework nextjs --db later --app-id "app_xxx" --api-key "apik_xxx"
|
|
24
28
|
|
|
25
|
-
#
|
|
26
|
-
npx create-whop-kit
|
|
29
|
+
# Preview without creating files
|
|
30
|
+
npx create-whop-kit my-app --framework nextjs --db later --dry-run
|
|
27
31
|
```
|
|
28
32
|
|
|
33
|
+
### All flags
|
|
34
|
+
|
|
35
|
+
| Flag | Description |
|
|
36
|
+
|------|-------------|
|
|
37
|
+
| `--framework` | `nextjs` or `astro` |
|
|
38
|
+
| `--type` | `saas` or `blank` (default: `saas`) |
|
|
39
|
+
| `--db` | `neon`, `prisma-postgres`, `supabase`, `manual`, `later` |
|
|
40
|
+
| `--db-url` | PostgreSQL connection URL (skips DB provisioning) |
|
|
41
|
+
| `--app-id` | Whop App ID |
|
|
42
|
+
| `--api-key` | Whop API Key |
|
|
43
|
+
| `--webhook-secret` | Whop webhook secret |
|
|
44
|
+
| `-y, --yes` | Skip optional prompts |
|
|
45
|
+
| `--dry-run` | Show what would be created |
|
|
46
|
+
| `--verbose` | Detailed output |
|
|
47
|
+
|
|
48
|
+
## Manage your project
|
|
49
|
+
|
|
50
|
+
After creating a project, use `whop-kit` to add features and check status:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Check project health
|
|
54
|
+
npx whop-kit status
|
|
55
|
+
|
|
56
|
+
# Add email (Resend or SendGrid)
|
|
57
|
+
npx whop-kit add email
|
|
58
|
+
|
|
59
|
+
# Add analytics (PostHog, Google Analytics, or Plausible)
|
|
60
|
+
npx whop-kit add analytics
|
|
61
|
+
|
|
62
|
+
# Add a webhook event handler
|
|
63
|
+
npx whop-kit add webhook-event
|
|
64
|
+
|
|
65
|
+
# Open provider dashboards
|
|
66
|
+
npx whop-kit open whop
|
|
67
|
+
npx whop-kit open neon
|
|
68
|
+
npx whop-kit open vercel
|
|
69
|
+
|
|
70
|
+
# Update whop-kit to latest
|
|
71
|
+
npx whop-kit upgrade
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Database provisioning
|
|
75
|
+
|
|
76
|
+
The CLI can provision databases automatically — no need to leave the terminal:
|
|
77
|
+
|
|
78
|
+
| Provider | How it works |
|
|
79
|
+
|----------|-------------|
|
|
80
|
+
| **Neon** | Installs `neonctl` → authenticates (browser) → creates project → gets connection string |
|
|
81
|
+
| **Prisma Postgres** | Runs `npx create-db` → instant database, no account needed |
|
|
82
|
+
| **Supabase** | Installs CLI → authenticates → creates project → guides you to get connection string |
|
|
83
|
+
|
|
29
84
|
## Templates
|
|
30
85
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| SaaS | Next.js | Available |
|
|
34
|
-
| SaaS | Astro |
|
|
35
|
-
|
|
|
36
|
-
| Course | — | Coming soon |
|
|
37
|
-
| Community | — | Coming soon |
|
|
38
|
-
|
|
86
|
+
| App Type | Framework | Template | Status |
|
|
87
|
+
|----------|-----------|----------|--------|
|
|
88
|
+
| SaaS | Next.js | Full dashboard, pricing, billing, docs | Available |
|
|
89
|
+
| SaaS | Astro | Auth, payments, webhooks | Available |
|
|
90
|
+
| Blank | Next.js | Just auth + webhooks — build anything | Available |
|
|
91
|
+
| Course | — | — | Coming soon |
|
|
92
|
+
| Community | — | — | Coming soon |
|
|
93
|
+
|
|
94
|
+
## How it works
|
|
95
|
+
|
|
96
|
+
1. **Template** — clones a starter repo from GitHub
|
|
97
|
+
2. **Database** — optionally provisions via provider CLI
|
|
98
|
+
3. **Environment** — writes `.env.local` from the template's `.env.example`
|
|
99
|
+
4. **Manifest** — creates `.whop/config.json` tracking your project state
|
|
100
|
+
5. **Dependencies** — installs with your preferred package manager
|
|
101
|
+
6. **Git** — initializes a fresh repo
|
|
39
102
|
|
|
40
103
|
## License
|
|
41
104
|
|
|
@@ -15,6 +15,14 @@ function exec(cmd, cwd) {
|
|
|
15
15
|
return { stdout: "", success: false };
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
function execInteractive(cmd, cwd) {
|
|
19
|
+
try {
|
|
20
|
+
execSync(cmd, { cwd, stdio: "inherit", timeout: 3e5 });
|
|
21
|
+
return true;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
18
26
|
function hasCommand(cmd) {
|
|
19
27
|
return exec(`which ${cmd}`).success;
|
|
20
28
|
}
|
|
@@ -65,6 +73,7 @@ function addFeatureToManifest(projectDir, feature) {
|
|
|
65
73
|
|
|
66
74
|
export {
|
|
67
75
|
exec,
|
|
76
|
+
execInteractive,
|
|
68
77
|
hasCommand,
|
|
69
78
|
detectPackageManager,
|
|
70
79
|
createManifest,
|
package/dist/cli-create.js
CHANGED
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
createManifest,
|
|
4
4
|
detectPackageManager,
|
|
5
5
|
exec,
|
|
6
|
+
execInteractive,
|
|
6
7
|
hasCommand
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KO52YVBE.js";
|
|
8
9
|
|
|
9
10
|
// src/cli-create.ts
|
|
10
11
|
import { runMain } from "citty";
|
|
@@ -108,38 +109,72 @@ var neonProvider = {
|
|
|
108
109
|
},
|
|
109
110
|
async provision(projectName) {
|
|
110
111
|
const cli = hasCommand("neonctl") ? "neonctl" : "neon";
|
|
111
|
-
const whoami = exec(`${cli} me`);
|
|
112
|
+
const whoami = exec(`${cli} me --output json`);
|
|
112
113
|
if (!whoami.success) {
|
|
113
|
-
p.log.info("You need to authenticate with Neon.");
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
114
|
+
p.log.info("You need to authenticate with Neon. This will open your browser.");
|
|
115
|
+
console.log("");
|
|
116
|
+
const authOk = execInteractive(`${cli} auth`);
|
|
117
|
+
if (!authOk) {
|
|
117
118
|
p.log.error("Neon authentication failed. Try running manually:");
|
|
118
119
|
p.log.info(pc.bold(` ${cli} auth`));
|
|
119
120
|
return null;
|
|
120
121
|
}
|
|
122
|
+
console.log("");
|
|
121
123
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
`${cli} projects create --name "${projectName}" --set-context
|
|
124
|
+
p.log.info(`Creating Neon project "${projectName}"...`);
|
|
125
|
+
console.log("");
|
|
126
|
+
const createOk = execInteractive(
|
|
127
|
+
`${cli} projects create --name "${projectName}" --set-context`
|
|
126
128
|
);
|
|
127
|
-
if (!
|
|
128
|
-
|
|
129
|
-
p.log.error("Try creating manually at https://console.neon.tech");
|
|
129
|
+
if (!createOk) {
|
|
130
|
+
p.log.error("Failed to create Neon project. Try manually at https://console.neon.tech");
|
|
130
131
|
return null;
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
console.log("");
|
|
134
|
+
p.log.success("Neon project created");
|
|
135
|
+
let connString = "";
|
|
136
|
+
const connResult = exec(`${cli} connection-string --prisma --output json`);
|
|
137
|
+
if (connResult.success) {
|
|
138
|
+
try {
|
|
139
|
+
const parsed = JSON.parse(connResult.stdout);
|
|
140
|
+
connString = parsed.connection_string || parsed.connectionString || connResult.stdout;
|
|
141
|
+
} catch {
|
|
142
|
+
connString = connResult.stdout.trim();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!connString) {
|
|
146
|
+
const fallback = exec(`${cli} connection-string --prisma`);
|
|
147
|
+
if (fallback.success && fallback.stdout.startsWith("postgres")) {
|
|
148
|
+
connString = fallback.stdout.trim();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (!connString) {
|
|
152
|
+
const raw = exec(`${cli} connection-string`);
|
|
153
|
+
if (raw.success && raw.stdout.startsWith("postgres")) {
|
|
154
|
+
connString = raw.stdout.trim();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (!connString) {
|
|
158
|
+
p.log.warning("Could not extract connection string automatically.");
|
|
159
|
+
console.log("");
|
|
160
|
+
execInteractive(`${cli} connection-string`);
|
|
161
|
+
console.log("");
|
|
162
|
+
const manual = await p.text({
|
|
163
|
+
message: "Paste the connection string shown above",
|
|
164
|
+
placeholder: "postgresql://...",
|
|
165
|
+
validate: (v) => {
|
|
166
|
+
if (!v?.startsWith("postgres")) return "Must be a PostgreSQL connection string";
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
if (p.isCancel(manual)) return null;
|
|
170
|
+
connString = manual;
|
|
171
|
+
}
|
|
172
|
+
if (!connString) {
|
|
173
|
+
p.log.error("Could not get connection string. Get it from: https://console.neon.tech");
|
|
138
174
|
return null;
|
|
139
175
|
}
|
|
140
|
-
s.stop("Connection string retrieved");
|
|
141
176
|
return {
|
|
142
|
-
connectionString:
|
|
177
|
+
connectionString: connString,
|
|
143
178
|
provider: "neon"
|
|
144
179
|
};
|
|
145
180
|
}
|
|
@@ -733,7 +768,7 @@ var init_default = defineCommand({
|
|
|
733
768
|
if (missing.length > 0) {
|
|
734
769
|
summary += `${pc5.yellow("\u25CB")} Missing: ${missing.join(", ")}
|
|
735
770
|
`;
|
|
736
|
-
summary += ` ${pc5.dim("
|
|
771
|
+
summary += ` ${pc5.dim("The setup wizard at http://localhost:3000 will guide you through it")}
|
|
737
772
|
`;
|
|
738
773
|
}
|
|
739
774
|
if (dbNote) {
|
|
@@ -745,10 +780,14 @@ var init_default = defineCommand({
|
|
|
745
780
|
summary += ` ${pc5.bold("cd")} ${basename2(projectName)}
|
|
746
781
|
`;
|
|
747
782
|
if (dbUrl) {
|
|
748
|
-
summary += ` ${pc5.bold(`${pm} run db:push`)}
|
|
783
|
+
summary += ` ${pc5.bold(`${pm} run db:push`)} ${pc5.dim("# push schema to database")}
|
|
749
784
|
`;
|
|
750
785
|
}
|
|
751
|
-
summary += ` ${pc5.bold(`${pm} run dev`)}
|
|
786
|
+
summary += ` ${pc5.bold(`${pm} run dev`)} ${pc5.dim("# start dev server")}
|
|
787
|
+
`;
|
|
788
|
+
summary += `
|
|
789
|
+
`;
|
|
790
|
+
summary += ` ${pc5.dim("Then open http://localhost:3000")}`;
|
|
752
791
|
p5.note(summary, "Your app is ready");
|
|
753
792
|
p5.outro(`${pc5.green("Happy building!")} ${pc5.dim("\u2014 whop-kit")}`);
|
|
754
793
|
}
|
package/dist/cli-kit.js
CHANGED