create-disposabl-app 0.8.11 → 0.8.12

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 CHANGED
@@ -39,3 +39,8 @@ only application operation. Disposabl's apps, previews, releases, provider
39
39
  connections, GitHub handlers, and service credentials stay in the Disposabl
40
40
  backend. Product-generated API bindings, contracts, and SDK operations are not
41
41
  copied into new apps.
42
+
43
+ The root `reset.ts` script owns the product-to-starter cleanup. The generator
44
+ runs it only inside its disposable staging copy before packaging. Replacement
45
+ backend files live in `starter/backend`; platform and feature selection still
46
+ happens when the user creates an app.
package/dist/disposabl.js CHANGED
@@ -255,7 +255,7 @@ Sign in to Expo if needed and choose Delete project. Then rerun this command to
255
255
  // ../cli/package.json
256
256
  var package_default = {
257
257
  name: "@disposabl/cli",
258
- version: "0.8.11",
258
+ version: "0.8.12",
259
259
  type: "module",
260
260
  description: "Command-line access to your Disposabl app",
261
261
  license: "MIT",
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
8
8
  import { Command, CommanderError } from "commander";
9
9
  import * as p2 from "@clack/prompts";
10
10
  // package.json
11
- var version = "0.8.11";
11
+ var version = "0.8.12";
12
12
 
13
13
  // ../disposabl-kit/platforms.ts
14
14
  var platforms = [
@@ -328,16 +328,11 @@ async function createApp(template, destination, name, config, overwrite = false)
328
328
  force: true
329
329
  });
330
330
  }
