create-disposabl-app 0.4.2 → 0.6.0
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 +18 -0
- package/dist/disposabl.js +541 -0
- package/dist/index.js +154 -61
- package/dist/templates/default/.github/scripts/android-build.sh +18 -0
- package/dist/templates/default/.github/scripts/disposabl.mjs +95 -0
- package/dist/templates/default/.github/scripts/expo-channel.sh +10 -0
- package/dist/templates/default/.github/scripts/expo-env.sh +17 -0
- package/dist/templates/default/.github/scripts/expo-fingerprint.sh +19 -0
- package/dist/templates/default/.github/scripts/expo-update.sh +11 -0
- package/dist/templates/default/.github/scripts/package-release.sh +23 -0
- package/dist/templates/default/.github/scripts/platforms.sh +37 -0
- package/dist/templates/default/.github/scripts/release-publish.sh +28 -0
- package/dist/templates/default/.github/scripts/release-source.sh +14 -0
- package/dist/templates/default/.github/scripts/verify-artifacts.sh +13 -0
- package/dist/templates/default/.github/scripts/web-deploy.sh +10 -0
- package/dist/templates/default/.github/workflows/pipeline.yml +299 -0
- package/dist/templates/default/apps/docs/README.md +37 -0
- package/dist/templates/default/apps/docs/content/guides/writing.mdx +15 -0
- package/dist/templates/default/apps/docs/content/index.mdx +10 -0
- package/dist/templates/default/apps/docs/package.json +29 -1
- package/dist/templates/default/apps/docs/press.config.ts +20 -0
- package/dist/templates/default/apps/docs/src/app.css +4 -0
- package/dist/templates/default/apps/docs/tsconfig.json +14 -0
- package/dist/templates/default/apps/docs/vite.config.ts +8 -0
- package/dist/templates/default/apps/mobile/.env.example +2 -0
- package/dist/templates/default/apps/mobile/AGENTS.md +2 -2
- package/dist/templates/default/apps/mobile/README.md +64 -4
- package/dist/templates/default/apps/mobile/app.json +5 -4
- package/dist/templates/default/apps/mobile/assets/images/android-icon-foreground.png +0 -0
- package/dist/templates/default/apps/mobile/assets/images/android-icon-monochrome.png +0 -0
- package/dist/templates/default/apps/mobile/assets/images/icon.png +0 -0
- package/dist/templates/default/apps/mobile/assets/images/splash-icon.png +0 -0
- package/dist/templates/default/apps/mobile/eas.json +5 -0
- package/dist/templates/default/apps/mobile/package.json +18 -4
- package/dist/templates/default/apps/mobile/src/app/(auth)/_layout.tsx +1 -0
- package/dist/templates/default/apps/mobile/src/app/(auth)/login.tsx +1 -0
- package/dist/templates/default/apps/mobile/src/app/(auth)/signup.tsx +1 -0
- package/dist/templates/default/apps/mobile/src/app/(authenticated)/_layout.tsx +1 -0
- package/dist/templates/default/apps/mobile/src/app/(authenticated)/account.tsx +1 -0
- package/dist/templates/default/apps/mobile/src/app/_layout.tsx +1 -5
- package/dist/templates/default/apps/mobile/src/app/index.tsx +1 -17
- package/dist/templates/default/apps/mobile/tsconfig.json +8 -1
- package/dist/templates/default/apps/web/package.json +3 -2
- package/dist/templates/default/apps/web/src/routeTree.gen.ts +0 -44
- package/dist/templates/default/apps/web/src/router/__root.tsx +1 -1
- package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.api-keys.tsx +1 -1
- package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.tsx +2 -1
- package/dist/templates/default/apps/web/src/router/index.tsx +11 -3
- package/dist/templates/default/apps/web/tests/auth-branches.test.tsx +44 -0
- package/dist/templates/default/apps/web/vite.config.ts +15 -0
- package/dist/templates/default/bun.lock +583 -23
- package/dist/templates/default/bunfig.toml +0 -2
- package/dist/templates/default/disposabl.json +2 -13
- package/dist/templates/default/package.json +3 -3
- package/dist/templates/default/packages/backend/AGENTS.md +15 -13
- package/dist/templates/default/packages/backend/README.md +6 -28
- package/dist/templates/default/packages/backend/convex/_generated/ai/ai-files.state.json +1 -1
- package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +32 -6
- package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +8 -0
- package/dist/templates/default/packages/backend/convex/apps/actions/create.ts +19 -0
- package/dist/templates/default/packages/backend/convex/apps/internal.ts +197 -0
- package/dist/templates/default/packages/backend/convex/auth.ts +1 -1
- package/dist/templates/default/packages/backend/convex/convex.config.ts +8 -0
- package/dist/templates/default/packages/backend/convex/github/actions/http.ts +40 -0
- package/dist/templates/default/packages/backend/convex/github/actions/internal.ts +189 -0
- package/dist/templates/default/packages/backend/convex/github/actions/oidc.ts +75 -0
- package/dist/templates/default/packages/backend/convex/github/actions/provision.ts +80 -0
- package/dist/templates/default/packages/backend/convex/github/actions/tokens.ts +66 -0
- package/dist/templates/default/packages/backend/convex/github/internal.ts +34 -0
- package/dist/templates/default/packages/backend/convex/http.ts +3 -0
- package/dist/templates/default/packages/backend/convex/previews/internal.ts +270 -0
- package/dist/templates/default/packages/backend/convex/previews/token/actions/create.ts +69 -0
- package/dist/templates/default/packages/backend/convex/previews/token/actions/management.ts +133 -0
- package/dist/templates/default/packages/backend/convex/previews/token/internal.ts +1 -0
- package/dist/templates/default/packages/backend/convex/releases/internal.ts +28 -0
- package/dist/templates/default/packages/backend/convex/schema.ts +34 -4
- package/dist/templates/default/packages/backend/convex/users/index.ts +21 -0
- package/dist/templates/default/packages/backend/convex/users/internal.ts +44 -0
- package/dist/templates/default/packages/backend/convex/validator.ts +87 -0
- package/dist/templates/default/packages/backend/generate.ts +6 -1
- package/dist/templates/default/packages/backend/generated/openapi.json +961 -43
- package/dist/templates/default/packages/backend/generated/pages.json +0 -8
- package/dist/templates/default/packages/backend/generated/platforms.ts +14 -2
- package/dist/templates/default/packages/backend/package.json +1 -1
- package/dist/templates/default/packages/cli/README.md +15 -9
- package/dist/templates/default/packages/cli/auth.ts +11 -3
- package/dist/templates/default/packages/cli/commands.ts +236 -0
- package/dist/templates/default/packages/cli/index.ts +2 -142
- package/dist/templates/default/packages/cli/preview.ts +157 -0
- package/dist/templates/default/packages/disposabl-kit/client/components/ui/log-out.tsx +16 -0
- package/dist/templates/default/packages/disposabl-kit/client/lib/prerender.ts +6 -3
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +1 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +1 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/_authenticated/route.tsx +25 -16
- package/dist/templates/default/packages/disposabl-kit/client/routes/consent.tsx +3 -2
- package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +57 -2
- package/dist/templates/default/packages/disposabl-kit/client/vite.config.ts +20 -9
- package/dist/templates/default/packages/disposabl-kit/eslint.config.js +1 -1
- package/dist/templates/default/packages/disposabl-kit/features.ts +4 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-form.tsx +125 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/components/auth-ui.tsx +107 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/expo-plugin.cjs +26 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/index.ts +10 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/layout.tsx +101 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/auth-errors.ts +40 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/auth-storage.ts +9 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/convex.ts +1 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/lib/logo.png +0 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/account.tsx +67 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/home.tsx +65 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/login.tsx +5 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/screens/signup.tsx +5 -0
- package/dist/templates/default/packages/disposabl-kit/package.json +24 -1
- package/dist/templates/default/packages/disposabl-kit/platforms.ts +1 -27
- package/dist/templates/default/packages/disposabl-kit/server/http.ts +6 -0
- package/dist/templates/default/packages/disposabl-kit/server/lib/docs.test.ts +111 -0
- package/dist/templates/default/packages/disposabl-kit/server/lib/docs.ts +62 -0
- package/dist/templates/default/packages/disposabl-kit/tsconfig.json +1 -1
- package/dist/templates/default/packages/sdk/README.md +8 -4
- package/dist/templates/default/packages/sdk/src/config.ts +14 -7
- package/dist/templates/default/packages/sdk/src/generated/index.ts +48 -13
- package/dist/templates/default/packages/sdk/src/generated/sdk.gen.ts +139 -27
- package/dist/templates/default/packages/sdk/src/generated/types.gen.ts +440 -37
- package/dist/templates/default/turbo.json +7 -0
- package/package.json +6 -3
- package/dist/templates/default/.github/README.md +0 -99
- package/dist/templates/default/.github/actionlint.yaml +0 -6
- package/dist/templates/default/.github/workflows/pipeline.yml.example +0 -546
- package/dist/templates/default/apps/blog/package.json +0 -1
- package/dist/templates/default/apps/changelog/package.json +0 -1
- package/dist/templates/default/apps/desktop/.oxfmtrc.json +0 -5
- package/dist/templates/default/apps/desktop/.oxlintrc.json +0 -6
- package/dist/templates/default/apps/desktop/README.md +0 -88
- package/dist/templates/default/apps/desktop/build-ci.mjs +0 -56
- package/dist/templates/default/apps/desktop/forge.config.mts +0 -109
- package/dist/templates/default/apps/desktop/index.html +0 -12
- package/dist/templates/default/apps/desktop/package.json +0 -55
- package/dist/templates/default/apps/desktop/src/declarations.d.ts +0 -2
- package/dist/templates/default/apps/desktop/src/index.css +0 -8
- package/dist/templates/default/apps/desktop/src/main.ts +0 -58
- package/dist/templates/default/apps/desktop/src/preload.ts +0 -3
- package/dist/templates/default/apps/desktop/src/renderer.ts +0 -19
- package/dist/templates/default/apps/desktop/tsconfig.json +0 -14
- package/dist/templates/default/apps/desktop/vite.main.config.mts +0 -4
- package/dist/templates/default/apps/desktop/vite.preload.config.mts +0 -4
- package/dist/templates/default/apps/desktop/vite.renderer.config.mts +0 -4
- package/dist/templates/default/apps/web/src/router/_authenticated/todos/$id.tsx +0 -27
- package/dist/templates/default/apps/web/src/router/_authenticated/todos/index.tsx +0 -33
- package/dist/templates/default/packages/backend/convex/todos/index.ts +0 -26
- package/dist/templates/default/packages/backend/convex/todos/internal.ts +0 -43
- package/dist/templates/default/packages/backend/convex/users.ts +0 -20
package/dist/index.js
CHANGED
|
@@ -1,52 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// index.ts
|
|
4
|
-
import { execFileSync, spawn, spawnSync } from "node:child_process";
|
|
4
|
+
import { execFileSync, spawn as spawn2, spawnSync } from "node:child_process";
|
|
5
5
|
import { lstatSync } from "node:fs";
|
|
6
6
|
import { resolve } from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
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.6.0";
|
|
12
12
|
|
|
13
13
|
// ../disposabl-kit/platforms.ts
|
|
14
14
|
var platforms = [
|
|
15
15
|
{ id: "web", label: "Web", group: "Required", status: "required" },
|
|
16
16
|
{ id: "android", label: "Android", group: "Mobile", status: "available" },
|
|
17
17
|
{ id: "ios", label: "iOS", group: "Mobile", status: "available" },
|
|
18
|
-
{ id: "windows", label: "Windows", group: "Desktop", status: "available" },
|
|
19
|
-
{ id: "linux", label: "Linux", group: "Desktop", status: "available" },
|
|
20
|
-
{ id: "macos", label: "macOS", group: "Desktop", status: "available" },
|
|
21
18
|
{
|
|
22
19
|
id: "mcp",
|
|
23
20
|
label: "MCP",
|
|
24
|
-
group: "
|
|
21
|
+
group: "Developer tools",
|
|
25
22
|
status: "available",
|
|
26
23
|
description: "Tools for AI assistants"
|
|
27
24
|
},
|
|
28
|
-
{
|
|
29
|
-
id: "openai-plugin",
|
|
30
|
-
label: "OpenAI Plugin",
|
|
31
|
-
description: "Tools and skills for OpenAI",
|
|
32
|
-
group: "MCP & plugins",
|
|
33
|
-
status: "available"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: "claude-code-plugin",
|
|
37
|
-
label: "Claude Code Plugin",
|
|
38
|
-
description: "Tools and skills for Claude Code",
|
|
39
|
-
group: "MCP & plugins",
|
|
40
|
-
status: "available"
|
|
41
|
-
},
|
|
42
25
|
{ id: "api", label: "API", group: "Developer tools", status: "available" },
|
|
43
26
|
{ id: "cli", label: "CLI", group: "Developer tools", status: "available" },
|
|
44
|
-
{
|
|
45
|
-
id: "python-sdk",
|
|
46
|
-
label: "Python SDK",
|
|
47
|
-
group: "Coming soon",
|
|
48
|
-
status: "disabled"
|
|
49
|
-
},
|
|
50
27
|
{
|
|
51
28
|
id: "typescript-sdk",
|
|
52
29
|
label: "TypeScript SDK",
|
|
@@ -57,10 +34,7 @@ var platforms = [
|
|
|
57
34
|
var platformIds = platforms.map(({ id }) => id);
|
|
58
35
|
var requiredPlatform = "web";
|
|
59
36
|
var platformDependencies = {
|
|
60
|
-
"openai-plugin": ["mcp"],
|
|
61
|
-
"claude-code-plugin": ["mcp"],
|
|
62
37
|
cli: ["api"],
|
|
63
|
-
"python-sdk": ["api"],
|
|
64
38
|
"typescript-sdk": ["api"]
|
|
65
39
|
};
|
|
66
40
|
function isPlatform(value) {
|
|
@@ -83,15 +57,13 @@ function resolvePlatforms(values) {
|
|
|
83
57
|
// options.ts
|
|
84
58
|
var features = [
|
|
85
59
|
{ id: "docs", label: "Docs", hint: "apps/docs" },
|
|
86
|
-
{ id: "blog", label: "Blog", hint: "apps/blog" },
|
|
87
|
-
{ id: "changelog", label: "Changelog", hint: "apps/changelog" },
|
|
88
60
|
{
|
|
89
61
|
id: "authentication",
|
|
90
62
|
label: "Authentication",
|
|
91
|
-
hint: "
|
|
63
|
+
hint: "Frontend sign-in and sign-up"
|
|
92
64
|
}
|
|
93
65
|
];
|
|
94
|
-
var requiredFeatures = [
|
|
66
|
+
var requiredFeatures = [];
|
|
95
67
|
var parseList = (input) => input.split(",").map((value) => value.trim());
|
|
96
68
|
function selectPlatforms(input = "web") {
|
|
97
69
|
const requested = parseList(input);
|
|
@@ -99,19 +71,17 @@ function selectPlatforms(input = "web") {
|
|
|
99
71
|
const option = platforms.find((platform) => platform.id === id);
|
|
100
72
|
if (!option)
|
|
101
73
|
throw new Error("Unknown platform " + JSON.stringify(id) + ". Use --list-options to see valid IDs.");
|
|
102
|
-
if (option.status === "disabled")
|
|
103
|
-
throw new Error(option.label + " is not available yet and cannot be selected.");
|
|
104
74
|
}
|
|
105
75
|
return resolvePlatforms(requested);
|
|
106
76
|
}
|
|
107
|
-
function selectFeatures(input = "
|
|
77
|
+
function selectFeatures(input = "authentication") {
|
|
108
78
|
const requested = input === "none" ? [] : parseList(input);
|
|
109
79
|
for (const id of requested) {
|
|
110
80
|
if (!features.some((feature) => feature.id === id)) {
|
|
111
81
|
throw new Error("Unknown feature " + JSON.stringify(id) + ". Use --features none or --list-options to see valid IDs.");
|
|
112
82
|
}
|
|
113
83
|
}
|
|
114
|
-
return features.filter((option) =>
|
|
84
|
+
return features.filter((option) => requested.includes(option.id)).map((option) => option.id);
|
|
115
85
|
}
|
|
116
86
|
function selectedFolders(config) {
|
|
117
87
|
const result = ["apps/web"];
|
|
@@ -121,8 +91,6 @@ function selectedFolders(config) {
|
|
|
121
91
|
result.push("packages/sdk");
|
|
122
92
|
if (config.platforms.some((platform) => platform === "android" || platform === "ios"))
|
|
123
93
|
result.push("apps/mobile");
|
|
124
|
-
if (config.platforms.some((platform) => ["windows", "linux", "macos"].includes(platform)))
|
|
125
|
-
result.push("apps/desktop");
|
|
126
94
|
for (const feature of config.features) {
|
|
127
95
|
if (feature !== "authentication")
|
|
128
96
|
result.push("apps/" + feature);
|
|
@@ -164,7 +132,7 @@ ${bar} ${color.dim(labels.join(", ") || "Web only")}`;
|
|
|
164
132
|
${bar} ${color.dim("Cancelled")}`;
|
|
165
133
|
const style = (option, active) => {
|
|
166
134
|
const checked = selected.includes(option.value);
|
|
167
|
-
const hint = option.value === "web" ? "Required" : option.disabled ? "Unavailable" : option.description
|
|
135
|
+
const hint = option.value === "web" ? "Required" : option.disabled ? "Unavailable" : option.description;
|
|
168
136
|
const checkbox = checked ? p.S_CHECKBOX_SELECTED : active ? p.S_CHECKBOX_ACTIVE : p.S_CHECKBOX_INACTIVE;
|
|
169
137
|
const label = `${checkbox} ${option.label}`;
|
|
170
138
|
return (option.value === "web" ? color.green(label) : option.disabled ? color.dim(label) : active ? color.cyan(label) : label) + (hint ? color.dim(` (${hint})`) : "");
|
|
@@ -355,6 +323,54 @@ async function createApp(template, destination, name, config, overwrite = false)
|
|
|
355
323
|
force: true
|
|
356
324
|
});
|
|
357
325
|
}
|
|
326
|
+
if (!config.features.includes("authentication")) {
|
|
327
|
+
for (const path of [
|
|
328
|
+
"packages/disposabl-kit/client/routes/_auth-pages",
|
|
329
|
+
"packages/disposabl-kit/client/routes/consent.tsx",
|
|
330
|
+
"apps/web/src/router/_authenticated/dashboard.api-keys.tsx",
|
|
331
|
+
"apps/web/tests/auth-branches.test.tsx",
|
|
332
|
+
"apps/mobile/src/app/(auth)",
|
|
333
|
+
"apps/mobile/src/app/(authenticated)/account.tsx"
|
|
334
|
+
]) {
|
|
335
|
+
await rm(join(destination, path), { recursive: true, force: true });
|
|
336
|
+
}
|
|
337
|
+
await writeFile(join(destination, "apps/web/src/router/_authenticated/dashboard.tsx"), `import { createFileRoute } from "@tanstack/react-router";
|
|
338
|
+
|
|
339
|
+
export const Route = createFileRoute("/_providers/_authenticated/dashboard")({
|
|
340
|
+
component: () => <h1>Dashboard</h1>,
|
|
341
|
+
});
|
|
342
|
+
`);
|
|
343
|
+
if (folders.includes("apps/mobile")) {
|
|
344
|
+
await writeFile(join(destination, "apps/mobile/src/app/index.tsx"), `export { PublicHomeScreen as default } from "@disposabl/disposabl-kit/mobile";
|
|
345
|
+
`);
|
|
346
|
+
await writeFile(join(destination, "apps/mobile/src/app/(authenticated)/_layout.tsx"), `export { PublicLayout as default } from "@disposabl/disposabl-kit/mobile";
|
|
347
|
+
`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (!config.features.includes("docs")) {
|
|
351
|
+
const webPackage = join(destination, "apps/web/package.json");
|
|
352
|
+
const web = JSON.parse(await readFile(webPackage, "utf8"));
|
|
353
|
+
delete web.devDependencies["@disposabl/docs"];
|
|
354
|
+
await writeFile(webPackage, JSON.stringify(web, null, 2) + `
|
|
355
|
+
`);
|
|
356
|
+
for (const file of [
|
|
357
|
+
"apps/web/vite.config.ts",
|
|
358
|
+
"packages/disposabl-kit/client/lib/prerender.ts",
|
|
359
|
+
"packages/disposabl-kit/server/http.ts"
|
|
360
|
+
]) {
|
|
361
|
+
const path = join(destination, file);
|
|
362
|
+
const source = await readFile(path, "utf8");
|
|
363
|
+
await writeFile(path, source.replace(/^[ \t]*\/\/ docs:start\r?\n[\s\S]*?^[ \t]*\/\/ docs:end\r?\n/gm, ""));
|
|
364
|
+
}
|
|
365
|
+
const turboPath = join(destination, "turbo.json");
|
|
366
|
+
const turbo = JSON.parse(await readFile(turboPath, "utf8"));
|
|
367
|
+
delete turbo.tasks["@disposabl/docs#build"];
|
|
368
|
+
delete turbo.tasks["@disposabl/web#build"];
|
|
369
|
+
await writeFile(turboPath, JSON.stringify(turbo, null, 2) + `
|
|
370
|
+
`);
|
|
371
|
+
for (const file of ["docs.ts", "docs.test.ts"])
|
|
372
|
+
await rm(join(destination, "packages/disposabl-kit/server/lib", file));
|
|
373
|
+
}
|
|
358
374
|
for (const kind of ["cli", "sdk"]) {
|
|
359
375
|
const folder = join(destination, "packages", kind);
|
|
360
376
|
if (!folders.includes(`packages/${kind}`)) {
|
|
@@ -400,19 +416,84 @@ async function createApp(template, destination, name, config, overwrite = false)
|
|
|
400
416
|
return folders;
|
|
401
417
|
}
|
|
402
418
|
|
|
419
|
+
// setup.ts
|
|
420
|
+
import { spawn } from "node:child_process";
|
|
421
|
+
import { readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
|
|
422
|
+
import { join as join2 } from "node:path";
|
|
423
|
+
import { fileURLToPath } from "node:url";
|
|
424
|
+
var runDisposabl = (args, interactive = false) => new Promise((resolve, reject) => {
|
|
425
|
+
const child = spawn(process.execPath, [fileURLToPath(new URL("./disposabl.js", import.meta.url)), ...args], {
|
|
426
|
+
stdio: interactive ? ["inherit", "inherit", "inherit"] : ["ignore", "pipe", "pipe"]
|
|
427
|
+
});
|
|
428
|
+
let output = "";
|
|
429
|
+
child.stdout?.on("data", (chunk) => {
|
|
430
|
+
output += chunk.toString();
|
|
431
|
+
});
|
|
432
|
+
child.stderr?.on("data", (chunk) => process.stderr.write(chunk));
|
|
433
|
+
child.once("error", reject);
|
|
434
|
+
child.once("close", (code) => {
|
|
435
|
+
if (code !== 0) {
|
|
436
|
+
reject(new Error(`disposabl ${args.slice(0, 3).join(" ")} failed. The project remains available; retry setup from its directory.`));
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
try {
|
|
440
|
+
resolve(interactive ? undefined : JSON.parse(output));
|
|
441
|
+
} catch {
|
|
442
|
+
reject(new Error("Invalid response from disposabl CLI."));
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
async function setupApp(directory, name, reference, run = runDisposabl) {
|
|
447
|
+
if (!reference || reference.trim() !== reference || reference.length > 200 || [...reference].some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) === 127))
|
|
448
|
+
throw new Error("Supply --reference with a branch, worktree name, or main.");
|
|
449
|
+
const status = await run(["login", "status"]);
|
|
450
|
+
if (!status.currentUser) {
|
|
451
|
+
await run(["login"], true);
|
|
452
|
+
const verified = await run(["login", "status"]);
|
|
453
|
+
if (!verified.currentUser)
|
|
454
|
+
throw new Error("Login completed without a verified user.");
|
|
455
|
+
}
|
|
456
|
+
const path = join2(directory, "disposabl.json");
|
|
457
|
+
const config = JSON.parse(await readFile2(path, "utf8"));
|
|
458
|
+
if (config.appId) {
|
|
459
|
+
await run(["apps", "get", "--appId", config.appId]);
|
|
460
|
+
} else {
|
|
461
|
+
const app = await run([
|
|
462
|
+
"apps",
|
|
463
|
+
"create",
|
|
464
|
+
"--name",
|
|
465
|
+
name,
|
|
466
|
+
"--platforms",
|
|
467
|
+
JSON.stringify(config.platforms)
|
|
468
|
+
]);
|
|
469
|
+
config.appId = app.appId;
|
|
470
|
+
await writeFile2(path, JSON.stringify(config, null, 2) + `
|
|
471
|
+
`);
|
|
472
|
+
}
|
|
473
|
+
await run([
|
|
474
|
+
"previews",
|
|
475
|
+
"token",
|
|
476
|
+
"create",
|
|
477
|
+
"--appId",
|
|
478
|
+
config.appId,
|
|
479
|
+
"--reference",
|
|
480
|
+
reference,
|
|
481
|
+
"--configure",
|
|
482
|
+
directory
|
|
483
|
+
]);
|
|
484
|
+
return config.appId;
|
|
485
|
+
}
|
|
486
|
+
|
|
403
487
|
// index.ts
|
|
404
488
|
var jsonOutput = process.argv.slice(2).includes("--json");
|
|
405
|
-
var program = new Command("create-disposabl-app").description("Create a Disposabl starter. Web
|
|
489
|
+
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("--setup", "Sign in to Disposabl and configure a development preview").option("--reference <name>", "Branch or worktree name for setup (including main)").option("--skip-install", "Create files without running bun install").option("--list-options", "List every platform and feature, including disabled choices").option("--json", "Skip prompts and emit a JSON result or error; install logs go to stderr").helpOption("-h, --help").addHelpText("after", `
|
|
406
490
|
Platforms:
|
|
407
|
-
web (required), android, ios,
|
|
408
|
-
cli, typescript-sdk, openai-plugin, claude-code-plugin
|
|
491
|
+
web (required), android, ios, api, mcp, cli, typescript-sdk
|
|
409
492
|
CLI and TypeScript SDK automatically include API.
|
|
410
|
-
Either plugin automatically includes MCP.
|
|
411
|
-
Disabled: python-sdk
|
|
412
493
|
|
|
413
494
|
Optional features:
|
|
414
|
-
|
|
415
|
-
Authentication is
|
|
495
|
+
authentication, docs
|
|
496
|
+
Authentication is enabled by default. Use --features none to disable frontend authentication.
|
|
416
497
|
|
|
417
498
|
Examples:
|
|
418
499
|
bun create disposabl-app@latest
|
|
@@ -423,7 +504,7 @@ Examples:
|
|
|
423
504
|
|
|
424
505
|
Without a TTY, the CLI never prompts. Supply an app name.
|
|
425
506
|
Platform and feature choices are saved in disposabl.json.
|
|
426
|
-
|
|
507
|
+
Backend authentication code is always included. Use --setup --reference main to create an app UUID and development environment through https://disposabl.dev.
|
|
427
508
|
`).configureOutput({ writeErr: () => {} }).exitOverride();
|
|
428
509
|
|
|
429
510
|
class Cancelled extends Error {
|
|
@@ -448,14 +529,9 @@ function showOptions(json) {
|
|
|
448
529
|
"typescript-sdk": "packages/sdk",
|
|
449
530
|
android: "apps/mobile",
|
|
450
531
|
ios: "apps/mobile",
|
|
451
|
-
|
|
452
|
-
linux: "apps/desktop",
|
|
453
|
-
macos: "apps/desktop",
|
|
454
|
-
docs: "apps/docs",
|
|
455
|
-
blog: "apps/blog",
|
|
456
|
-
changelog: "apps/changelog"
|
|
532
|
+
docs: "apps/docs"
|
|
457
533
|
},
|
|
458
|
-
configOnly: ["api", "mcp"
|
|
534
|
+
configOnly: ["api", "mcp"]
|
|
459
535
|
}, null, 2));
|
|
460
536
|
return;
|
|
461
537
|
}
|
|
@@ -471,11 +547,11 @@ Features
|
|
|
471
547
|
for (const option of features)
|
|
472
548
|
console.log(" " + option.id.padEnd(21) + option.hint);
|
|
473
549
|
console.log(`
|
|
474
|
-
Web
|
|
550
|
+
Web is always included. Authentication is enabled by default. Use --platforms and --features with the IDs above.`);
|
|
475
551
|
}
|
|
476
552
|
async function install(directory, interactive) {
|
|
477
553
|
await new Promise((done, reject) => {
|
|
478
|
-
const child =
|
|
554
|
+
const child = spawn2("bun", ["install"], {
|
|
479
555
|
cwd: directory,
|
|
480
556
|
stdio: ["ignore", "pipe", "pipe"],
|
|
481
557
|
env: { ...process.env, NODE_ENV: "development" }
|
|
@@ -541,8 +617,9 @@ async function main() {
|
|
|
541
617
|
}
|
|
542
618
|
if (interactive && options.features === undefined) {
|
|
543
619
|
const selected = answer(await p2.multiselect({
|
|
544
|
-
message: "Choose optional features
|
|
545
|
-
|
|
620
|
+
message: "Choose optional features",
|
|
621
|
+
initialValues: ["authentication"],
|
|
622
|
+
options: features.map((feature) => ({
|
|
546
623
|
value: feature.id,
|
|
547
624
|
label: feature.label,
|
|
548
625
|
hint: feature.hint
|
|
@@ -551,6 +628,20 @@ async function main() {
|
|
|
551
628
|
}));
|
|
552
629
|
chosenFeatures = selectFeatures(selected.length ? selected.join(",") : "none");
|
|
553
630
|
}
|
|
631
|
+
const managedSetup = options.setup ?? (interactive && answer(await p2.confirm({
|
|
632
|
+
message: "Set up this app with Disposabl?",
|
|
633
|
+
initialValue: false
|
|
634
|
+
})));
|
|
635
|
+
let reference = options.reference;
|
|
636
|
+
if (managedSetup && interactive && !reference)
|
|
637
|
+
reference = answer(await p2.text({
|
|
638
|
+
message: "Branch or worktree name",
|
|
639
|
+
defaultValue: "main",
|
|
640
|
+
placeholder: "main",
|
|
641
|
+
validate: (value) => !value?.trim() ? "Enter a branch, worktree name, or main." : undefined
|
|
642
|
+
}));
|
|
643
|
+
if (managedSetup && (!reference || reference !== reference.trim() || reference.length > 200 || [...reference].some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) === 127)))
|
|
644
|
+
throw new Error("Setup requires --reference with a branch, worktree name, or main.");
|
|
554
645
|
const config = {
|
|
555
646
|
version,
|
|
556
647
|
platforms: chosenPlatforms,
|
|
@@ -564,7 +655,7 @@ async function main() {
|
|
|
564
655
|
const hasBun = spawnSync("bun", ["--version"], { stdio: "ignore" }).status === 0;
|
|
565
656
|
if (!options.skipInstall && !hasBun)
|
|
566
657
|
throw new Error("Install Bun first, or pass --skip-install to create the files only.");
|
|
567
|
-
const template =
|
|
658
|
+
const template = fileURLToPath2(new URL("./templates/default", import.meta.url));
|
|
568
659
|
await createApp(template, directory, name, config, overwrite);
|
|
569
660
|
if (!options.skipInstall) {
|
|
570
661
|
installationStarted = true;
|
|
@@ -584,6 +675,8 @@ async function main() {
|
|
|
584
675
|
}
|
|
585
676
|
const git = (...args) => execFileSync("git", args, { cwd: directory, stdio: "pipe" });
|
|
586
677
|
git("init", "--initial-branch=main");
|
|
678
|
+
if (managedSetup)
|
|
679
|
+
config.appId = await setupApp(directory, name, reference);
|
|
587
680
|
git("add", "--all");
|
|
588
681
|
const hasIdentity = spawnSync("git", ["var", "GIT_AUTHOR_IDENT"], {
|
|
589
682
|
cwd: directory,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
|
|
4
|
+
if [[ "$CHANNEL" == production ]]; then
|
|
5
|
+
: "${ANDROID_KEYSTORE_BASE64:?}" "${ANDROID_KEYSTORE_PASSWORD:?}" "${ANDROID_KEY_ALIAS:?}" "${ANDROID_KEY_PASSWORD:?}"
|
|
6
|
+
export ANDROID_KEYSTORE_PATH="$RUNNER_TEMP/android-release.jks"
|
|
7
|
+
trap 'rm -f "$ANDROID_KEYSTORE_PATH"' EXIT
|
|
8
|
+
(umask 077; printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$ANDROID_KEYSTORE_PATH")
|
|
9
|
+
fi
|
|
10
|
+
bun x --no-install expo prebuild --platform android --no-install
|
|
11
|
+
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
12
|
+
(cd android && ./gradlew :app:assembleRelease --no-daemon --build-cache)
|
|
13
|
+
apk=android/app/build/outputs/apk/release/app-release.apk
|
|
14
|
+
test "$(unzip -p "$apk" assets/fingerprint)" = "$RUNTIME"
|
|
15
|
+
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
16
|
+
mkdir -p ../../dist/release
|
|
17
|
+
cp "$apk" ../../dist/release/android.apk
|
|
18
|
+
jq --arg sha "$(sha256sum "$apk" | cut -d' ' -f1)" '. + {sha256: $sha, action: "build"}' <<< "$MANIFEST" > ../../dist/release/android.json
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { appendFile, readFile } from "node:fs/promises";
|
|
2
|
+
|
|
3
|
+
const origin = "https://disposabl.dev";
|
|
4
|
+
const config = JSON.parse(await readFile("disposabl.json", "utf8"));
|
|
5
|
+
const [command, platform, status, detail] = process.argv.slice(2);
|
|
6
|
+
if (config.appId) {
|
|
7
|
+
const audience = new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL);
|
|
8
|
+
audience.searchParams.set("audience", origin);
|
|
9
|
+
const identity = await fetch(audience, {
|
|
10
|
+
headers: {
|
|
11
|
+
Authorization: `Bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
if (!identity.ok)
|
|
15
|
+
throw new Error(`GitHub identity failed (${identity.status}).`);
|
|
16
|
+
const { value: token } = await identity.json();
|
|
17
|
+
const call = async (path, body) => {
|
|
18
|
+
const response = await fetch(origin + path, {
|
|
19
|
+
method: "POST",
|
|
20
|
+
redirect: "error",
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${token}`,
|
|
23
|
+
"Content-Type": "application/json",
|
|
24
|
+
},
|
|
25
|
+
body: JSON.stringify({ appId: config.appId, ...body }),
|
|
26
|
+
signal: AbortSignal.timeout(90_000),
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok)
|
|
29
|
+
throw new Error(`Disposabl ${path} failed (${response.status}).`);
|
|
30
|
+
return response.json();
|
|
31
|
+
};
|
|
32
|
+
if (command === "token") {
|
|
33
|
+
const result = await call("/github/token", {});
|
|
34
|
+
console.log(`::add-mask::${result.token}`);
|
|
35
|
+
await appendFile(process.env.GITHUB_ENV, `GH_TOKEN=${result.token}\n`);
|
|
36
|
+
} else if (command === "report") {
|
|
37
|
+
for (const name of platform
|
|
38
|
+
.split(",")
|
|
39
|
+
.filter((name) => config.platforms.includes(name))) {
|
|
40
|
+
const routes = { web: "", api: "/openapi.json", mcp: "/mcp" };
|
|
41
|
+
const url =
|
|
42
|
+
status === "ready" &&
|
|
43
|
+
Object.hasOwn(routes, name) &&
|
|
44
|
+
process.env.CONVEX_SITE_URL
|
|
45
|
+
? process.env.CONVEX_SITE_URL + routes[name]
|
|
46
|
+
: undefined;
|
|
47
|
+
await call("/github/report", {
|
|
48
|
+
platform: name,
|
|
49
|
+
status,
|
|
50
|
+
...(detail ? { reason: detail } : {}),
|
|
51
|
+
...(url ? { url } : {}),
|
|
52
|
+
...(process.env.PUBLISHED_VERSION
|
|
53
|
+
? { version: process.env.PUBLISHED_VERSION }
|
|
54
|
+
: {}),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
} else if (command === "release" && config.platforms.includes(platform)) {
|
|
58
|
+
const response = await fetch(
|
|
59
|
+
`https://api.github.com/repos/${process.env.GH_REPO}/releases/tags/${encodeURIComponent(status)}`,
|
|
60
|
+
{
|
|
61
|
+
headers: {
|
|
62
|
+
Authorization: `Bearer ${process.env.GH_TOKEN}`,
|
|
63
|
+
Accept: "application/vnd.github+json",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
if (!response.ok)
|
|
68
|
+
throw new Error(`Cannot inspect release (${response.status}).`);
|
|
69
|
+
const release = await response.json();
|
|
70
|
+
const updateOnly = /"action"\s*:\s*"update"/.test(release.body ?? "");
|
|
71
|
+
if (updateOnly) {
|
|
72
|
+
await call("/github/report", { platform, status: "ready" });
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|
|
75
|
+
const suffix = {
|
|
76
|
+
android: ".apk",
|
|
77
|
+
ios: ".ipa",
|
|
78
|
+
macos: ".dmg",
|
|
79
|
+
windows: ".exe",
|
|
80
|
+
linux: ".AppImage",
|
|
81
|
+
}[platform];
|
|
82
|
+
const asset =
|
|
83
|
+
release.assets.find((asset) => asset.name.endsWith(suffix)) ??
|
|
84
|
+
(platform === "linux"
|
|
85
|
+
? release.assets.find((asset) => asset.name.endsWith(".deb"))
|
|
86
|
+
: undefined);
|
|
87
|
+
await call("/github/report", {
|
|
88
|
+
platform,
|
|
89
|
+
status: "ready",
|
|
90
|
+
version: process.env.DISPOSABL_RELEASE_VERSION,
|
|
91
|
+
githubReleaseUrl: release.html_url,
|
|
92
|
+
...(asset ? { artifactUrl: asset.browser_download_url } : {}),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
for ((offset=0; ; offset+=25)); do
|
|
4
|
+
bun x "$EAS_CLI" channel:list --json --limit 25 --offset "$offset" > "$RUNNER_TEMP/channels.json"
|
|
5
|
+
if jq -e --arg channel "$CHANNEL" 'any(.currentPage[]; .name == $channel)' "$RUNNER_TEMP/channels.json" > /dev/null; then
|
|
6
|
+
jq -e --arg channel "$CHANNEL" '.currentPage[] | select(.name == $channel) | (.isPaused == false) and (.updateBranches | length == 1) and (.updateBranches[0].name == $channel) and ((.branchMapping | fromjson).data == [{branchId: .updateBranches[0].id, branchMappingLogic: "true"}])' "$RUNNER_TEMP/channels.json" > /dev/null || { echo 'Preview channel must point only to its same-named branch'; exit 1; }
|
|
7
|
+
break
|
|
8
|
+
fi
|
|
9
|
+
if [[ $(jq '.currentPage | length' "$RUNNER_TEMP/channels.json") -lt 25 ]]; then bun x "$EAS_CLI" channel:create "$CHANNEL" --non-interactive; break; fi
|
|
10
|
+
done
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
jq --arg channel "$CHANNEL" '.build["ios-" + env.EAS_ENVIRONMENT].channel = $channel' eas.json > "$RUNNER_TEMP/eas.json"
|
|
4
|
+
mv "$RUNNER_TEMP/eas.json" eas.json
|
|
5
|
+
bun x "$EAS_CLI" env:pull --environment "$EAS_ENVIRONMENT" --path "$RUNNER_TEMP/expo.env" --non-interactive
|
|
6
|
+
bun -e '
|
|
7
|
+
import {parseEnv} from "node:util";
|
|
8
|
+
import {appendFileSync, readFileSync} from "node:fs";
|
|
9
|
+
for (const [key, value] of Object.entries(parseEnv(readFileSync(`${process.env.RUNNER_TEMP}/expo.env`, "utf8")))) {
|
|
10
|
+
// Web and mobile use the same backend from this deployment.
|
|
11
|
+
if (/^CONVEX_(URL|SITE_URL)$/.test(key) && value !== process.env[key]) throw new Error(`EAS overrides the deployed backend: ${key}`);
|
|
12
|
+
if (/^(EXPO_PUBLIC_|VITE_)?CONVEX_(URL|SITE_URL)$/.test(key)) continue;
|
|
13
|
+
if (/^(GITHUB_|RUNNER_|GH_|DISPOSABL_|BUN_|CI$|NODE_OPTIONS$|PATH$|HOME$|SOURCE(_PATH)?$|CHANNEL$|PLATFORM$|RELEASE_PREFIX$|MACOS_|EAS_(ENVIRONMENT|CLI)$|EXPO_(TOKEN|PROJECT_ID|OWNER|SLUG|NO_DOTENV)$)/.test(key)) throw new Error(`Reserved EAS variable: ${key}`);
|
|
14
|
+
const delimiter = crypto.randomUUID();
|
|
15
|
+
appendFileSync(process.env.GITHUB_ENV, `${key}<<${delimiter}\n${value}\n${delimiter}\n`);
|
|
16
|
+
}
|
|
17
|
+
'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
for ((page=1; ; page++)); do
|
|
4
|
+
gh api "repos/$GH_REPO/releases?per_page=100&page=$page" > "$RUNNER_TEMP/releases.json"
|
|
5
|
+
jq --arg tag "$RELEASE_PREFIX-$CHANNEL-android" --arg legacy "$RELEASE_PREFIX-$CHANNEL" '[.[] | select(.draft | not) | select(.tag_name == $tag or .tag_name == $legacy or (.tag_name | startswith($legacy + "-"))) | select(any(.assets[]; .name == "android.apk"))] | sort_by(.tag_name != $tag, .tag_name != $legacy) | .[0] // {}' "$RUNNER_TEMP/releases.json" > "$RUNNER_TEMP/release.json"
|
|
6
|
+
if jq -e '.id' "$RUNNER_TEMP/release.json" > /dev/null || [[ $(jq length "$RUNNER_TEMP/releases.json") -lt 100 ]]; then break; fi
|
|
7
|
+
done
|
|
8
|
+
bun x --no-install expo config --json > "$RUNNER_TEMP/mobile.json"
|
|
9
|
+
RUNTIME=$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er 'select(.fingerprintSources != null) | .runtimeVersion | select(test("^[a-f0-9]{40,64}$"))')
|
|
10
|
+
export RUNTIME
|
|
11
|
+
bun -e '
|
|
12
|
+
const config = await Bun.file(`${process.env.RUNNER_TEMP}/mobile.json`).json();
|
|
13
|
+
if (!config.extra?.eas?.projectId) throw new Error("Link an Expo project first");
|
|
14
|
+
const wanted = {channel: process.env.CHANNEL, projectId: config.extra.eas.projectId, applicationId: config.android.package, runtimeVersion: process.env.RUNTIME};
|
|
15
|
+
const release = await Bun.file(`${process.env.RUNNER_TEMP}/release.json`).json();
|
|
16
|
+
const prior = JSON.parse(/<!-- android (\{[^\n]+\}) -->/.exec(release.body || "")?.[1] || "null");
|
|
17
|
+
const reusable = prior && Object.keys(wanted).every(k => prior[k] === wanted[k]) && /^[a-f0-9]{64}$/.test(prior.sha256 || "") && release.assets.some(a => a.name === "android.apk" && a.state === "uploaded" && a.size > 0 && a.digest === `sha256:${prior.sha256}`);
|
|
18
|
+
console.log(`build=${!reusable}\nruntime=${wanted.runtimeVersion}\nmanifest=${JSON.stringify(wanted)}\ntag=${reusable ? release.tag_name : ""}\nsha=${reusable ? prior.sha256 : ""}`);
|
|
19
|
+
' >> "$GITHUB_OUTPUT"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
mkdir -p dist/release
|
|
4
|
+
gh release download "$TAG" --pattern android.apk --dir dist/release
|
|
5
|
+
echo "$SHA dist/release/android.apk" | sha256sum --check
|
|
6
|
+
cd apps/mobile
|
|
7
|
+
bun x --no-install expo export --platform android --output-dir dist/update
|
|
8
|
+
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
9
|
+
test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
|
|
10
|
+
bun x "$EAS_CLI" update --platform android --channel "$CHANNEL" --environment "$EAS_ENVIRONMENT" --skip-bundler --input-dir dist/update --message "$SOURCE" --non-interactive
|
|
11
|
+
jq --arg sha "$SHA" '. + {sha256: $sha, action: "update"}' <<< "$MANIFEST" > ../../dist/release/android.json
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
[[ -f "packages/$PACKAGE/package.json" ]] || exit 0
|
|
4
|
+
platform=$PACKAGE
|
|
5
|
+
[[ "$PACKAGE" != sdk ]] || platform=typescript-sdk
|
|
6
|
+
bun run generate
|
|
7
|
+
bun run --cwd "packages/$PACKAGE" typecheck
|
|
8
|
+
name=$(node -p "require('./packages/$PACKAGE/package.json').name")
|
|
9
|
+
if ! previous=$(npm view "$name" version 2>/dev/null); then
|
|
10
|
+
node .github/scripts/disposabl.mjs report "$platform" blocked 'Publish the package once and configure npm trusted publishing.'
|
|
11
|
+
exit 0
|
|
12
|
+
fi
|
|
13
|
+
node .github/scripts/disposabl.mjs report "$platform" building
|
|
14
|
+
if GITHUB_TOKEN="$GH_TOKEN" npm_config_workspaces_update=false bun run --cwd "packages/$PACKAGE" release; then
|
|
15
|
+
version=$(node -p "require('./packages/$PACKAGE/package.json').version")
|
|
16
|
+
[[ "$version" != *development* ]] || version=$previous
|
|
17
|
+
PUBLISHED_VERSION=$(npm view "$name@$version" version)
|
|
18
|
+
export PUBLISHED_VERSION
|
|
19
|
+
node .github/scripts/disposabl.mjs report "$platform" ready
|
|
20
|
+
else
|
|
21
|
+
node .github/scripts/disposabl.mjs report "$platform" failed 'Package publication failed; check trusted publishing and the workflow log.'
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
if [[ "$GITHUB_JOB" == android || "$GITHUB_JOB" == ios ]]; then exit; fi
|
|
4
|
+
if [[ "$TRUSTED" != true ]]; then printf 'android=false\nios=false\ndesktop=[]\nselected=false\n' >> "$GITHUB_OUTPUT"; exit; fi
|
|
5
|
+
if [[ -n "$PR" ]]; then
|
|
6
|
+
gh api "repos/$GH_REPO/pulls/$PR/files?per_page=100" --paginate --jq '.[] | .filename, (.previous_filename // empty)' > "$RUNNER_TEMP/changes"
|
|
7
|
+
elif [[ -z "$BEFORE" || "$BEFORE" =~ ^0+$ ]]; then echo disposabl.json > "$RUNNER_TEMP/changes"
|
|
8
|
+
else
|
|
9
|
+
git -c credential.helper= -c 'credential.helper=!gh auth git-credential' fetch --depth=1 origin "$BEFORE"
|
|
10
|
+
git diff --name-only --no-renames "$BEFORE" "$SOURCE" > "$RUNNER_TEMP/changes"
|
|
11
|
+
fi
|
|
12
|
+
node --input-type=module -e '
|
|
13
|
+
import {readFileSync} from "node:fs";
|
|
14
|
+
import {execFileSync} from "node:child_process";
|
|
15
|
+
const relevant = p => p && !/(^|\/)\.agents\/|\.(md|mdx)$/.test(p);
|
|
16
|
+
const paths = readFileSync(`${process.env.RUNNER_TEMP}/changes`, "utf8").split(/\r?\n/).filter(relevant);
|
|
17
|
+
const enabled = JSON.parse(readFileSync("disposabl.json", "utf8")).platforms;
|
|
18
|
+
const api = path => JSON.parse(execFileSync("gh", ["api", `repos/${process.env.GH_REPO}/${path}`], {encoding: "utf8", stdio: ["ignore", "pipe", "ignore"]}));
|
|
19
|
+
const changes = platform => {
|
|
20
|
+
if (!process.env.PR) return paths;
|
|
21
|
+
try {
|
|
22
|
+
const release = api(`releases/tags/${process.env.RELEASE_PREFIX}-${process.env.CHANNEL}-${platform}`);
|
|
23
|
+
const base = /^Source: ([a-f0-9]{40})$/m.exec(release.body || "")?.[1];
|
|
24
|
+
if (release.draft || !base) return paths;
|
|
25
|
+
if (base === process.env.SOURCE) return [];
|
|
26
|
+
const diff = api(`compare/${base}...${process.env.SOURCE}`);
|
|
27
|
+
// GitHub caps comparison files at 300; never skip on a truncated result.
|
|
28
|
+
return !["ahead", "identical"].includes(diff.status) || !Array.isArray(diff.files) || diff.files.length >= 300 ? ["disposabl.json"] : diff.files.flatMap(f => [f.filename, f.previous_filename]).filter(relevant);
|
|
29
|
+
} catch { return paths; }
|
|
30
|
+
};
|
|
31
|
+
const affected = (platform, directory) => enabled.includes(platform) && changes(platform).some(p => p.startsWith(directory) || /^(bun.lock$|package.json$|disposabl.json$|turbo.json$|bunfig.toml$|patches\/|\.github\/workflows\/pipeline.yml$|packages\/(?!backend\/|create-disposabl-app\/))/.test(p));
|
|
32
|
+
const target = process.env.DISPOSABL_DESKTOP_PLATFORM;
|
|
33
|
+
for (const platform of ["android", "ios"]) console.log(`${platform}=${platform === "android" && Boolean(process.env.EXPO_TOKEN) && !target && affected(platform, "apps/mobile/")}`); // Restore iOS selection when builds resume.
|
|
34
|
+
const desktop = ["linux", "windows"].filter(platform => affected(platform, "apps/desktop/"))
|
|
35
|
+
.map(platform => ({platform, runner: process.env[`${platform.toUpperCase()}_RUNNER`]}));
|
|
36
|
+
console.log(`desktop=${JSON.stringify(desktop)}`);
|
|
37
|
+
' >> "$GITHUB_OUTPUT"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
check_source() {
|
|
4
|
+
if [[ "$CHANNEL" == production ]]; then test "$(gh api "repos/$GH_REPO/git/ref/heads/main" --jq .object.sha)" = "$SOURCE"
|
|
5
|
+
else test "$(gh api "repos/$GH_REPO/pulls/$PR" --jq 'if .state == "open" then .head.sha else "closed" end')" = "$SOURCE"; fi
|
|
6
|
+
}
|
|
7
|
+
# Apple publication remains disabled along with the build jobs.
|
|
8
|
+
for platform in android linux windows; do
|
|
9
|
+
directory="artifacts/release-$platform"
|
|
10
|
+
test -d "$directory" || continue
|
|
11
|
+
check_source
|
|
12
|
+
tag="app-$CHANNEL-$platform"
|
|
13
|
+
if [[ "$CHANNEL" == production ]]; then tag+="-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"; fi
|
|
14
|
+
printf 'Platform: %s\nSource: %s\n' "$platform" "$SOURCE" > "$RUNNER_TEMP/release-notes.md"
|
|
15
|
+
if [[ -f "$directory/android.json" ]]; then printf '<!-- android %s -->\n' "$(jq -c . "$directory/android.json")" >> "$RUNNER_TEMP/release-notes.md"; fi
|
|
16
|
+
if gh release view "$tag" --json assets > "$RUNNER_TEMP/previous-release.json"; then
|
|
17
|
+
gh release upload "$tag" "$directory/"* --clobber
|
|
18
|
+
while IFS= read -r asset; do
|
|
19
|
+
if [[ ! -f "$directory/$asset" ]]; then check_source; gh release delete-asset "$tag" "$asset" --yes; fi
|
|
20
|
+
done < <(jq -r '.assets[].name' "$RUNNER_TEMP/previous-release.json")
|
|
21
|
+
gh api --method PATCH "repos/$GH_REPO/git/refs/tags/$tag" -f sha="$SOURCE" -F force=true > /dev/null
|
|
22
|
+
else
|
|
23
|
+
gh release create "$tag" "$directory/"* --draft --target "$SOURCE" --title "$CHANNEL / $platform" --notes-file "$RUNNER_TEMP/release-notes.md" --prerelease="$PRERELEASE"
|
|
24
|
+
fi
|
|
25
|
+
check_source
|
|
26
|
+
gh release edit "$tag" --notes-file "$RUNNER_TEMP/release-notes.md" --draft=false --prerelease="$PRERELEASE" --latest=false
|
|
27
|
+
node .github/scripts/disposabl.mjs release "$platform" "$tag"
|
|
28
|
+
done
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
if [[ "$GITHUB_EVENT_NAME" == push ]]; then
|
|
4
|
+
echo 'current=true' >> "$GITHUB_OUTPUT"
|
|
5
|
+
echo 'CHANNEL=production' >> "$GITHUB_ENV"
|
|
6
|
+
echo 'PRERELEASE=false' >> "$GITHUB_ENV"
|
|
7
|
+
exit
|
|
8
|
+
fi
|
|
9
|
+
echo 'PRERELEASE=true' >> "$GITHUB_ENV"
|
|
10
|
+
pr=$(gh api "repos/$GH_REPO/commits/$SOURCE/pulls" --jq ".[] | select(.state == \"open\" and .head.sha == \"$SOURCE\" and .head.repo.full_name == \"$GH_REPO\") | .number" | head -1)
|
|
11
|
+
if [[ -z "$pr" ]]; then echo 'current=false' >> "$GITHUB_OUTPUT"; exit; fi
|
|
12
|
+
echo 'current=true' >> "$GITHUB_OUTPUT"
|
|
13
|
+
echo "CHANNEL=pr-$pr" >> "$GITHUB_ENV"
|
|
14
|
+
echo "PR=$pr" >> "$GITHUB_ENV"
|