create-disposabl-app 0.8.4 → 0.8.6
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 +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/default/.github/scripts/mobile.sh +12 -5
- package/dist/templates/default/.github/workflows/pipeline.yml +0 -3
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +14 -1
- package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +14 -1
- package/package.json +1 -1
package/dist/disposabl.js
CHANGED
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.6";
|
|
12
12
|
|
|
13
13
|
// ../disposabl-kit/platforms.ts
|
|
14
14
|
var platforms = [
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
|
+
manifest() {
|
|
4
|
+
bun x --no-install expo config --json | jq -ce --arg channel "${CHANNEL:-}" --arg runtime "${RUNTIME:-}" '
|
|
5
|
+
def required($name): if type == "string" and (test("[^[:space:]]")) then . else error("Missing or invalid " + $name) end;
|
|
6
|
+
{channel: ($channel | required("channel")), projectId: (.extra.eas.projectId | required("projectId")), applicationId: (.android.package | required("applicationId")), runtimeVersion: ($runtime | required("runtimeVersion") | if test("^[a-f0-9]{40,64}$") then . else error("Invalid runtimeVersion") end)}
|
|
7
|
+
'
|
|
8
|
+
}
|
|
3
9
|
case "${1:?operation required}" in
|
|
4
10
|
expo-env)
|
|
5
11
|
if [[ -z "$EXPO_PROJECT_ID" ]]; then
|
|
@@ -56,13 +62,12 @@ for ((page=1; ; page++)); do
|
|
|
56
62
|
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"
|
|
57
63
|
if jq -e '.id' "$RUNNER_TEMP/release.json" > /dev/null || [[ $(jq length "$RUNNER_TEMP/releases.json") -lt 100 ]]; then break; fi
|
|
58
64
|
done
|
|
59
|
-
bun x --no-install expo config --json > "$RUNNER_TEMP/mobile.json"
|
|
60
65
|
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}$"))')
|
|
61
66
|
export RUNTIME
|
|
67
|
+
MANIFEST=$(manifest)
|
|
68
|
+
export MANIFEST
|
|
62
69
|
bun -e '
|
|
63
|
-
const
|
|
64
|
-
if (!config.extra?.eas?.projectId) throw new Error("Link an Expo project first");
|
|
65
|
-
const wanted = {channel: process.env.CHANNEL, projectId: config.extra.eas.projectId, applicationId: config.android.package, runtimeVersion: process.env.RUNTIME};
|
|
70
|
+
const wanted = JSON.parse(process.env.MANIFEST);
|
|
66
71
|
const release = await Bun.file(`${process.env.RUNNER_TEMP}/release.json`).json();
|
|
67
72
|
const prior = JSON.parse(/<!-- android (\{[^\n]+\}) -->/.exec(release.body || "")?.[1] || "null");
|
|
68
73
|
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}`);
|
|
@@ -75,7 +80,7 @@ bun -e '
|
|
|
75
80
|
});
|
|
76
81
|
if (report.exitCode) throw new Error("Cannot report Android prerequisites.");
|
|
77
82
|
}
|
|
78
|
-
console.log(`build=${blocked ? "blocked" : !reusable}\nruntime=${wanted.runtimeVersion}\
|
|
83
|
+
console.log(`build=${blocked ? "blocked" : !reusable}\nruntime=${wanted.runtimeVersion}\ntag=${reusable ? release.tag_name : ""}\nsha=${reusable ? prior.sha256 : ""}`);
|
|
79
84
|
' >> "$GITHUB_OUTPUT"
|
|
80
85
|
;;
|
|
81
86
|
expo-update)
|
|
@@ -84,6 +89,7 @@ mkdir -p dist/release
|
|
|
84
89
|
gh release download "$TAG" --pattern "$artifact" --dir dist/release
|
|
85
90
|
echo "$SHA dist/release/$artifact" | sha256sum --check
|
|
86
91
|
cd apps/mobile
|
|
92
|
+
MANIFEST=$(manifest)
|
|
87
93
|
bun x --no-install expo export --platform android --output-dir dist/update
|
|
88
94
|
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
89
95
|
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"
|
|
@@ -91,6 +97,7 @@ bun x "$EAS_CLI" update --platform android --channel "$CHANNEL" --environment "$
|
|
|
91
97
|
jq --arg sha "$SHA" '. + {sha256: $sha, action: "update"}' <<< "$MANIFEST" > ../../dist/release/android.json
|
|
92
98
|
;;
|
|
93
99
|
android-build)
|
|
100
|
+
MANIFEST=$(manifest)
|
|
94
101
|
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"
|
|
95
102
|
if [[ "$CHANNEL" == production ]]; then
|
|
96
103
|
if [[ -n "${DISPOSABL_ANDROID_SIGNING:-}" ]]; then
|
|
@@ -46,7 +46,6 @@ jobs:
|
|
|
46
46
|
ios: ${{ steps.platforms.outputs.ios }}
|
|
47
47
|
android_build: ${{ steps.fingerprint.outputs.build }}
|
|
48
48
|
android_runtime: ${{ steps.fingerprint.outputs.runtime }}
|
|
49
|
-
android_manifest: ${{ steps.fingerprint.outputs.manifest }}
|
|
50
49
|
convex_url: ${{ steps.deploy.outputs.CONVEX_URL }}
|
|
51
50
|
convex_site_url: ${{ steps.deploy.outputs.CONVEX_SITE_URL }}
|
|
52
51
|
env:
|
|
@@ -133,7 +132,6 @@ jobs:
|
|
|
133
132
|
TAG: ${{ steps.fingerprint.outputs.tag }}
|
|
134
133
|
SHA: ${{ steps.fingerprint.outputs.sha }}
|
|
135
134
|
RUNTIME: ${{ steps.fingerprint.outputs.runtime }}
|
|
136
|
-
MANIFEST: ${{ steps.fingerprint.outputs.manifest }}
|
|
137
135
|
run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-update
|
|
138
136
|
- &publish
|
|
139
137
|
name: Publish
|
|
@@ -191,7 +189,6 @@ jobs:
|
|
|
191
189
|
env:
|
|
192
190
|
RUNTIME: ${{ needs.web.outputs.android_runtime }}
|
|
193
191
|
DISPOSABL_ANDROID_CHANNEL: *channel
|
|
194
|
-
MANIFEST: ${{ needs.web.outputs.android_manifest }}
|
|
195
192
|
DISPOSABL_ANDROID_SIGNING: ${{ github.event_name == 'push' && secrets.DISPOSABL_ANDROID_SIGNING || '' }}
|
|
196
193
|
ANDROID_KEYSTORE_BASE64: ${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_BASE64 || '' }}
|
|
197
194
|
ANDROID_KEYSTORE_PASSWORD: ${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_PASSWORD || '' }}
|
|
@@ -17,17 +17,28 @@ import { Input } from "../../components/ui/input";
|
|
|
17
17
|
import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
|
|
18
18
|
import { useSignInWithUsernamePassword } from "@convex-dev/auth/methods/username-password/react";
|
|
19
19
|
import { api } from "../../../../backend/convex/_generated/api";
|
|
20
|
-
import { useState } from "react";
|
|
20
|
+
import { useEffect, useRef, useState } from "react";
|
|
21
|
+
import { useConvexAuth } from "convex/react";
|
|
21
22
|
import { getReturnTo } from "../../lib/return-to";
|
|
22
23
|
|
|
23
24
|
export function LogIn() {
|
|
24
25
|
const { request, returnTo } = Route.useSearch();
|
|
25
26
|
const navigate = useNavigate();
|
|
27
|
+
const { isLoading, isAuthenticated } = useConvexAuth();
|
|
28
|
+
const submitted = useRef(false);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!isLoading && isAuthenticated && !submitted.current) {
|
|
32
|
+
void navigate({ to: "/", replace: true });
|
|
33
|
+
}
|
|
34
|
+
}, [isLoading, isAuthenticated, navigate]);
|
|
26
35
|
const { signIn, pending } = useSignInWithUsernamePassword(api.auth);
|
|
27
36
|
const [username, setUsername] = useState("");
|
|
28
37
|
const [password, setPassword] = useState("");
|
|
29
38
|
const [error, setError] = useState<string | null>(null);
|
|
30
39
|
|
|
40
|
+
if (isLoading || (isAuthenticated && !submitted.current)) return null;
|
|
41
|
+
|
|
31
42
|
return (
|
|
32
43
|
<main className="flex min-h-[calc(100svh-73px)] flex-col items-center justify-center bg-muted p-6 md:p-10">
|
|
33
44
|
<div className="flex w-full max-w-sm flex-col gap-6">
|
|
@@ -45,6 +56,7 @@ export function LogIn() {
|
|
|
45
56
|
<form
|
|
46
57
|
onSubmit={async (e) => {
|
|
47
58
|
e.preventDefault();
|
|
59
|
+
submitted.current = true;
|
|
48
60
|
setError(null);
|
|
49
61
|
const result = await signIn({ username, password });
|
|
50
62
|
if (result.status === "complete") {
|
|
@@ -53,6 +65,7 @@ export function LogIn() {
|
|
|
53
65
|
else window.location.assign(returnTo ?? "/dashboard");
|
|
54
66
|
return;
|
|
55
67
|
}
|
|
68
|
+
submitted.current = false;
|
|
56
69
|
setError(() => {
|
|
57
70
|
switch (result.userError.error) {
|
|
58
71
|
case "USER_NOT_FOUND":
|
|
@@ -18,17 +18,28 @@ import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
|
|
|
18
18
|
import { DEFAULT_MIN_PASSWORD_LENGTH } from "@convex-dev/auth/methods/username-password";
|
|
19
19
|
import { useSignUpWithUsernamePassword } from "@convex-dev/auth/methods/username-password/react";
|
|
20
20
|
import { api } from "../../../../backend/convex/_generated/api";
|
|
21
|
-
import { useState } from "react";
|
|
21
|
+
import { useEffect, useRef, useState } from "react";
|
|
22
|
+
import { useConvexAuth } from "convex/react";
|
|
22
23
|
import { getReturnTo } from "../../lib/return-to";
|
|
23
24
|
|
|
24
25
|
export function SignUp() {
|
|
25
26
|
const { request, returnTo } = Route.useSearch();
|
|
26
27
|
const navigate = useNavigate();
|
|
28
|
+
const { isLoading, isAuthenticated } = useConvexAuth();
|
|
29
|
+
const submitted = useRef(false);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!isLoading && isAuthenticated && !submitted.current) {
|
|
33
|
+
void navigate({ to: "/", replace: true });
|
|
34
|
+
}
|
|
35
|
+
}, [isLoading, isAuthenticated, navigate]);
|
|
27
36
|
const { signUp, pending } = useSignUpWithUsernamePassword(api.auth);
|
|
28
37
|
const [username, setUsername] = useState("");
|
|
29
38
|
const [password, setPassword] = useState("");
|
|
30
39
|
const [error, setError] = useState<string | null>(null);
|
|
31
40
|
|
|
41
|
+
if (isLoading || (isAuthenticated && !submitted.current)) return null;
|
|
42
|
+
|
|
32
43
|
return (
|
|
33
44
|
<main className="flex min-h-[calc(100svh-73px)] flex-col items-center justify-center bg-muted p-6 md:p-10">
|
|
34
45
|
<div className="flex w-full max-w-sm flex-col gap-6">
|
|
@@ -46,6 +57,7 @@ export function SignUp() {
|
|
|
46
57
|
<form
|
|
47
58
|
onSubmit={async (e) => {
|
|
48
59
|
e.preventDefault();
|
|
60
|
+
submitted.current = true;
|
|
49
61
|
setError(null);
|
|
50
62
|
const result = await signUp({ username, password });
|
|
51
63
|
if (result.status === "complete") {
|
|
@@ -54,6 +66,7 @@ export function SignUp() {
|
|
|
54
66
|
else window.location.assign(returnTo ?? "/dashboard");
|
|
55
67
|
return;
|
|
56
68
|
}
|
|
69
|
+
submitted.current = false;
|
|
57
70
|
setError(() => {
|
|
58
71
|
switch (result.userError.error) {
|
|
59
72
|
case "USERNAME_TAKEN":
|