331
- await rm(join(destination, "apps/web/src/router/_authenticated/dashboard.connections.tsx"), { force: true });
332
- const dashboard = join(destination, "apps/web/src/router/_authenticated/dashboard.tsx");
333
- await writeFile(dashboard, (await readFile(dashboard, "utf8")).replace(` <Link to="/dashboard/connections">Connections</Link>
334
- `, ""));
335
331
  if (!config.features.includes("authentication")) {
336
332
  for (const path of [
337
333
  "packages/disposabl-kit/client/routes/_auth-pages",
338
334
  "packages/disposabl-kit/client/routes/consent.tsx",
339
335
  "apps/web/src/router/_authenticated/dashboard.api-keys.tsx",
340
- "apps/web/src/router/_authenticated/dashboard.connections.tsx",
341
336
  "apps/mobile/src/app/(auth)",
342
337
  "apps/mobile/src/app/(authenticated)/account.tsx"
343
338
  ]) {
@@ -18,7 +18,6 @@ function Dashboard() {
18
18
  <main className="mx-auto max-w-xl space-y-4 p-6">
19
19
  <h1 className="text-2xl font-semibold">Dashboard</h1>
20
20
  <nav className="flex gap-4">
21
- <Link to="/dashboard/connections">Connections</Link>
22
21
  {config.platforms.includes("api") && (
23
22
  <Link to="/dashboard/api-keys">API keys</Link>
24
23
  )}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.8.11",
3
+ "version": "0.8.12",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "scripts": {
25
25
  "build": "bun build.ts",
26
26
  "typecheck": "bun check",
27
- "lint": "eslint .",
27
+ "lint": "cd ../.. && packages/create-disposabl-app/node_modules/.bin/eslint --config packages/create-disposabl-app/eslint.config.ts packages/create-disposabl-app reset.ts",
28
28
  "format": "bun fmt"
29
29
  },
30
30
  "publishConfig": {
@@ -1,445 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
- import { createFileRoute, Link } from "@tanstack/react-router";
3
- import { useAction, useMutation, useQuery } from "convex/react";
4
- import { ConvexError } from "convex/values";
5
- import { Check, ArrowRight } from "lucide-react";
6
- import { api } from "../../../../../packages/backend/convex/_generated/api";
7
- import { Button } from "@disposabl/disposabl-kit/client/components/ui/button";
8
- import { Input } from "@disposabl/disposabl-kit/client/components/ui/input";
9
- import { ProviderLogo } from "../../components/connections/provider-logo";
10
-
11
- export const Route = createFileRoute(
12
- "/_providers/_authenticated/dashboard/connections",
13
- )({ component: Connections });
14
-
15
- type Provider = "github" | "convex";
16
- type Installation = { installationId: string; owner: string };
17
- const pendingKey = "disposabl.pendingConnectionProvider";
18
- const isProvider = (value: string | null): value is Provider =>
19
- value === "github" || value === "convex";
20
-
21
- function Connections() {
22
- const status = useQuery(api.connections.index.status, {});
23
- const start = useAction(api.connections.index.start);
24
- const complete = useAction(api.connections.index.complete);
25
- const selectGithub = useAction(api.connections.index.selectGithub);
26
- const expoAccounts = useAction(api.connections.index.expoAccounts);
27
- const connectExpo = useAction(api.connections.index.connectExpo);
28
- const disconnect = useMutation(api.connections.index.disconnect);
29
- const [busy, setBusy] = useState(false);
30
- const [error, setError] = useState<string>();
31
- const [installations, setInstallations] = useState<Installation[]>([]);
32
- const [proof, setProof] = useState<string>();
33
- const [installNeeded, setInstallNeeded] = useState(false);
34
- const [returnedFromInstall, setReturnedFromInstall] = useState(false);
35
- const [token, setToken] = useState("");
36
- const [showExpo, setShowExpo] = useState(false);
37
- const [accounts, setAccounts] = useState<Array<{ id: string; name: string }>>(
38
- [],
39
- );
40
- const [accountId, setAccountId] = useState("");
41
- const consumed = useRef(false);
42
- const fail = (cause: unknown) =>
43
- setError(
44
- cause instanceof ConvexError && typeof cause.data === "string"
45
- ? cause.data
46
- : cause instanceof Error
47
- ? cause.message
48
- : "Something went wrong. Please try again.",
49
- );
50
-
51
- useEffect(() => {
52
- if (consumed.current) return;
53
- consumed.current = true;
54
- const url = new URL(window.location.href);
55
- const queryProvider = url.searchParams.get("provider");
56
- const pending = sessionStorage.getItem(pendingKey);
57
- const provider = isProvider(queryProvider)
58
- ? queryProvider
59
- : isProvider(pending)
60
- ? pending
61
- : null;
62
- const code = url.searchParams.get("code");
63
- const state = url.searchParams.get("state");
64
- const denial = url.searchParams.get("error");
65
- const installationReturn =
66
- url.searchParams.has("installation_id") ||
67
- url.searchParams.has("setup_action");
68
- if (installationReturn) setReturnedFromInstall(true);
69
- const callback =
70
- code !== null ||
71
- state !== null ||
72
- denial !== null ||
73
- queryProvider !== null;
74
- if (!callback || (installationReturn && !code && !state && !denial)) return;
75
- if (denial) {
76
- setError(
77
- "Authorization was cancelled or denied. Please try connecting again.",
78
- );
79
- return;
80
- }
81
- if (!provider || !code || !state) {
82
- setError(
83
- "The authorization response is incomplete. Please connect again to restart authorization.",
84
- );
85
- return;
86
- }
87
- // Capture the callback before removing it; the backend verifies the OAuth state.
88
- for (const key of [
89
- "provider",
90
- "code",
91
- "state",
92
- "error",
93
- "error_description",
94
- "installation_id",
95
- "setup_action",
96
- ])
97
- url.searchParams.delete(key);
98
- window.history.replaceState(window.history.state, "", url.toString());
99
- sessionStorage.removeItem(pendingKey);
100
- setBusy(true);
101
- void complete({ provider, code, state })
102
- .then(async (result) => {
103
- if (provider !== "github") return;
104
- const installation = result.installations.at(0);
105
- if (result.installations.length === 1 && installation) {
106
- if (!result.proof)
107
- throw new Error(
108
- "GitHub did not return an account selection proof. Please connect again.",
109
- );
110
- await selectGithub({
111
- proof: result.proof,
112
- installationId: installation.installationId,
113
- });
114
- } else {
115
- setInstallations(result.installations);
116
- setProof(result.proof);
117
- setInstallNeeded(result.installations.length === 0);
118
- }
119
- })
120
- .catch(fail)
121
- .finally(() => setBusy(false));
122
- }, [complete, selectGithub]);
123
-
124
- async function run(action: () => Promise<void>) {
125
- if (busy) return;
126
- setBusy(true);
127
- setError(undefined);
128
- try {
129
- await action();
130
- } catch (cause) {
131
- fail(cause);
132
- } finally {
133
- setBusy(false);
134
- }
135
- }
136
- function connect(provider: Provider) {
137
- void run(async () => {
138
- const url = await start({ provider });
139
- sessionStorage.setItem(pendingKey, provider);
140
- window.location.assign(url);
141
- });
142
- }
143
- const providers = [
144
- {
145
- id: "github",
146
- name: "GitHub",
147
- description: "Create and manage your app's repository.",
148
- },
149
- {
150
- id: "convex",
151
- name: "Convex",
152
- description: "Run your backend in your own Convex team.",
153
- },
154
- {
155
- id: "expo",
156
- name: "Expo",
157
- description: "Build and update your mobile app.",
158
- },
159
- ] as const;
160
- const completed =
161
- Number(Boolean(status?.github)) + Number(Boolean(status?.convex));
162
-
163
- return (
164
- <main className="mx-auto max-w-3xl px-5 py-10 sm:px-8 sm:py-16">
165
- <header className="mb-8 sm:mb-10">
166
- <p className="mb-3 text-xs font-semibold tracking-[0.18em] text-muted-foreground uppercase">
167
- Set up your workspace
168
- </p>
169
- <h1 className="max-w-2xl text-3xl font-semibold tracking-tight sm:text-4xl">
170
- Your code. Your data.
171
- <br />
172
- Your accounts.
173
- </h1>
174
- <p className="mt-4 max-w-xl text-sm leading-6 text-muted-foreground sm:text-base">
175
- Connect GitHub and Convex to create your app in accounts you control.
176
- Add Expo when you're ready to build for mobile.
177
- </p>
178
- </header>
179
- <div className="mb-5 flex items-center justify-between gap-3 text-sm">
180
- <span className="font-medium">Connect your accounts</span>
181
- <span className="text-muted-foreground">
182
- {completed} of 2 connected
183
- </span>
184
- </div>
185
- <div
186
- className="mb-6 flex gap-1.5"
187
- aria-label={`${completed} of 2 accounts connected`}
188
- >
189
- {[1, 2].map((step) => (
190
- <div
191
- key={step}
192
- className={`h-1.5 flex-1 rounded-full ${completed >= step ? "bg-primary" : "bg-muted"}`}
193
- />
194
- ))}
195
- </div>
196
- {error && (
197
- <p
198
- role="alert"
199
- className="mb-5 rounded-lg border border-destructive/30 bg-destructive/5 p-4 text-sm text-destructive"
200
- >
201
- {error}
202
- </p>
203
- )}
204
- {!status ? (
205
- <p role="status" className="text-sm text-muted-foreground">
206
- Loading connections…
207
- </p>
208
- ) : (
209
- <div className="space-y-3">
210
- {providers.map(({ id, name, description }, index) => {
211
- const connected = status[id];
212
- return (
213
- <section
214
- key={id}
215
- className="rounded-2xl border bg-card p-5 shadow-sm sm:p-6"
216
- >
217
- <div className="flex flex-wrap items-center gap-4 sm:flex-nowrap">
218
- <div className="flex size-12 shrink-0 items-center justify-center rounded-xl border bg-background">
219
- <ProviderLogo provider={id} />
220
- </div>
221
- <div className="min-w-0 flex-1">
222
- <div className="flex flex-wrap items-center gap-2">
223
- <h2 className="font-semibold">{name}</h2>
224
- {connected ? (
225
- <span className="inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:text-emerald-400">
226
- <Check className="size-3" /> Connected
227
- </span>
228
- ) : id === "expo" ? (
229
- <span className="text-xs text-muted-foreground">
230
- Optional
231
- </span>
232
- ) : (
233
- <span className="text-xs text-muted-foreground">
234
- Step {index + 1}
235
- </span>
236
- )}
237
- </div>
238
- <p className="mt-1 text-sm text-muted-foreground">
239
- {connected
240
- ? "owner" in connected
241
- ? connected.owner
242
- : connected.name
243
- : description}
244
- </p>
245
- </div>
246
- {connected ? (
247
- <Button
248
- variant="outline"
249
- className="min-h-11"
250
- disabled={busy}
251
- onClick={() =>
252
- void run(async () => {
253
- await disconnect({ provider: id });
254
- })
255
- }
256
- >
257
- Disconnect
258
- </Button>
259
- ) : (
260
- <Button
261
- className="min-h-11"
262
- disabled={busy || !status.available[id]}
263
- onClick={() =>
264
- id === "expo" ? setShowExpo(!showExpo) : connect(id)
265
- }
266
- >
267
- {id === "expo" && showExpo
268
- ? "Cancel"
269
- : id === "github" && returnedFromInstall
270
- ? "Connect again"
271
- : "Connect"}
272
- </Button>
273
- )}
274
- </div>
275
- {!status.available[id] && !connected && (
276
- <p className="mt-4 text-sm text-muted-foreground">
277
- Temporarily unavailable.
278
- </p>
279
- )}
280
- {id === "github" && installations.length > 1 && (
281
- <div className="mt-5 border-t pt-4">
282
- <p className="mb-3 text-sm font-medium">Select account</p>
283
- <div className="flex flex-wrap gap-2">
284
- {installations.map((installation) => (
285
- <Button
286
- key={installation.installationId}
287
- variant="outline"
288
- disabled={busy || !proof}
289
- onClick={() =>
290
- void run(async () => {
291
- if (!proof) return;
292
- await selectGithub({
293
- proof,
294
- installationId: installation.installationId,
295
- });
296
- setInstallations([]);
297
- setProof(undefined);
298
- })
299
- }
300
- >
301
- {installation.owner}
302
- </Button>
303
- ))}
304
- </div>
305
- </div>
306
- )}
307
- {id === "github" && installNeeded && (
308
- <p className="mt-4 text-sm">
309
- Install Disposabl on GitHub, then return here and connect
310
- again.{" "}
311
- {status.githubInstallUrl && (
312
- <a
313
- className="font-medium underline underline-offset-4"
314
- href={status.githubInstallUrl}
315
- >
316
- Install on GitHub
317
- </a>
318
- )}
319
- </p>
320
- )}
321
- {id === "expo" && !connected && showExpo && (
322
- <form
323
- className="mt-5 space-y-4 border-t pt-5"
324
- onSubmit={(event) => {
325
- event.preventDefault();
326
- void run(async () => {
327
- if (!accounts.length) {
328
- const result = await expoAccounts({ token });
329
- if (!result.length)
330
- throw new Error(
331
- "No Expo accounts were found for this token.",
332
- );
333
- setAccounts(result);
334
- setAccountId(result[0]?.id ?? "");
335
- } else {
336
- await connectExpo({ token, accountId });
337
- setToken("");
338
- setAccounts([]);
339
- setAccountId("");
340
- setShowExpo(false);
341
- }
342
- });
343
- }}
344
- >
345
- <p className="text-sm text-muted-foreground">
346
- Verify an Expo access token, then choose the account to
347
- save.
348
- </p>
349
- <label className="block space-y-2 text-sm font-medium">
350
- Access token
351
- <Input
352
- type="password"
353
- autoComplete="off"
354
- required
355
- value={token}
356
- onChange={(event) => {
357
- setToken(event.target.value);
358
- setAccounts([]);
359
- setAccountId("");
360
- }}
361
- />
362
- </label>
363
- <a
364
- className="inline-block text-sm underline underline-offset-4"
365
- href="https://expo.dev/settings/access-tokens"
366
- target="_blank"
367
- rel="noreferrer"
368
- >
369
- Create an Expo access token
370
- </a>
371
- {accounts.length > 0 && (
372
- <label className="block space-y-2 text-sm font-medium">
373
- Expo account
374
- <select
375
- className="block min-h-11 w-full rounded-md border bg-background px-3"
376
- value={accountId}
377
- onChange={(event) => setAccountId(event.target.value)}
378
- >
379
- {accounts.map((account) => (
380
- <option key={account.id} value={account.id}>
381
- {account.name}
382
- </option>
383
- ))}
384
- </select>
385
- </label>
386
- )}
387
- <div>
388
- <Button
389
- type="submit"
390
- className="min-h-11"
391
- disabled={busy || !token.trim()}
392
- >
393
- {accounts.length ? "Save account" : "Verify token"}
394
- </Button>
395
- </div>
396
- </form>
397
- )}
398
- </section>
399
- );
400
- })}
401
- </div>
402
- )}
403
- {busy && (
404
- <p role="status" className="mt-4 text-sm text-muted-foreground">
405
- Connecting…
406
- </p>
407
- )}
408
- <div className="mt-8 flex flex-wrap items-center justify-between gap-4 border-t pt-6">
409
- <p className="text-sm text-muted-foreground">
410
- {status?.ready
411
- ? "Your accounts are connected. Continue in your terminal or dashboard."
412
- : "Connect GitHub and Convex to continue."}
413
- </p>
414
- {status?.ready ? (
415
- <Link
416
- to="/dashboard"
417
- className="inline-flex min-h-11 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90"
418
- >
419
- Continue <ArrowRight className="ml-2 size-4" />
420
- </Link>
421
- ) : (
422
- <Button disabled className="min-h-11">
423
- Continue <ArrowRight className="ml-2 size-4" />
424
- </Button>
425
- )}
426
- </div>
427
- <details className="mt-8 text-sm text-muted-foreground">
428
- <summary className="cursor-pointer font-medium">
429
- Permissions and security
430
- </summary>
431
- <div className="mt-3 space-y-2 leading-relaxed">
432
- <p>
433
- GitHub access creates repositories and manages builds, releases and
434
- CI secrets. Convex access can create and manage projects in your
435
- selected team. Expo tokens are verified before saving.
436
- </p>
437
- <p>
438
- Saved tokens are encrypted. Disconnect here to remove saved access,
439
- and revoke provider access and CI tokens in their settings.
440
- </p>
441
- </div>
442
- </details>
443
- </main>
444
- );
445
- }