create-disposabl-app 0.8.15 → 0.9.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 +62 -30
- package/dist/disposabl.js +10 -7
- package/dist/index.js +10 -4
- package/dist/templates/default/.github/README.md +20 -0
- package/dist/templates/default/.github/workflows/pipeline.yml +6 -6
- package/dist/templates/default/apps/mobile/README.md +1 -1
- package/dist/templates/default/apps/web/src/components/connections/expo-connection.tsx +97 -0
- package/dist/templates/default/apps/web/src/components/connections/provider-logo.tsx +7 -1
- package/dist/templates/default/apps/web/src/components/connections/use-connection-setup.ts +169 -0
- package/dist/templates/default/packages/cli/commands.ts +13 -6
- package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +2 -8
- package/dist/templates/default/packages/skill/SKILL.md +18 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,51 +1,83 @@
|
|
|
1
1
|
# create-disposabl-app
|
|
2
2
|
|
|
3
|
-
Create a Disposabl app
|
|
3
|
+
Create a Disposabl app for web, mobile, desktop, and developer tools.
|
|
4
|
+
|
|
5
|
+
## Get started
|
|
6
|
+
|
|
7
|
+
Install [Bun](https://bun.sh) and [Git](https://git-scm.com), then run:
|
|
4
8
|
|
|
5
9
|
```sh
|
|
6
|
-
|
|
10
|
+
bunx create-disposabl-app@latest
|
|
7
11
|
```
|
|
8
12
|
|
|
9
|
-
Web is always included
|
|
10
|
-
`--features none` to disable it, or include `authentication` in a comma-separated
|
|
11
|
-
feature list. Auth-disabled projects omit login/signup routes and auth-dependent
|
|
12
|
-
example screens, so missing routes return 404. Backend authentication code and
|
|
13
|
-
its access checks remain installed.
|
|
13
|
+
Choose your app's name and platforms. Web is always included, and app sign-in is enabled by default.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
determine the next version; no manual version edit is needed.
|
|
15
|
+
Setup asks you to sign in to [Disposabl](https://www.disposabl.dev) and connect GitHub and Convex. Mobile apps also need an Expo account. It creates your project and configures its development environment.
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
When setup finishes:
|
|
19
18
|
|
|
20
19
|
```sh
|
|
21
|
-
bun create disposabl-app@latest my-app
|
|
22
20
|
cd my-app
|
|
23
21
|
bun run dev
|
|
24
22
|
```
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
Use the app name you chose instead of `my-app`. Your website opens automatically. Mobile apps need a development build before you can open them on a device; they do not use Expo Go. See the generated `apps/mobile/README.md` for the next steps.
|
|
25
|
+
|
|
26
|
+
You can also launch setup with npm, pnpm, or Yarn 2+. The generated project still requires Bun. These launchers also need Node.js 22.12 or newer.
|
|
27
|
+
|
|
28
|
+
| Tool | Command |
|
|
29
|
+
| ---- | -------------------------------------- |
|
|
30
|
+
| npm | `npx create-disposabl-app@latest` |
|
|
31
|
+
| pnpm | `pnpm dlx create-disposabl-app@latest` |
|
|
32
|
+
| Yarn | `yarn dlx create-disposabl-app@latest` |
|
|
33
|
+
|
|
34
|
+
## Prefer a coding agent?
|
|
35
|
+
|
|
36
|
+
Paste this into Codex, Claude Code, Cursor, or another coding agent:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Help me build an app with Disposabl. Read https://github.com/disposabl-dev/create-disposabl-app, then ask me what I want to make and where it should run.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Choose options in the command
|
|
43
|
+
|
|
44
|
+
For example, create a web and mobile app with sign-in:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
bunx create-disposabl-app@latest my-app --platforms web,ios,android --yes
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Option | What it does |
|
|
51
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| `--platforms <ids>` | Choose `web`, `ios`, `android`, `macos`, `windows`, `linux`, `mcp`, `api`, `cli`, or `typescript-sdk`. Separate multiple choices with commas. Web is always included. |
|
|
53
|
+
| `--features <ids>` | Choose features from `--list-options`, such as `authentication` and `docs`. The default is `authentication`. Use `--features none` to omit optional features. |
|
|
54
|
+
| `--yes` | Skip the name, platform, and feature questions. Supply an app name in the command. |
|
|
55
|
+
| `--list-options` | Show available platforms and features without creating an app. |
|
|
56
|
+
| `--skip-install` | Create files without installing dependencies. Account setup still runs. |
|
|
57
|
+
| `--json` | Return a result coding agents can read. Supply an app name. Account setup still runs. |
|
|
27
58
|
|
|
28
|
-
|
|
59
|
+
CLI and TypeScript SDK include API support automatically. Backend authentication and access checks remain installed even with `--features none`.
|
|
29
60
|
|
|
30
|
-
|
|
61
|
+
## If setup stops
|
|
31
62
|
|
|
32
|
-
|
|
63
|
+
Your files are saved. Follow the error's instructions, then run the same command from the parent folder:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
bunx create-disposabl-app@latest my-app
|
|
67
|
+
```
|
|
33
68
|
|
|
34
|
-
|
|
69
|
+
Setup resumes using the existing project and app ID. If dependency installation failed, run `bun install` inside the app folder before retrying.
|
|
35
70
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
71
|
+
## Development and publishing
|
|
72
|
+
|
|
73
|
+
New apps start on the `main` branch with a configured local development environment. Use `bun run dev` for local work.
|
|
74
|
+
|
|
75
|
+
For a separate Git worktree, run this inside that worktree to configure its development environment:
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
bunx --package create-disposabl-app disposabl previews token create --configure .
|
|
79
|
+
```
|
|
40
80
|
|
|
41
|
-
|
|
42
|
-
authentication, static hosting, and API/MCP support, with `users/current` as its
|
|
43
|
-
only application operation. Disposabl's apps, previews, releases, provider
|
|
44
|
-
connections, GitHub handlers, and service credentials stay in the Disposabl
|
|
45
|
-
backend. Product-generated API bindings, contracts, and SDK operations are not
|
|
46
|
-
copied into new apps.
|
|
81
|
+
Push the generated initial commit to `main` before opening feature pull requests. A same-repository pull request to `main` starts a CI preview; changes pushed to `main` start the production workflow. A feature branch push by itself does not deploy. Build and delivery requirements depend on the selected platforms.
|
|
47
82
|
|
|
48
|
-
|
|
49
|
-
runs it only inside its disposable staging copy before packaging. Replacement
|
|
50
|
-
backend files live in `starter/backend`; platform and feature selection still
|
|
51
|
-
happens when the user creates an app.
|
|
83
|
+
See the [coding-agent guide](https://github.com/disposabl-dev/create-disposabl-app/blob/main/packages/skill/SKILL.md) for the full delivery workflow, or [report a problem](https://github.com/disposabl-dev/create-disposabl-app/issues).
|
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.
|
|
258
|
+
version: "0.9.1",
|
|
259
259
|
type: "module",
|
|
260
260
|
description: "Command-line access to your Disposabl app",
|
|
261
261
|
license: "MIT",
|
|
@@ -494,7 +494,9 @@ async function runCli(argv = process.argv, serviceOrigin = SERVICE_ORIGIN) {
|
|
|
494
494
|
const command = parent.command(parts.at(-1));
|
|
495
495
|
const connectionStatus = path === "/api/connections/status";
|
|
496
496
|
if (connectionStatus)
|
|
497
|
-
command.option("--wait", "Open
|
|
497
|
+
command.option("--wait", "Open setup and continue when GitHub, Blacksmith and Convex are ready");
|
|
498
|
+
if (connectionStatus)
|
|
499
|
+
command.option("--mobile", "Also wait for Expo when creating a mobile app");
|
|
498
500
|
const deleteApp = path === "/api/apps/delete";
|
|
499
501
|
if (deleteApp)
|
|
500
502
|
command.option("--no-browser", "Print the Expo cleanup URL without opening a browser");
|
|
@@ -564,14 +566,15 @@ async function runCli(argv = process.argv, serviceOrigin = SERVICE_ORIGIN) {
|
|
|
564
566
|
if (!result.ok)
|
|
565
567
|
throw new Error(`API request failed (${result.status}): ${await result.text()}`);
|
|
566
568
|
let value = await result.json();
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
569
|
+
const ready = () => value.ready && (!options.mobile || Boolean(value.expo));
|
|
570
|
+
if (connectionStatus && options.wait && !ready()) {
|
|
571
|
+
const url = `${base}/dashboard/connections?mobile=${options.mobile ? "1" : "0"}`;
|
|
572
|
+
console.error(`Set up your free GitHub organization, Blacksmith and Convex accounts (plus Expo for mobile):
|
|
570
573
|
${url}
|
|
571
574
|
Waiting for connections. Press Ctrl+C to keep your files and finish later.`);
|
|
572
575
|
openUrl(url);
|
|
573
576
|
const deadline = Date.now() + 15 * 60000;
|
|
574
|
-
while (!
|
|
577
|
+
while (!ready() && Date.now() < deadline) {
|
|
575
578
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
576
579
|
result = await send();
|
|
577
580
|
if (result.status === 401 && !process.env.DISPOSABL_API_KEY)
|
|
@@ -580,7 +583,7 @@ Waiting for connections. Press Ctrl+C to keep your files and finish later.`);
|
|
|
580
583
|
throw new Error(`Connection status failed (${result.status}). Your login and app files are saved.`);
|
|
581
584
|
value = await result.json();
|
|
582
585
|
}
|
|
583
|
-
if (!
|
|
586
|
+
if (!ready())
|
|
584
587
|
throw new Error(`Connections are still incomplete. Finish at ${url}, then retry setup.`);
|
|
585
588
|
}
|
|
586
589
|
if (tokenCreate && options.configure) {
|
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.
|
|
11
|
+
var version = "0.9.1";
|
|
12
12
|
|
|
13
13
|
// ../disposabl-kit/platforms.ts
|
|
14
14
|
var platforms = [
|
|
@@ -536,11 +536,17 @@ async function setupApp(directory, name, run = runDisposabl) {
|
|
|
536
536
|
if (!verified.currentUser)
|
|
537
537
|
throw new Error("Login completed without a verified user.");
|
|
538
538
|
}
|
|
539
|
-
const connections = await run(["connections", "status", "--wait"]);
|
|
540
|
-
if (!connections.ready)
|
|
541
|
-
throw new Error("Connect GitHub and Convex at https://www.disposabl.dev/dashboard/connections, then retry from the parent directory: bun create disposabl-app@latest " + basename3(directory) + ". Your app files and login are saved.");
|
|
542
539
|
const path = join3(directory, "disposabl.json");
|
|
543
540
|
const config = JSON.parse(await readFile2(path, "utf8"));
|
|
541
|
+
const mobile = config.platforms.some((p) => p === "ios" || p === "android");
|
|
542
|
+
const connections = await run([
|
|
543
|
+
"connections",
|
|
544
|
+
"status",
|
|
545
|
+
"--wait",
|
|
546
|
+
...mobile ? ["--mobile"] : []
|
|
547
|
+
]);
|
|
548
|
+
if (!connections.ready)
|
|
549
|
+
throw new Error("Install Disposabl and Blacksmith in a GitHub organization, then connect Convex at https://www.disposabl.dev/dashboard/connections, then retry from the parent directory: bun create disposabl-app@latest " + basename3(directory) + ". Your app files and login are saved.");
|
|
544
550
|
if (config.appId) {
|
|
545
551
|
const app = await run(["apps", "get", "--appId", config.appId]);
|
|
546
552
|
if (JSON.stringify([...app.platforms].sort()) !== JSON.stringify([...config.platforms].sort()))
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# App builds
|
|
2
|
+
|
|
3
|
+
Install Disposabl and Blacksmith in the same GitHub organization before creating
|
|
4
|
+
an app. Blacksmith does not support personal repositories. A GitHub organization
|
|
5
|
+
is free and works for a solo developer: [create one](https://github.com/organizations/plan).
|
|
6
|
+
Select All repositories when installing Blacksmith so newly generated apps can
|
|
7
|
+
run their workflows. A confirmation in Disposabl records the user's setup;
|
|
8
|
+
only a completed runner job proves that repository access works.
|
|
9
|
+
|
|
10
|
+
Web and Android builds use Blacksmith Ubuntu runners. Desktop builds use its
|
|
11
|
+
Linux, Windows, or macOS runners; iOS simulator previews use its macOS 27 image
|
|
12
|
+
and default Xcode. The existing production iOS path uses EAS Build. Package
|
|
13
|
+
publishing and protected release jobs remain on GitHub-hosted Ubuntu for their
|
|
14
|
+
trusted publishing configuration.
|
|
15
|
+
|
|
16
|
+
Blacksmith includes 3,000 equivalent 2-vCPU Linux minutes per organization per
|
|
17
|
+
month. Larger runners and Windows/macOS consume the allowance at different
|
|
18
|
+
rates. See [pricing](https://www.blacksmith.sh/pricing) and
|
|
19
|
+
[runner types](https://docs.blacksmith.sh/blacksmith-runners/overview).
|
|
20
|
+
All provider accounts are free to create; build and hosting usage limits apply.
|
|
@@ -17,10 +17,10 @@ env:
|
|
|
17
17
|
EAS_CLI: eas-cli@27.2.0
|
|
18
18
|
BUN_VERSION: &bun-version "1.4.4"
|
|
19
19
|
NODE_VERSION: &node-version "24"
|
|
20
|
-
LINUX_RUNNER: &linux-runner ubuntu-
|
|
21
|
-
WEB_RUNNER: &web-runner ubuntu-
|
|
22
|
-
WINDOWS_RUNNER: windows-2025
|
|
23
|
-
MACOS_RUNNER: macos-
|
|
20
|
+
LINUX_RUNNER: &linux-runner blacksmith-4vcpu-ubuntu-2404
|
|
21
|
+
WEB_RUNNER: &web-runner blacksmith-4vcpu-ubuntu-2404
|
|
22
|
+
WINDOWS_RUNNER: blacksmith-2vcpu-windows-2025
|
|
23
|
+
MACOS_RUNNER: blacksmith-6vcpu-macos-27
|
|
24
24
|
RELEASE_PREFIX: app
|
|
25
25
|
DISPOSABL_ANDROID_VERSION_CODE: ${{ github.run_number }}
|
|
26
26
|
DISPOSABL_IOS_BUILD_NUMBER: ${{ github.run_number }}
|
|
@@ -97,6 +97,7 @@ jobs:
|
|
|
97
97
|
done
|
|
98
98
|
- name: Deploy
|
|
99
99
|
id: deploy
|
|
100
|
+
timeout-minutes: 1
|
|
100
101
|
env:
|
|
101
102
|
TRUSTED: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
102
103
|
CONVEX_DEPLOY_KEY: ${{ secrets[github.event_name == 'push' && 'CONVEX_DEPLOY_KEY' || 'CONVEX_DEPLOY_KEY_PREVIEW'] }}
|
|
@@ -205,10 +206,9 @@ jobs:
|
|
|
205
206
|
needs: web
|
|
206
207
|
if: github.event_name == 'pull_request' && needs.web.outputs.ios == 'true'
|
|
207
208
|
permissions: *release-permissions
|
|
208
|
-
runs-on:
|
|
209
|
+
runs-on: blacksmith-6vcpu-macos-27
|
|
209
210
|
timeout-minutes: 90
|
|
210
211
|
env:
|
|
211
|
-
DEVELOPER_DIR: /Applications/Xcode_27.2.0.app/Contents/Developer
|
|
212
212
|
CONVEX_URL: ${{ needs.web.outputs.convex_url }}
|
|
213
213
|
CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
|
|
214
214
|
EXPO_PUBLIC_CONVEX_URL: ${{ needs.web.outputs.convex_url }}
|
|
@@ -72,7 +72,7 @@ installable APK in a separate 4-vCPU Android job. Later runs with the same finge
|
|
|
72
72
|
publish EAS Update from Web. Native jobs install only the mobile workspace using
|
|
73
73
|
the shared dependency cache. Android and iOS native builds run in parallel.
|
|
74
74
|
Linux and Windows start alongside Web.
|
|
75
|
-
|
|
75
|
+
Build jobs use Blacksmith; package publishing keeps GitHub-hosted runners and production iOS uses EAS Build. See [.github/README.md](../../.github/README.md)
|
|
76
76
|
for the job order and cache behavior.
|
|
77
77
|
|
|
78
78
|
Each PR uses its own `pr-<number>` channel and Android application ID. Production
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useAction } from "convex/react";
|
|
3
|
+
import { api } from "../../../../../packages/backend/convex/_generated/api";
|
|
4
|
+
import { Button } from "@disposabl/disposabl-kit/client/components/ui/button";
|
|
5
|
+
import { Input } from "@disposabl/disposabl-kit/client/components/ui/input";
|
|
6
|
+
|
|
7
|
+
export function ExpoConnection({
|
|
8
|
+
busy,
|
|
9
|
+
run,
|
|
10
|
+
onConnected,
|
|
11
|
+
}: {
|
|
12
|
+
busy: boolean;
|
|
13
|
+
run: (action: () => Promise<void>) => Promise<void>;
|
|
14
|
+
onConnected: () => void;
|
|
15
|
+
}) {
|
|
16
|
+
const expoAccounts = useAction(api.connections.index.expoAccounts);
|
|
17
|
+
const connectExpo = useAction(api.connections.index.connectExpo);
|
|
18
|
+
const [token, setToken] = useState("");
|
|
19
|
+
const [accounts, setAccounts] = useState<Array<{ id: string; name: string }>>(
|
|
20
|
+
[],
|
|
21
|
+
);
|
|
22
|
+
const [accountId, setAccountId] = useState("");
|
|
23
|
+
return (
|
|
24
|
+
<form
|
|
25
|
+
className="mt-5 space-y-4 border-t pt-5"
|
|
26
|
+
onSubmit={(event) => {
|
|
27
|
+
event.preventDefault();
|
|
28
|
+
void run(async () => {
|
|
29
|
+
if (!accounts.length) {
|
|
30
|
+
const result = await expoAccounts({ token });
|
|
31
|
+
if (!result.length)
|
|
32
|
+
throw new Error("No Expo accounts were found for this token.");
|
|
33
|
+
setAccounts(result);
|
|
34
|
+
setAccountId(result[0]?.id ?? "");
|
|
35
|
+
} else {
|
|
36
|
+
await connectExpo({ token, accountId });
|
|
37
|
+
setToken("");
|
|
38
|
+
setAccounts([]);
|
|
39
|
+
setAccountId("");
|
|
40
|
+
onConnected();
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
<p className="text-sm text-muted-foreground">
|
|
46
|
+
Verify an Expo access token, then choose the account to save.
|
|
47
|
+
</p>
|
|
48
|
+
<label className="block space-y-2 text-sm font-medium">
|
|
49
|
+
Access token
|
|
50
|
+
<Input
|
|
51
|
+
type="password"
|
|
52
|
+
autoComplete="off"
|
|
53
|
+
required
|
|
54
|
+
value={token}
|
|
55
|
+
onChange={(event) => {
|
|
56
|
+
setToken(event.target.value);
|
|
57
|
+
setAccounts([]);
|
|
58
|
+
setAccountId("");
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
</label>
|
|
62
|
+
<a
|
|
63
|
+
className="inline-block text-sm underline underline-offset-4"
|
|
64
|
+
href="https://expo.dev/settings/access-tokens"
|
|
65
|
+
target="_blank"
|
|
66
|
+
rel="noreferrer"
|
|
67
|
+
>
|
|
68
|
+
Create an Expo access token
|
|
69
|
+
</a>
|
|
70
|
+
{accounts.length > 0 && (
|
|
71
|
+
<label className="block space-y-2 text-sm font-medium">
|
|
72
|
+
Expo account
|
|
73
|
+
<select
|
|
74
|
+
className="block min-h-11 w-full rounded-md border bg-background px-3"
|
|
75
|
+
value={accountId}
|
|
76
|
+
onChange={(event) => setAccountId(event.target.value)}
|
|
77
|
+
>
|
|
78
|
+
{accounts.map((account) => (
|
|
79
|
+
<option key={account.id} value={account.id}>
|
|
80
|
+
{account.name}
|
|
81
|
+
</option>
|
|
82
|
+
))}
|
|
83
|
+
</select>
|
|
84
|
+
</label>
|
|
85
|
+
)}
|
|
86
|
+
<div>
|
|
87
|
+
<Button
|
|
88
|
+
type="submit"
|
|
89
|
+
className="min-h-11"
|
|
90
|
+
disabled={busy || !token.trim()}
|
|
91
|
+
>
|
|
92
|
+
{accounts.length ? "Save account" : "Verify token"}
|
|
93
|
+
</Button>
|
|
94
|
+
</div>
|
|
95
|
+
</form>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export function ProviderLogo({
|
|
2
2
|
provider,
|
|
3
3
|
}: {
|
|
4
|
-
provider: "github" | "convex" | "expo";
|
|
4
|
+
provider: "github" | "convex" | "expo" | "blacksmith";
|
|
5
5
|
}) {
|
|
6
|
+
if (provider === "blacksmith")
|
|
7
|
+
return (
|
|
8
|
+
<span aria-hidden="true" className="font-mono text-xl font-bold">
|
|
9
|
+
B
|
|
10
|
+
</span>
|
|
11
|
+
);
|
|
6
12
|
if (provider === "github")
|
|
7
13
|
return (
|
|
8
14
|
<svg
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useAction, useMutation, useQuery } from "convex/react";
|
|
3
|
+
import { ConvexError } from "convex/values";
|
|
4
|
+
import { api } from "../../../../../packages/backend/convex/_generated/api";
|
|
5
|
+
|
|
6
|
+
type Provider = "github" | "convex";
|
|
7
|
+
type Installation = { installationId: string; owner: string };
|
|
8
|
+
const pendingKey = "disposabl.pendingConnectionProvider";
|
|
9
|
+
const isProvider = (value: string | null): value is Provider =>
|
|
10
|
+
value === "github" || value === "convex";
|
|
11
|
+
|
|
12
|
+
export function useConnectionSetup() {
|
|
13
|
+
const status = useQuery(api.connections.index.status, {});
|
|
14
|
+
const start = useAction(api.connections.index.start);
|
|
15
|
+
const resumeInstall = useAction(api.connections.index.resumeGithubInstall);
|
|
16
|
+
const confirmBlacksmith = useMutation(
|
|
17
|
+
api.connections.index.confirmBlacksmith,
|
|
18
|
+
);
|
|
19
|
+
const complete = useAction(api.connections.index.complete);
|
|
20
|
+
const selectGithub = useAction(api.connections.index.selectGithub);
|
|
21
|
+
const disconnect = useMutation(api.connections.index.disconnect);
|
|
22
|
+
const [busy, setBusy] = useState(false);
|
|
23
|
+
const [error, setError] = useState<string>();
|
|
24
|
+
const [installations, setInstallations] = useState<Installation[]>([]);
|
|
25
|
+
const [proof, setProof] = useState<string>();
|
|
26
|
+
const [installNeeded, setInstallNeeded] = useState(false);
|
|
27
|
+
const [mobile, setMobile] = useState(false);
|
|
28
|
+
const consumed = useRef(false);
|
|
29
|
+
const fail = (cause: unknown) =>
|
|
30
|
+
setError(
|
|
31
|
+
cause instanceof ConvexError && typeof cause.data === "string"
|
|
32
|
+
? cause.data
|
|
33
|
+
: cause instanceof Error
|
|
34
|
+
? cause.message
|
|
35
|
+
: "Something went wrong. Please try again.",
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (consumed.current) return;
|
|
40
|
+
consumed.current = true;
|
|
41
|
+
const url = new URL(window.location.href);
|
|
42
|
+
const mobileKey = "disposabl.setupMobile";
|
|
43
|
+
if (url.searchParams.has("mobile"))
|
|
44
|
+
sessionStorage.setItem(
|
|
45
|
+
mobileKey,
|
|
46
|
+
url.searchParams.get("mobile") === "1" ? "1" : "0",
|
|
47
|
+
);
|
|
48
|
+
setMobile(sessionStorage.getItem(mobileKey) === "1");
|
|
49
|
+
const queryProvider = url.searchParams.get("provider");
|
|
50
|
+
const pending = sessionStorage.getItem(pendingKey);
|
|
51
|
+
const provider = isProvider(queryProvider)
|
|
52
|
+
? queryProvider
|
|
53
|
+
: isProvider(pending)
|
|
54
|
+
? pending
|
|
55
|
+
: null;
|
|
56
|
+
const code = url.searchParams.get("code");
|
|
57
|
+
const state = url.searchParams.get("state");
|
|
58
|
+
const denial = url.searchParams.get("error");
|
|
59
|
+
const installationReturn =
|
|
60
|
+
url.searchParams.has("installation_id") ||
|
|
61
|
+
url.searchParams.has("setup_action");
|
|
62
|
+
// Remove callback credentials even after a denial or malformed response.
|
|
63
|
+
for (const key of [
|
|
64
|
+
"installation_id",
|
|
65
|
+
"setup_action",
|
|
66
|
+
"state",
|
|
67
|
+
"code",
|
|
68
|
+
"provider",
|
|
69
|
+
"error",
|
|
70
|
+
"error_description",
|
|
71
|
+
])
|
|
72
|
+
url.searchParams.delete(key);
|
|
73
|
+
window.history.replaceState(window.history.state, "", url.toString());
|
|
74
|
+
if (denial) {
|
|
75
|
+
sessionStorage.removeItem(pendingKey);
|
|
76
|
+
setError(
|
|
77
|
+
"Authorization was cancelled. Use the setup button to try again.",
|
|
78
|
+
);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (installationReturn) {
|
|
82
|
+
setBusy(true);
|
|
83
|
+
sessionStorage.setItem(pendingKey, "github");
|
|
84
|
+
void (state ? resumeInstall({ state }) : start({ provider: "github" }))
|
|
85
|
+
.then((next) => window.location.assign(next))
|
|
86
|
+
.catch(fail)
|
|
87
|
+
.finally(() => setBusy(false));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const callback =
|
|
91
|
+
code !== null ||
|
|
92
|
+
state !== null ||
|
|
93
|
+
denial !== null ||
|
|
94
|
+
queryProvider !== null;
|
|
95
|
+
if (!callback) return;
|
|
96
|
+
if (!provider || !code || !state) {
|
|
97
|
+
setError(
|
|
98
|
+
"The authorization response is incomplete. Please connect again to restart authorization.",
|
|
99
|
+
);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
sessionStorage.removeItem(pendingKey);
|
|
103
|
+
setBusy(true);
|
|
104
|
+
void complete({ provider, code, state })
|
|
105
|
+
.then(async (result) => {
|
|
106
|
+
if (provider !== "github") return;
|
|
107
|
+
const installation = result.installations.at(0);
|
|
108
|
+
if (result.installations.length === 1 && installation) {
|
|
109
|
+
if (!result.proof)
|
|
110
|
+
throw new Error(
|
|
111
|
+
"GitHub did not return an account selection proof. Please connect again.",
|
|
112
|
+
);
|
|
113
|
+
await selectGithub({
|
|
114
|
+
proof: result.proof,
|
|
115
|
+
installationId: installation.installationId,
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
setInstallations(result.installations);
|
|
119
|
+
setProof(result.proof);
|
|
120
|
+
setInstallNeeded(result.installations.length === 0);
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
.catch(fail)
|
|
124
|
+
.finally(() => setBusy(false));
|
|
125
|
+
}, [complete, selectGithub, resumeInstall, start]);
|
|
126
|
+
|
|
127
|
+
async function run(action: () => Promise<void>) {
|
|
128
|
+
if (busy) return;
|
|
129
|
+
setBusy(true);
|
|
130
|
+
setError(undefined);
|
|
131
|
+
try {
|
|
132
|
+
await action();
|
|
133
|
+
} catch (cause) {
|
|
134
|
+
fail(cause);
|
|
135
|
+
} finally {
|
|
136
|
+
setBusy(false);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function connect(provider: Provider) {
|
|
140
|
+
void run(async () => {
|
|
141
|
+
const url = await start({ provider, install: provider === "github" });
|
|
142
|
+
sessionStorage.setItem(pendingKey, provider);
|
|
143
|
+
window.location.assign(url);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function chooseOrganization(installationId: string) {
|
|
148
|
+
void run(async () => {
|
|
149
|
+
if (!proof)
|
|
150
|
+
throw new Error("Restart GitHub setup to choose an organization.");
|
|
151
|
+
await selectGithub({ proof, installationId });
|
|
152
|
+
setInstallations([]);
|
|
153
|
+
setProof(undefined);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
status,
|
|
158
|
+
busy,
|
|
159
|
+
error,
|
|
160
|
+
run,
|
|
161
|
+
connect,
|
|
162
|
+
disconnect,
|
|
163
|
+
installations,
|
|
164
|
+
chooseOrganization,
|
|
165
|
+
installNeeded,
|
|
166
|
+
confirmBlacksmith,
|
|
167
|
+
mobile,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -124,7 +124,12 @@ export async function runCli(
|
|
|
124
124
|
if (connectionStatus)
|
|
125
125
|
command.option(
|
|
126
126
|
"--wait",
|
|
127
|
-
"Open
|
|
127
|
+
"Open setup and continue when GitHub, Blacksmith and Convex are ready",
|
|
128
|
+
);
|
|
129
|
+
if (connectionStatus)
|
|
130
|
+
command.option(
|
|
131
|
+
"--mobile",
|
|
132
|
+
"Also wait for Expo when creating a mobile app",
|
|
128
133
|
);
|
|
129
134
|
const deleteApp = path === "/api/apps/delete";
|
|
130
135
|
if (deleteApp)
|
|
@@ -244,14 +249,16 @@ export async function runCli(
|
|
|
244
249
|
`API request failed (${result.status}): ${await result.text()}`,
|
|
245
250
|
);
|
|
246
251
|
let value = await result.json();
|
|
247
|
-
|
|
248
|
-
|
|
252
|
+
const ready = () =>
|
|
253
|
+
value.ready && (!options.mobile || Boolean(value.expo));
|
|
254
|
+
if (connectionStatus && options.wait && !ready()) {
|
|
255
|
+
const url = `${base}/dashboard/connections?mobile=${options.mobile ? "1" : "0"}`;
|
|
249
256
|
console.error(
|
|
250
|
-
`
|
|
257
|
+
`Set up your free GitHub organization, Blacksmith and Convex accounts (plus Expo for mobile):\n${url}\nWaiting for connections. Press Ctrl+C to keep your files and finish later.`,
|
|
251
258
|
);
|
|
252
259
|
openUrl(url);
|
|
253
260
|
const deadline = Date.now() + 15 * 60_000;
|
|
254
|
-
while (!
|
|
261
|
+
while (!ready() && Date.now() < deadline) {
|
|
255
262
|
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
256
263
|
result = await send();
|
|
257
264
|
if (result.status === 401 && !process.env.DISPOSABL_API_KEY)
|
|
@@ -262,7 +269,7 @@ export async function runCli(
|
|
|
262
269
|
);
|
|
263
270
|
value = await result.json();
|
|
264
271
|
}
|
|
265
|
-
if (!
|
|
272
|
+
if (!ready())
|
|
266
273
|
throw new Error(
|
|
267
274
|
`Connections are still incomplete. Finish at ${url}, then retry setup.`,
|
|
268
275
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import { createFileRoute,
|
|
2
|
+
import { createFileRoute, Navigate } from "@tanstack/react-router";
|
|
3
3
|
import { useAction, useConvexAuth, useQuery } from "convex/react";
|
|
4
4
|
import { api } from "../../../backend/convex/_generated/api";
|
|
5
5
|
import { Button } from "../components/ui/button";
|
|
@@ -117,13 +117,7 @@ export function ConsentPage() {
|
|
|
117
117
|
)}
|
|
118
118
|
</div>
|
|
119
119
|
) : (
|
|
120
|
-
<
|
|
121
|
-
to="/login"
|
|
122
|
-
search={{ request: requestId }}
|
|
123
|
-
className="font-medium underline underline-offset-4"
|
|
124
|
-
>
|
|
125
|
-
Log in to review this request
|
|
126
|
-
</Link>
|
|
120
|
+
<Navigate to="/signup" search={{ request: requestId }} replace />
|
|
127
121
|
)}
|
|
128
122
|
</>
|
|
129
123
|
);
|
|
@@ -18,7 +18,7 @@ bun create disposabl-app@latest --list-options
|
|
|
18
18
|
bun create disposabl-app@latest my-app --platforms web,android,mcp --features authentication --yes
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Use the requested platforms and features. Creation handles Disposabl login, required GitHub/Convex
|
|
21
|
+
Use the requested platforms and features. Creation handles Disposabl login, required GitHub organization/Blacksmith/Convex setup, and the app's scoped development environment. Resume interrupted setup in the same directory. Do not create a replacement Convex project or delete an app unless requested. Never print credentials.
|
|
22
22
|
|
|
23
23
|
The CLI is bundled with `create-disposabl-app`; do not use the retired `@disposabl/cli` package. Commands below use the published CLI and work without a global install:
|
|
24
24
|
|
|
@@ -70,3 +70,20 @@ Verify the requested behavior, authentication, and saved data after relaunch on
|
|
|
70
70
|
Only when requested, run `disposabl apps delete --appId <uuid> --dangerously-delete-app`. Apps with production releases cannot be deleted.
|
|
71
71
|
|
|
72
72
|
If the response is `expo_manual_delete_required`, GitHub/Convex cleanup has completed but Expo cleanup remains. Open the exact returned `projectUrl`; never substitute a generic dashboard. The user completes Expo sign-in or reauthentication directly. Do not collect passwords or session cookies. Retry the deletion command afterward and report full deletion only when Disposabl confirms it. `--no-browser` prints the URL for headless callers.
|
|
73
|
+
|
|
74
|
+
## Account setup
|
|
75
|
+
|
|
76
|
+
All provider accounts are free to create; builds and hosting have usage limits.
|
|
77
|
+
Use one GitHub step to install Disposabl and finish authorization. Blacksmith
|
|
78
|
+
requires an organization, even for a solo user. Recommend one new, dedicated
|
|
79
|
+
organization for all of the user's Disposabl apps, and reuse it for future apps.
|
|
80
|
+
Keep an existing organization as an alternative. Explain that it is a free workspace, open https://github.com/organizations/plan when
|
|
81
|
+
browser setup is requested, and guide them through the Free plan. Do not convert
|
|
82
|
+
their personal account or report a missing organization as a failed connection.
|
|
83
|
+
Then install Blacksmith in that same organization with All repositories access so new app repositories can build,
|
|
84
|
+
and connect Convex. Expo is required for mobile apps. Blacksmith's 3,000 free
|
|
85
|
+
monthly minutes are equivalent Linux 2-vCPU minutes; other runners consume more.
|
|
86
|
+
Blacksmith installation is user-confirmed until a build proves runner access.
|
|
87
|
+
Your code and app data stay in your accounts; Disposabl stores encrypted
|
|
88
|
+
connection credentials and setup metadata. Link the open-source repository
|
|
89
|
+
when explaining access: https://github.com/disposabl-dev/create-disposabl-app.
|