create-disposabl-app 0.6.8 → 0.7.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/dist/disposabl.js +32 -8
- package/dist/index.js +16 -6
- package/dist/templates/default/.github/scripts/mobile.sh +123 -0
- package/dist/templates/default/.github/scripts/release.sh +83 -0
- package/dist/templates/default/.github/workflows/pipeline.yml +22 -14
- package/dist/templates/default/AGENTS.md +2 -1
- package/dist/templates/default/apps/mobile/gitignore +43 -0
- package/dist/templates/default/apps/web/src/routeTree.gen.ts +23 -0
- package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.connections.tsx +354 -0
- package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.tsx +1 -0
- package/dist/templates/default/dev.ts +2 -1
- package/dist/templates/default/packages/backend/AGENTS.md +2 -1
- package/dist/templates/default/packages/backend/README.md +4 -2
- package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +14 -0
- package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +5 -5
- package/dist/templates/default/packages/backend/convex/apps/actions/create.ts +11 -13
- package/dist/templates/default/packages/backend/convex/apps/actions/setup.ts +21 -7
- package/dist/templates/default/packages/backend/convex/apps/internal.ts +1 -6
- package/dist/templates/default/packages/backend/convex/connections/actions/credentials.ts +56 -0
- package/dist/templates/default/packages/backend/convex/connections/actions/expo.ts +79 -0
- package/dist/templates/default/packages/backend/convex/connections/actions/github.ts +120 -0
- package/dist/templates/default/packages/backend/convex/connections/actions/oauth.ts +128 -0
- package/dist/templates/default/packages/backend/convex/connections/index.ts +80 -0
- package/dist/templates/default/packages/backend/convex/connections/internal.ts +148 -0
- package/dist/templates/default/packages/backend/convex/connections/validator.ts +35 -0
- package/dist/templates/default/packages/backend/convex/convex.config.ts +5 -5
- package/dist/templates/default/packages/backend/convex/github/actions/provision.ts +2 -6
- package/dist/templates/default/packages/backend/convex/github/actions/secrets.ts +25 -11
- package/dist/templates/default/packages/backend/convex/github/actions/tokens.ts +19 -15
- package/dist/templates/default/packages/backend/convex/github/internal.ts +6 -8
- package/dist/templates/default/packages/backend/convex/previews/token/actions/create.ts +4 -3
- package/dist/templates/default/packages/backend/convex/previews/token/internal.ts +28 -1
- package/dist/templates/default/packages/backend/convex/schema.ts +17 -1
- package/dist/templates/default/packages/backend/generated/openapi.json +123 -1
- package/dist/templates/default/packages/backend/generated/pages.json +4 -0
- package/dist/templates/default/packages/backend/generated/platforms.ts +12 -10
- package/dist/templates/default/packages/backend/gitignore +16 -0
- package/dist/templates/default/packages/cli/auth.ts +15 -17
- package/dist/templates/default/packages/cli/commands.ts +31 -1
- package/dist/templates/default/packages/disposabl-kit/client/components/logo.tsx +5 -0
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +118 -84
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +127 -89
- package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +2 -5
- package/dist/templates/default/packages/sdk/src/generated/index.ts +5 -0
- package/dist/templates/default/packages/sdk/src/generated/sdk.gen.ts +20 -0
- package/dist/templates/default/packages/sdk/src/generated/types.gen.ts +53 -0
- package/package.json +1 -1
- package/dist/templates/default/.github/scripts/android-build.sh +0 -27
- package/dist/templates/default/.github/scripts/expo-channel.sh +0 -10
- package/dist/templates/default/.github/scripts/expo-env.sh +0 -37
- package/dist/templates/default/.github/scripts/expo-fingerprint.sh +0 -31
- package/dist/templates/default/.github/scripts/expo-update.sh +0 -13
- package/dist/templates/default/.github/scripts/package-release.sh +0 -23
- package/dist/templates/default/.github/scripts/release-publish.sh +0 -28
- package/dist/templates/default/.github/scripts/release-source.sh +0 -14
- package/dist/templates/default/.github/scripts/verify-artifacts.sh +0 -13
- package/dist/templates/default/.github/scripts/web-deploy.sh +0 -10
- package/dist/templates/default/apps/mobile/.env.example +0 -2
- package/dist/templates/default/apps/web/.env.example +0 -3
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
if [[ -z "$EXPO_PROJECT_ID" ]]; then
|
|
4
|
-
# Initialize with static config; app.config.js reads the resulting environment.
|
|
5
|
-
mkdir -p "$RUNNER_TEMP/expo-project"
|
|
6
|
-
jq --slurpfile app ../../disposabl.json --arg owner "${EXPO_OWNER:-}" '
|
|
7
|
-
{expo: {name: .expo.name, slug: (if $app[0].appId then "app-" + $app[0].appId else .expo.slug end)}}
|
|
8
|
-
| if $owner != "" then .expo.owner = $owner else . end
|
|
9
|
-
' app.json > "$RUNNER_TEMP/expo-project/app.json"
|
|
10
|
-
printf '{"name":"expo-project","private":true}\n' > "$RUNNER_TEMP/expo-project/package.json"
|
|
11
|
-
(
|
|
12
|
-
cd "$RUNNER_TEMP/expo-project"
|
|
13
|
-
set -- init --force --non-interactive --json --no-icon
|
|
14
|
-
[[ -z "${EXPO_OWNER:-}" ]] || set -- "$@" --account "$EXPO_OWNER"
|
|
15
|
-
bun x "$EAS_CLI" "$@"
|
|
16
|
-
) > "$RUNNER_TEMP/expo-project.json"
|
|
17
|
-
EXPO_PROJECT_ID=$(jq -er .projectId "$RUNNER_TEMP/expo-project.json")
|
|
18
|
-
EXPO_OWNER=$(jq -er .owner "$RUNNER_TEMP/expo-project.json")
|
|
19
|
-
EXPO_SLUG=$(jq -er .slug "$RUNNER_TEMP/expo-project.json")
|
|
20
|
-
export EXPO_PROJECT_ID EXPO_OWNER EXPO_SLUG
|
|
21
|
-
printf 'EXPO_PROJECT_ID=%s\nEXPO_OWNER=%s\nEXPO_SLUG=%s\n' "$EXPO_PROJECT_ID" "$EXPO_OWNER" "$EXPO_SLUG" >> "$GITHUB_ENV"
|
|
22
|
-
fi
|
|
23
|
-
jq --arg channel "$CHANNEL" '.build["ios-" + env.EAS_ENVIRONMENT].channel = $channel' eas.json > "$RUNNER_TEMP/eas.json"
|
|
24
|
-
mv "$RUNNER_TEMP/eas.json" eas.json
|
|
25
|
-
bun x "$EAS_CLI" env:pull --environment "$EAS_ENVIRONMENT" --path "$RUNNER_TEMP/expo.env" --non-interactive
|
|
26
|
-
bun -e '
|
|
27
|
-
import {parseEnv} from "node:util";
|
|
28
|
-
import {appendFileSync, readFileSync} from "node:fs";
|
|
29
|
-
for (const [key, value] of Object.entries(parseEnv(readFileSync(`${process.env.RUNNER_TEMP}/expo.env`, "utf8")))) {
|
|
30
|
-
// Web and mobile use the same backend from this deployment.
|
|
31
|
-
if (/^CONVEX_(URL|SITE_URL)$/.test(key) && value !== process.env[key]) throw new Error(`EAS overrides the deployed backend: ${key}`);
|
|
32
|
-
if (/^(EXPO_PUBLIC_|VITE_)?CONVEX_(URL|SITE_URL)$/.test(key)) continue;
|
|
33
|
-
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}`);
|
|
34
|
-
const delimiter = crypto.randomUUID();
|
|
35
|
-
appendFileSync(process.env.GITHUB_ENV, `${key}<<${delimiter}\n${value}\n${delimiter}\n`);
|
|
36
|
-
}
|
|
37
|
-
'
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
artifact=android.apk
|
|
4
|
-
[[ "$CHANNEL" != production ]] || artifact=android.aab
|
|
5
|
-
export artifact
|
|
6
|
-
for ((page=1; ; page++)); do
|
|
7
|
-
gh api "repos/$GH_REPO/releases?per_page=100&page=$page" > "$RUNNER_TEMP/releases.json"
|
|
8
|
-
jq --arg artifact "$artifact" --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 == $artifact))] | sort_by(.tag_name != $tag, .tag_name != $legacy) | .[0] // {}' "$RUNNER_TEMP/releases.json" > "$RUNNER_TEMP/release.json"
|
|
9
|
-
if jq -e '.id' "$RUNNER_TEMP/release.json" > /dev/null || [[ $(jq length "$RUNNER_TEMP/releases.json") -lt 100 ]]; then break; fi
|
|
10
|
-
done
|
|
11
|
-
bun x --no-install expo config --json > "$RUNNER_TEMP/mobile.json"
|
|
12
|
-
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}$"))')
|
|
13
|
-
export RUNTIME
|
|
14
|
-
bun -e '
|
|
15
|
-
const config = await Bun.file(`${process.env.RUNNER_TEMP}/mobile.json`).json();
|
|
16
|
-
if (!config.extra?.eas?.projectId) throw new Error("Link an Expo project first");
|
|
17
|
-
const wanted = {channel: process.env.CHANNEL, projectId: config.extra.eas.projectId, applicationId: config.android.package, runtimeVersion: process.env.RUNTIME};
|
|
18
|
-
const release = await Bun.file(`${process.env.RUNNER_TEMP}/release.json`).json();
|
|
19
|
-
const prior = JSON.parse(/<!-- android (\{[^\n]+\}) -->/.exec(release.body || "")?.[1] || "null");
|
|
20
|
-
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 === process.env.artifact && a.state === "uploaded" && a.size > 0 && a.digest === `sha256:${prior.sha256}`);
|
|
21
|
-
const blocked = !reusable && process.env.CHANNEL === "production" && process.env.ANDROID_SIGNING_READY !== "true";
|
|
22
|
-
if (blocked) {
|
|
23
|
-
const reason = "Configure Android production signing credentials before building an AAB.";
|
|
24
|
-
console.error(`::notice::${reason}`);
|
|
25
|
-
const report = Bun.spawnSync(["node", ".github/scripts/disposabl.mjs", "report", "android", "blocked", reason], {
|
|
26
|
-
cwd: process.env.GITHUB_WORKSPACE, stdout: "inherit", stderr: "inherit",
|
|
27
|
-
});
|
|
28
|
-
if (report.exitCode) throw new Error("Cannot report Android prerequisites.");
|
|
29
|
-
}
|
|
30
|
-
console.log(`build=${blocked ? "blocked" : !reusable}\nruntime=${wanted.runtimeVersion}\nmanifest=${JSON.stringify(wanted)}\ntag=${reusable ? release.tag_name : ""}\nsha=${reusable ? prior.sha256 : ""}`);
|
|
31
|
-
' >> "$GITHUB_OUTPUT"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
artifact=android.apk
|
|
4
|
-
[[ "$CHANNEL" != production ]] || artifact=android.aab
|
|
5
|
-
mkdir -p dist/release
|
|
6
|
-
gh release download "$TAG" --pattern "$artifact" --dir dist/release
|
|
7
|
-
echo "$SHA dist/release/$artifact" | sha256sum --check
|
|
8
|
-
cd apps/mobile
|
|
9
|
-
bun x --no-install expo export --platform android --output-dir dist/update
|
|
10
|
-
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
11
|
-
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"
|
|
12
|
-
bun x "$EAS_CLI" update --platform android --channel "$CHANNEL" --environment "$EAS_ENVIRONMENT" --skip-bundler --input-dir dist/update --message "$SOURCE" --non-interactive
|
|
13
|
-
jq --arg sha "$SHA" '. + {sha256: $sha, action: "update"}' <<< "$MANIFEST" > ../../dist/release/android.json
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
|
@@ -1,28 +0,0 @@
|
|
|
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
|
|
@@ -1,14 +0,0 @@
|
|
|
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"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
check_source() { 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
|
-
check_source
|
|
5
|
-
for file in dist/release/*; do test -f "$file"; test -s "$file"; done
|
|
6
|
-
case "$PLATFORM" in
|
|
7
|
-
android) artifact=android.apk; [[ "$CHANNEL" != production ]] || artifact=android.aab; test -s "dist/release/$artifact"; test -s dist/release/android.json ;;
|
|
8
|
-
ios) test -s dist/release/ios.ipa; test -s dist/release/ios.json ;;
|
|
9
|
-
linux) compgen -G 'dist/release/*.deb' > /dev/null; compgen -G 'dist/release/*.rpm' > /dev/null ;;
|
|
10
|
-
windows) compgen -G 'dist/release/*.exe' > /dev/null; compgen -G 'dist/release/*.nupkg' > /dev/null; test -s dist/release/RELEASES ;;
|
|
11
|
-
macos) compgen -G 'dist/release/*.dmg' > /dev/null ;;
|
|
12
|
-
*) exit 1 ;;
|
|
13
|
-
esac
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
if [[ "$TRUSTED" != true ]]; then VITE_CONVEX_URL=https://ci.invalid VITE_CONVEX_SITE_URL=https://ci.invalid bun run build --filter=@disposabl/web; exit; fi
|
|
4
|
-
: "${CONVEX_DEPLOY_KEY:?Configure the Convex deployment secret for this repository}"
|
|
5
|
-
cd packages/backend
|
|
6
|
-
export AUTH_TARGET=--prod
|
|
7
|
-
target=()
|
|
8
|
-
if [[ "$CHANNEL" != production ]]; then export AUTH_TARGET="--preview-name $CHANNEL"; target=(--preview-name "$CHANNEL"); fi
|
|
9
|
-
bun x --no-install convex deploy --yes "${target[@]}" --cmd-url-env-var-name CONVEX_URL --cmd 'for name in CONVEX_URL CONVEX_SITE_URL; do value=$(printenv "$name"); test -n "$value" || exit 1; for prefix in "" VITE_ EXPO_PUBLIC_; do export "$prefix$name=$value"; printf "%s=%s\n" "$prefix$name" "$value" | tee -a "$GITHUB_ENV" >> "$GITHUB_OUTPUT"; done; done; bun x --no-install --package @convex-dev/auth auth --keys-only $AUTH_TARGET && bun run --cwd ../.. build --filter=@disposabl/web'
|
|
10
|
-
bun x --no-install static-hosting upload $AUTH_TARGET --no-spa --dist ../../apps/web/dist/client
|