create-disposabl-app 0.8.8 → 0.8.10
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 +5 -3
- package/dist/disposabl.js +42 -42
- package/dist/index.js +14 -14
- package/dist/templates/default/bun.lock +28484 -5329
- package/dist/templates/default/dev.ts +1 -8
- package/dist/templates/default/packages/backend/convex/apps/actions/cleanup.ts +32 -11
- package/dist/templates/default/packages/backend/convex/apps/actions/expo.ts +15 -9
- package/dist/templates/default/packages/backend/convex/apps/operations/internal.ts +26 -0
- package/dist/templates/default/packages/backend/convex/schema.ts +1 -0
- package/dist/templates/default/packages/cli/README.md +5 -1
- package/dist/templates/default/packages/cli/commands.ts +15 -8
- package/dist/templates/default/packages/cli/delete.ts +40 -31
- package/dist/templates/default/packages/skill/SKILL.md +10 -2
- package/dist/templates/default/turbo.json +71 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@ its access checks remain installed.
|
|
|
15
15
|
Releases publish automatically after changes reach `main`. Commit messages
|
|
16
16
|
determine the next version; no manual version edit is needed.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Every creation checks your Disposabl login and asks you to sign in through `disposabl login` if needed. It then creates the app, saves its UUID in `disposabl.json`, and configures a named development preview. There is no setup option. `--yes`, `--json`, and `--skip-install` still require login and app creation. The service is `https://www.disposabl.dev`.
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
|
-
bun create disposabl-app@latest my-app
|
|
21
|
+
bun create disposabl-app@latest my-app
|
|
22
22
|
cd my-app
|
|
23
23
|
bun run dev
|
|
24
24
|
```
|
|
@@ -29,4 +29,6 @@ The website opens automatically and Metro starts with development-client support
|
|
|
29
29
|
|
|
30
30
|
To get another development key in a worktree, run `disposabl previews token create --configure .`. The branch is detected automatically, or the worktree name when detached. Repeated requests reuse the preview and issue a new key.
|
|
31
31
|
|
|
32
|
-
If
|
|
32
|
+
If app creation is interrupted, rerun `bun create disposabl-app@latest my-app` from the parent directory. It resumes setup using the existing files and app UUID.
|
|
33
|
+
|
|
34
|
+
Generated apps do not include the `create-disposabl-app` package, its workspace lockfile entry, or its Turbo build task. The generator and bundled Disposabl CLI run externally.
|
package/dist/disposabl.js
CHANGED
|
@@ -1,40 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// ../cli/delete.ts
|
|
4
|
-
import { spawn } from "node:child_process";
|
|
5
|
-
async function completeExpoDeletion(projectId) {
|
|
6
|
-
if (typeof projectId !== "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(projectId))
|
|
7
|
-
throw new Error("The service returned an invalid Expo project ID.");
|
|
8
|
-
const command = `bunx eas-cli@27.2.0 project:delete ${projectId}`;
|
|
9
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY)
|
|
10
|
-
throw new Error(`Expo needs an interactive login and password confirmation. Run ${command}, then retry apps delete. Your app and remaining resources are retained.`);
|
|
11
|
-
console.error("Expo requires you to confirm deletion in your Expo account. Complete the following EAS prompts to continue.");
|
|
12
|
-
const { EXPO_TOKEN: _token, ...env } = process.env;
|
|
13
|
-
await new Promise((resolve, reject) => {
|
|
14
|
-
const child = spawn("bunx", ["eas-cli@27.2.0", "project:delete", projectId], { stdio: "inherit", env });
|
|
15
|
-
child.on("error", reject);
|
|
16
|
-
child.on("exit", (code) => code === 0 ? resolve() : reject(new Error("Expo deletion was not completed. Retry apps delete when ready.")));
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
3
|
// ../cli/commands.ts
|
|
21
4
|
import { Command } from "commander";
|
|
22
|
-
// ../cli/package.json
|
|
23
|
-
var package_default = {
|
|
24
|
-
name: "@disposabl/cli",
|
|
25
|
-
version: "0.8.8",
|
|
26
|
-
type: "module",
|
|
27
|
-
description: "Command-line access to your Disposabl app",
|
|
28
|
-
license: "MIT",
|
|
29
|
-
bin: { disposabl: "dist/index.js" },
|
|
30
|
-
files: ["dist", "README.md"],
|
|
31
|
-
engines: { node: ">=22.12.0" },
|
|
32
|
-
publishConfig: { access: "public" },
|
|
33
|
-
scripts: { build: "bun build.ts", typecheck: "bun check", lint: "bun check", release: "semantic-release" },
|
|
34
|
-
dependencies: { "@modelcontextprotocol/sdk": "1.32.2", commander: "15.0.0", "proper-lockfile": "4.1.2" },
|
|
35
|
-
devDependencies: { "@types/bun": "1.4.4", typescript: "6.0.3", "@types/proper-lockfile": "4.1.4", "semantic-release": "25.0.9", "@semantic-release/exec": "7.1.0", "conventional-changelog-conventionalcommits": "9.3.1" },
|
|
36
|
-
repository: { type: "git", url: "git+https://github.com/disposabl-dev/create-disposabl-app.git", directory: "packages/cli" }
|
|
37
|
-
};
|
|
38
5
|
|
|
39
6
|
// ../cli/auth.ts
|
|
40
7
|
import { lock } from "proper-lockfile";
|
|
@@ -53,11 +20,11 @@ import {
|
|
|
53
20
|
} from "node:fs/promises";
|
|
54
21
|
import { homedir } from "node:os";
|
|
55
22
|
import { join } from "node:path";
|
|
56
|
-
import { spawn
|
|
23
|
+
import { spawn } from "node:child_process";
|
|
57
24
|
function openUrl(url) {
|
|
58
25
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32" : "xdg-open";
|
|
59
26
|
const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url] : [url];
|
|
60
|
-
const child =
|
|
27
|
+
const child = spawn(command, args, { stdio: "ignore" });
|
|
61
28
|
child.on("error", () => console.error("Open the URL manually."));
|
|
62
29
|
child.unref();
|
|
63
30
|
}
|
|
@@ -266,6 +233,42 @@ var accessToken = (url, refresh = false) => withCredentials(url, () => unlockedA
|
|
|
266
233
|
var logout = (url) => withCredentials(url, () => unlockedLogout(url));
|
|
267
234
|
var hasCredentials = async (url) => Boolean(process.env.DISPOSABL_API_KEY || (await load(url)).tokens?.access_token);
|
|
268
235
|
|
|
236
|
+
// ../cli/delete.ts
|
|
237
|
+
function openExpoDeletion(body, appId, browser) {
|
|
238
|
+
if (!body || typeof body !== "object" || !("error" in body))
|
|
239
|
+
return;
|
|
240
|
+
const error = body.error;
|
|
241
|
+
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "expo_manual_delete_required")
|
|
242
|
+
return;
|
|
243
|
+
if (!("appId" in error) || error.appId !== appId || !("projectUrl" in error) || typeof error.projectUrl !== "string")
|
|
244
|
+
throw new Error("Invalid Expo deletion response. The app record has been kept.");
|
|
245
|
+
const url = new URL(error.projectUrl);
|
|
246
|
+
const parts = url.pathname.split("/");
|
|
247
|
+
if (url.origin !== "https://expo.dev" || url.username || url.password || url.search || url.hash || parts.length !== 7 || parts[1] !== "accounts" || !parts[2] || parts[3] !== "projects" || parts[4] !== `app-${appId}` || parts[5] !== "settings" || parts[6] !== "advanced")
|
|
248
|
+
throw new Error("Invalid Expo project URL. The app record has been kept.");
|
|
249
|
+
console.error(`GitHub and Convex cleanup is complete. Finish deleting the Expo project here:
|
|
250
|
+
${url.href}
|
|
251
|
+
Sign in to Expo if needed and choose Delete project. Then rerun this command to verify cleanup. The Disposabl app record is still pending deletion.`);
|
|
252
|
+
if (browser)
|
|
253
|
+
openUrl(url.href);
|
|
254
|
+
}
|
|
255
|
+
// ../cli/package.json
|
|
256
|
+
var package_default = {
|
|
257
|
+
name: "@disposabl/cli",
|
|
258
|
+
version: "0.8.10",
|
|
259
|
+
type: "module",
|
|
260
|
+
description: "Command-line access to your Disposabl app",
|
|
261
|
+
license: "MIT",
|
|
262
|
+
bin: { disposabl: "dist/index.js" },
|
|
263
|
+
files: ["dist", "README.md"],
|
|
264
|
+
engines: { node: ">=22.12.0" },
|
|
265
|
+
publishConfig: { access: "public" },
|
|
266
|
+
scripts: { build: "bun build.ts", typecheck: "bun check", lint: "bun check", release: "semantic-release" },
|
|
267
|
+
dependencies: { "@modelcontextprotocol/sdk": "1.32.2", commander: "15.0.0", "proper-lockfile": "4.1.2" },
|
|
268
|
+
devDependencies: { "@types/bun": "1.4.4", typescript: "6.0.3", "@types/proper-lockfile": "4.1.4", "semantic-release": "25.0.9", "@semantic-release/exec": "7.1.0", "conventional-changelog-conventionalcommits": "9.3.1" },
|
|
269
|
+
repository: { type: "git", url: "git+https://github.com/disposabl-dev/create-disposabl-app.git", directory: "packages/cli" }
|
|
270
|
+
};
|
|
271
|
+
|
|
269
272
|
// ../cli/commands.ts
|
|
270
273
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
271
274
|
import { join as join3 } from "node:path";
|
|
@@ -493,6 +496,8 @@ async function runCli(argv = process.argv, serviceOrigin = SERVICE_ORIGIN) {
|
|
|
493
496
|
if (connectionStatus)
|
|
494
497
|
command.option("--wait", "Open Connections and continue when GitHub and Convex are connected");
|
|
495
498
|
const deleteApp = path === "/api/apps/delete";
|
|
499
|
+
if (deleteApp)
|
|
500
|
+
command.option("--no-browser", "Print the Expo cleanup URL without opening a browser");
|
|
496
501
|
const previewGet = path === "/api/previews/get";
|
|
497
502
|
const tokenCreate = path === "/api/previews/token/create";
|
|
498
503
|
if (previewGet)
|
|
@@ -554,13 +559,8 @@ async function runCli(argv = process.argv, serviceOrigin = SERVICE_ORIGIN) {
|
|
|
554
559
|
let result = await send();
|
|
555
560
|
if (result.status === 401 && !process.env.DISPOSABL_API_KEY)
|
|
556
561
|
result = await send(true);
|
|
557
|
-
if (deleteApp && result.
|
|
558
|
-
|
|
559
|
-
if (body.error?.code === "expo_delete_requires_login") {
|
|
560
|
-
await completeExpoDeletion(body.error.projectId);
|
|
561
|
-
result = await send();
|
|
562
|
-
}
|
|
563
|
-
}
|
|
562
|
+
if (deleteApp && !result.ok)
|
|
563
|
+
openExpoDeletion(await result.clone().json().catch(() => null), options.appId, options.browser !== false);
|
|
564
564
|
if (!result.ok)
|
|
565
565
|
throw new Error(`API request failed (${result.status}): ${await result.text()}`);
|
|
566
566
|
let value = await result.json();
|
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
|
+
var version = "0.8.10";
|
|
12
12
|
|
|
13
13
|
// ../disposabl-kit/platforms.ts
|
|
14
14
|
var platforms = [
|
|
@@ -476,7 +476,7 @@ main().catch((error) => {
|
|
|
476
476
|
// setup.ts
|
|
477
477
|
import { execFileSync, spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
478
478
|
import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
479
|
-
import { join as join3 } from "node:path";
|
|
479
|
+
import { basename as basename3, join as join3 } from "node:path";
|
|
480
480
|
import { fileURLToPath } from "node:url";
|
|
481
481
|
|
|
482
482
|
// ../cli/preview.ts
|
|
@@ -508,7 +508,7 @@ var runDisposabl = (args, interactive = false) => new Promise((resolve, reject)
|
|
|
508
508
|
child.once("error", reject);
|
|
509
509
|
child.once("close", (code) => {
|
|
510
510
|
if (code !== 0) {
|
|
511
|
-
reject(new Error(`disposabl ${args.slice(0, 3).join(" ")} failed. Your files are saved. Retry from the parent directory: bun create disposabl-app@latest <app-directory
|
|
511
|
+
reject(new Error(`disposabl ${args.slice(0, 3).join(" ")} failed. Your files are saved. Retry from the parent directory: bun create disposabl-app@latest <app-directory>`));
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
514
|
try {
|
|
@@ -529,7 +529,7 @@ async function setupApp(directory, name, run = runDisposabl) {
|
|
|
529
529
|
}
|
|
530
530
|
const connections = await run(["connections", "status", "--wait"]);
|
|
531
531
|
if (!connections.ready)
|
|
532
|
-
throw new Error("Connect GitHub and Convex at https://www.disposabl.dev/dashboard/connections, then retry: bun create disposabl-app@latest " + directory + "
|
|
532
|
+
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.");
|
|
533
533
|
const path = join3(directory, "disposabl.json");
|
|
534
534
|
const config = JSON.parse(await readFile2(path, "utf8"));
|
|
535
535
|
if (config.appId) {
|
|
@@ -610,7 +610,7 @@ function commitApp(directory) {
|
|
|
610
610
|
|
|
611
611
|
// index.ts
|
|
612
612
|
var jsonOutput = process.argv.slice(2).includes("--json");
|
|
613
|
-
var program = new Command("create-disposabl-app").description("Create a Disposabl starter. Web is always included.").version(version, "-v, --version").argument("[appname]", "App name and new directory").option("--platforms <ids>", "Comma-separated platform IDs; Web is always included").option("--features <ids>", "Comma-separated feature IDs, or none (default: authentication)").option("-y, --yes", "Skip prompts; include Web and authentication by default").option("--
|
|
613
|
+
var program = new Command("create-disposabl-app").description("Create a Disposabl starter. Web is always included.").version(version, "-v, --version").argument("[appname]", "App name and new directory").option("--platforms <ids>", "Comma-separated platform IDs; Web is always included").option("--features <ids>", "Comma-separated feature IDs, or none (default: authentication)").option("-y, --yes", "Skip app options prompts; include Web and authentication by default").option("--skip-install", "Create files without running bun install").option("--list-options", "List every platform and feature, including disabled choices").option("--json", "Skip app options prompts and emit JSON; login and install logs go to stderr").helpOption("-h, --help").addHelpText("after", `
|
|
614
614
|
Platforms:
|
|
615
615
|
web (required), android, ios, macos, windows, linux, api, mcp, cli, typescript-sdk
|
|
616
616
|
CLI and TypeScript SDK automatically include API.
|
|
@@ -626,9 +626,9 @@ Examples:
|
|
|
626
626
|
bun create disposabl-app@latest my-app --platforms web --features none --skip-install --json
|
|
627
627
|
bun create disposabl-app@latest --list-options --json
|
|
628
628
|
|
|
629
|
-
Without a TTY,
|
|
629
|
+
Without a TTY, supply an app name. App options are not prompted, but login is still required.
|
|
630
630
|
Platform and feature choices are saved in disposabl.json.
|
|
631
|
-
Backend authentication code is always included.
|
|
631
|
+
Backend authentication code is always included. Every app checks your Disposabl login, asks you to sign in if needed, and creates an app UUID and development environment through https://www.disposabl.dev. Rerun the same command to resume an existing app.
|
|
632
632
|
`).configureOutput({ writeErr: () => {} }).exitOverride();
|
|
633
633
|
|
|
634
634
|
class Cancelled extends Error {
|
|
@@ -700,8 +700,13 @@ async function main() {
|
|
|
700
700
|
if (invalidName)
|
|
701
701
|
throw new Error(invalidName);
|
|
702
702
|
let directory = resolve2(name);
|
|
703
|
-
if (
|
|
703
|
+
if (pathExists(join4(directory, "disposabl.json"))) {
|
|
704
704
|
const appId = await setupApp(directory, name);
|
|
705
|
+
if (spawnSync3("git", ["rev-parse", "--verify", "HEAD"], {
|
|
706
|
+
cwd: directory,
|
|
707
|
+
stdio: "ignore"
|
|
708
|
+
}).status !== 0)
|
|
709
|
+
commitApp(directory);
|
|
705
710
|
console.log(options.json ? JSON.stringify({ status: "configured", directory, appId }) : `
|
|
706
711
|
Setup complete.
|
|
707
712
|
|
|
@@ -745,10 +750,6 @@ Setup complete.
|
|
|
745
750
|
}));
|
|
746
751
|
chosenFeatures = selectFeatures(selected.length ? selected.join(",") : "none");
|
|
747
752
|
}
|
|
748
|
-
const managedSetup = options.setup ?? (interactive && answer(await p2.confirm({
|
|
749
|
-
message: "Set up this app with Disposabl?",
|
|
750
|
-
initialValue: false
|
|
751
|
-
})));
|
|
752
753
|
const config = {
|
|
753
754
|
version,
|
|
754
755
|
platforms: chosenPlatforms,
|
|
@@ -784,8 +785,7 @@ Setup complete.
|
|
|
784
785
|
cwd: directory,
|
|
785
786
|
stdio: "pipe"
|
|
786
787
|
});
|
|
787
|
-
|
|
788
|
-
config.appId = await setupApp(directory, name);
|
|
788
|
+
config.appId = await setupApp(directory, name);
|
|
789
789
|
commitApp(directory);
|
|
790
790
|
const folders = selectedFolders(config);
|
|
791
791
|
if (options.json) {
|