create-croissant 0.1.45 → 0.1.46
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/add.js +8 -8
- package/dist/index.js +8 -8
- package/package.json +10 -10
- package/template/.env.example +2 -2
- package/template/.github/dependabot.yml +15 -0
- package/template/.github/workflows/ci.yml +143 -0
- package/template/.github/workflows/dependabot-automerge.yml +23 -0
- package/template/.husky/pre-push +0 -0
- package/template/README.md +23 -23
- package/template/apps/desktop/README.md +5 -5
- package/template/apps/desktop/package.json +5 -5
- package/template/apps/mobile/README.md +3 -3
- package/template/apps/mobile/app/(tabs)/explore.tsx +1 -0
- package/template/apps/mobile/app/(tabs)/index.tsx +23 -27
- package/template/apps/mobile/app/index.tsx +9 -16
- package/template/apps/mobile/app.json +6 -1
- package/template/apps/mobile/lib/auth-client.ts +1 -1
- package/template/apps/mobile/lib/orpc.ts +10 -5
- package/template/apps/mobile/package.json +6 -5
- package/template/apps/mobile/scripts/reset-project.js +0 -0
- package/template/apps/platform/.env.example +1 -1
- package/template/apps/platform/package.json +8 -5
- package/template/apps/platform/portless.json +3 -0
- package/template/apps/platform/src/router.tsx +0 -1
- package/template/package.json +21 -16
- package/template/packages/auth/package.json +2 -2
- package/template/packages/db/package.json +1 -1
- package/template/packages/orpc/package.json +4 -3
- package/template/packages/ui/package.json +3 -2
- package/template/pnpm-workspace.yaml +3 -0
- package/template/.expo/README.md +0 -13
- package/template/.expo/devices.json +0 -3
- package/template/packages/orpc/node_modules/@types/node/LICENSE +0 -21
- package/template/packages/orpc/node_modules/@types/node/README.md +0 -15
- package/template/packages/orpc/node_modules/@types/node/assert/strict.d.ts +0 -111
- package/template/packages/orpc/node_modules/@types/node/assert.d.ts +0 -1078
- package/template/packages/orpc/node_modules/@types/node/async_hooks.d.ts +0 -603
- package/template/packages/orpc/node_modules/@types/node/buffer.buffer.d.ts +0 -472
- package/template/packages/orpc/node_modules/@types/node/buffer.d.ts +0 -1934
- package/template/packages/orpc/node_modules/@types/node/child_process.d.ts +0 -1476
- package/template/packages/orpc/node_modules/@types/node/cluster.d.ts +0 -578
- package/template/packages/orpc/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
- package/template/packages/orpc/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/template/packages/orpc/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/template/packages/orpc/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
- package/template/packages/orpc/node_modules/@types/node/console.d.ts +0 -452
- package/template/packages/orpc/node_modules/@types/node/constants.d.ts +0 -21
- package/template/packages/orpc/node_modules/@types/node/crypto.d.ts +0 -4545
- package/template/packages/orpc/node_modules/@types/node/dgram.d.ts +0 -600
- package/template/packages/orpc/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
- package/template/packages/orpc/node_modules/@types/node/dns/promises.d.ts +0 -503
- package/template/packages/orpc/node_modules/@types/node/dns.d.ts +0 -923
- package/template/packages/orpc/node_modules/@types/node/domain.d.ts +0 -170
- package/template/packages/orpc/node_modules/@types/node/events.d.ts +0 -976
- package/template/packages/orpc/node_modules/@types/node/fs/promises.d.ts +0 -1295
- package/template/packages/orpc/node_modules/@types/node/fs.d.ts +0 -4461
- package/template/packages/orpc/node_modules/@types/node/globals.d.ts +0 -172
- package/template/packages/orpc/node_modules/@types/node/globals.typedarray.d.ts +0 -38
- package/template/packages/orpc/node_modules/@types/node/http.d.ts +0 -2089
- package/template/packages/orpc/node_modules/@types/node/http2.d.ts +0 -2644
- package/template/packages/orpc/node_modules/@types/node/https.d.ts +0 -579
- package/template/packages/orpc/node_modules/@types/node/index.d.ts +0 -97
- package/template/packages/orpc/node_modules/@types/node/inspector.d.ts +0 -253
- package/template/packages/orpc/node_modules/@types/node/inspector.generated.d.ts +0 -4052
- package/template/packages/orpc/node_modules/@types/node/module.d.ts +0 -891
- package/template/packages/orpc/node_modules/@types/node/net.d.ts +0 -1076
- package/template/packages/orpc/node_modules/@types/node/os.d.ts +0 -506
- package/template/packages/orpc/node_modules/@types/node/package.json +0 -145
- package/template/packages/orpc/node_modules/@types/node/path.d.ts +0 -200
- package/template/packages/orpc/node_modules/@types/node/perf_hooks.d.ts +0 -968
- package/template/packages/orpc/node_modules/@types/node/process.d.ts +0 -2084
- package/template/packages/orpc/node_modules/@types/node/punycode.d.ts +0 -117
- package/template/packages/orpc/node_modules/@types/node/querystring.d.ts +0 -152
- package/template/packages/orpc/node_modules/@types/node/readline/promises.d.ts +0 -161
- package/template/packages/orpc/node_modules/@types/node/readline.d.ts +0 -594
- package/template/packages/orpc/node_modules/@types/node/repl.d.ts +0 -428
- package/template/packages/orpc/node_modules/@types/node/sea.d.ts +0 -153
- package/template/packages/orpc/node_modules/@types/node/sqlite.d.ts +0 -721
- package/template/packages/orpc/node_modules/@types/node/stream/consumers.d.ts +0 -38
- package/template/packages/orpc/node_modules/@types/node/stream/promises.d.ts +0 -90
- package/template/packages/orpc/node_modules/@types/node/stream/web.d.ts +0 -622
- package/template/packages/orpc/node_modules/@types/node/stream.d.ts +0 -1687
- package/template/packages/orpc/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/template/packages/orpc/node_modules/@types/node/test.d.ts +0 -2163
- package/template/packages/orpc/node_modules/@types/node/timers/promises.d.ts +0 -108
- package/template/packages/orpc/node_modules/@types/node/timers.d.ts +0 -287
- package/template/packages/orpc/node_modules/@types/node/tls.d.ts +0 -1319
- package/template/packages/orpc/node_modules/@types/node/trace_events.d.ts +0 -197
- package/template/packages/orpc/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -468
- package/template/packages/orpc/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -34
- package/template/packages/orpc/node_modules/@types/node/ts5.6/index.d.ts +0 -97
- package/template/packages/orpc/node_modules/@types/node/tty.d.ts +0 -208
- package/template/packages/orpc/node_modules/@types/node/url.d.ts +0 -984
- package/template/packages/orpc/node_modules/@types/node/util.d.ts +0 -2606
- package/template/packages/orpc/node_modules/@types/node/v8.d.ts +0 -920
- package/template/packages/orpc/node_modules/@types/node/vm.d.ts +0 -1000
- package/template/packages/orpc/node_modules/@types/node/wasi.d.ts +0 -181
- package/template/packages/orpc/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
- package/template/packages/orpc/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
- package/template/packages/orpc/node_modules/@types/node/web-globals/events.d.ts +0 -97
- package/template/packages/orpc/node_modules/@types/node/web-globals/fetch.d.ts +0 -55
- package/template/packages/orpc/node_modules/@types/node/web-globals/navigator.d.ts +0 -22
- package/template/packages/orpc/node_modules/@types/node/web-globals/storage.d.ts +0 -24
- package/template/packages/orpc/node_modules/@types/node/worker_threads.d.ts +0 -784
- package/template/packages/orpc/node_modules/@types/node/zlib.d.ts +0 -747
- package/template/packages/orpc/node_modules/undici-types/LICENSE +0 -21
- package/template/packages/orpc/node_modules/undici-types/README.md +0 -6
- package/template/packages/orpc/node_modules/undici-types/agent.d.ts +0 -31
- package/template/packages/orpc/node_modules/undici-types/api.d.ts +0 -43
- package/template/packages/orpc/node_modules/undici-types/balanced-pool.d.ts +0 -29
- package/template/packages/orpc/node_modules/undici-types/cache.d.ts +0 -36
- package/template/packages/orpc/node_modules/undici-types/client.d.ts +0 -108
- package/template/packages/orpc/node_modules/undici-types/connector.d.ts +0 -34
- package/template/packages/orpc/node_modules/undici-types/content-type.d.ts +0 -21
- package/template/packages/orpc/node_modules/undici-types/cookies.d.ts +0 -28
- package/template/packages/orpc/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
- package/template/packages/orpc/node_modules/undici-types/dispatcher.d.ts +0 -256
- package/template/packages/orpc/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
- package/template/packages/orpc/node_modules/undici-types/errors.d.ts +0 -149
- package/template/packages/orpc/node_modules/undici-types/eventsource.d.ts +0 -61
- package/template/packages/orpc/node_modules/undici-types/fetch.d.ts +0 -209
- package/template/packages/orpc/node_modules/undici-types/file.d.ts +0 -39
- package/template/packages/orpc/node_modules/undici-types/filereader.d.ts +0 -54
- package/template/packages/orpc/node_modules/undici-types/formdata.d.ts +0 -108
- package/template/packages/orpc/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/template/packages/orpc/node_modules/undici-types/global-origin.d.ts +0 -7
- package/template/packages/orpc/node_modules/undici-types/handlers.d.ts +0 -15
- package/template/packages/orpc/node_modules/undici-types/header.d.ts +0 -4
- package/template/packages/orpc/node_modules/undici-types/index.d.ts +0 -71
- package/template/packages/orpc/node_modules/undici-types/interceptors.d.ts +0 -17
- package/template/packages/orpc/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/template/packages/orpc/node_modules/undici-types/mock-client.d.ts +0 -25
- package/template/packages/orpc/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/template/packages/orpc/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/template/packages/orpc/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/template/packages/orpc/node_modules/undici-types/package.json +0 -55
- package/template/packages/orpc/node_modules/undici-types/patch.d.ts +0 -33
- package/template/packages/orpc/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/template/packages/orpc/node_modules/undici-types/pool.d.ts +0 -39
- package/template/packages/orpc/node_modules/undici-types/proxy-agent.d.ts +0 -28
- package/template/packages/orpc/node_modules/undici-types/readable.d.ts +0 -65
- package/template/packages/orpc/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/template/packages/orpc/node_modules/undici-types/retry-handler.d.ts +0 -116
- package/template/packages/orpc/node_modules/undici-types/util.d.ts +0 -18
- package/template/packages/orpc/node_modules/undici-types/webidl.d.ts +0 -228
- package/template/packages/orpc/node_modules/undici-types/websocket.d.ts +0 -150
package/dist/add.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import i from"path";import{fileURLToPath as E}from"url";import s from"chalk";import{Command as P}from"commander";import{execa as j}from"execa";import
|
|
2
|
+
import i from"path";import{fileURLToPath as E}from"url";import s from"chalk";import{Command as P}from"commander";import{execa as j}from"execa";import t from"fs-extra";import k from"inquirer";import g from"ora";var A=E(import.meta.url),x=i.dirname(A),v=new P;v.name("croissant-add").description("Add a mobile or desktop app to an existing Croissant Stack project").action(async()=>{console.log(s.bold.yellow(`
|
|
3
3
|
\u{1F950} Croissant Stack: Add App
|
|
4
|
-
`));let p=i.join(process.cwd(),"package.json");await
|
|
4
|
+
`));let p=i.join(process.cwd(),"package.json");await t.pathExists(p)||(console.error(s.red(`
|
|
5
5
|
Error: package.json not found. Are you in the root of your project?
|
|
6
|
-
`)),process.exit(1));let
|
|
6
|
+
`)),process.exit(1));let e=await t.readJson(p);(!e.scripts||!e.scripts.dev&&!e.scripts.build)&&(console.error(s.red(`
|
|
7
7
|
Error: This doesn't look like a Croissant Stack project.
|
|
8
|
-
`)),process.exit(1));let u=i.join(process.cwd(),"apps/mobile"),h=i.join(process.cwd(),"apps/desktop"),
|
|
9
|
-
`));return}let l=[];
|
|
8
|
+
`)),process.exit(1));let u=i.join(process.cwd(),"apps/mobile"),h=i.join(process.cwd(),"apps/desktop"),b=await t.pathExists(u),f=await t.pathExists(h);if(b&&f){console.log(s.blue(`Both mobile and desktop apps are already present. Nothing to add!
|
|
9
|
+
`));return}let l=[];b||l.push({name:"Mobile App (Expo)",value:"mobile"}),f||l.push({name:"Desktop App (Electron)",value:"desktop"});let{type:a}=await k.prompt([{type:"list",name:"type",message:"Which app would you like to add?",choices:l}]),c=process.cwd(),w=g(`Adding ${a} app...`).start();try{let n=i.join(x,"..","template");if(await t.pathExists(n)||(n=i.resolve(x,"../../..")),a==="mobile"){let r=i.join(n,"apps/mobile");await t.copy(r,u),e.scripts=e.scripts||{},e.scripts["dev:mobile"]="turbo run dev --filter=mobile",e.scripts["dev:ios"]="turbo run dev --filter=mobile -- --ios",e.scripts["dev:android"]="turbo run dev --filter=mobile -- --android",e.scripts["build:mobile"]="turbo run build --filter=mobile",await t.writeJson(p,e,{spaces:2});let d=i.join(c,"packages/auth/src/lib/auth.ts");if(await t.pathExists(d)){let o=await t.readFile(d,"utf8");o.includes("@better-auth/expo")||(o=`import { expo } from "@better-auth/expo";
|
|
10
10
|
${o}`),o.includes("plugins: [expo()]")||(o=o.replace("emailAndPassword: { enabled: true },",`emailAndPassword: { enabled: true },
|
|
11
11
|
plugins: [expo()],
|
|
12
12
|
trustedOrigins: [
|
|
@@ -19,7 +19,7 @@ ${o}`),o.includes("plugins: [expo()]")||(o=o.replace("emailAndPassword: { enable
|
|
|
19
19
|
"http://localhost:8081",
|
|
20
20
|
]
|
|
21
21
|
: []),
|
|
22
|
-
],`)),await
|
|
23
|
-
Next steps:`)),console.log(a==="mobile"?"
|
|
22
|
+
],`)),await t.writeFile(d,o)}let m=i.join(c,"packages/auth/package.json");if(await t.pathExists(m)){let o=await t.readJson(m);o.dependencies=o.dependencies||{},o.dependencies["@better-auth/expo"]||(o.dependencies["@better-auth/expo"]="latest",await t.writeJson(m,o,{spaces:2}))}}else if(a==="desktop"){let r=i.join(n,"apps/desktop");await t.copy(r,h),e.scripts=e.scripts||{},e.scripts["dev:desktop"]="turbo run dev --filter=desktop",e.scripts["build:desktop"]="turbo run build --filter=desktop",await t.writeJson(p,e,{spaces:2})}w.succeed(s.green(`${a==="mobile"?"Mobile":"Desktop"} app added successfully!`));let{install:y}=await k.prompt([{type:"confirm",name:"install",message:"Would you like to install dependencies now?",default:!0}]);if(y){let r=g("Installing dependencies...").start();try{await j("pnpm",["install"],{cwd:c}),r.succeed(s.green("Dependencies installed!"))}catch{r.fail(s.red("Failed to install dependencies. Run pnpm install manually."))}}console.log(s.bold.cyan(`
|
|
23
|
+
Next steps:`)),console.log(a==="mobile"?" pnpm run dev:mobile # Start Expo development server":" pnpm run dev:desktop # Start Electron development server"),console.log(s.yellow(`
|
|
24
24
|
Happy hacking! \u{1F950}
|
|
25
|
-
`))}catch(n){w.fail(s.red(`An error occurred while adding the ${a} app.`)),console.error(n),process.exit(1)}});
|
|
25
|
+
`))}catch(n){w.fail(s.red(`An error occurred while adding the ${a} app.`)),console.error(n),process.exit(1)}});v.parse(process.argv);
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import i from"path";import{fileURLToPath as
|
|
2
|
+
import i from"path";import{fileURLToPath as k}from"url";import p from"chalk";import{Command as b}from"commander";import{execa as P}from"execa";import e from"fs-extra";import y from"inquirer";import g from"ora";var j=k(import.meta.url),w=i.dirname(j),x=new b;x.name("create-croissant").description("Scaffold a new project using the Croissant Stack").argument("[project-name]","Name of the project").action(async u=>{console.log(p.bold.yellow(`
|
|
3
3
|
\u{1F950} Welcome to the Croissant Stack!
|
|
4
|
-
`));let l=await y.prompt([{type:"input",name:"name",message:"What is your project named?",default:
|
|
5
|
-
Error: Directory ${
|
|
6
|
-
`)),process.exit(1));let
|
|
4
|
+
`));let l=await y.prompt([{type:"input",name:"name",message:"What is your project named?",default:u||"my-croissant-app",when:!u},{type:"confirm",name:"install",message:"Would you like to install dependencies?",default:!0},{type:"confirm",name:"mobile",message:"Would you like to include the mobile app (Expo)?",default:!0},{type:"confirm",name:"desktop",message:"Would you like to include the desktop app (Electron)?",default:!0}]),c=u||l.name,s=i.resolve(process.cwd(),c);e.existsSync(s)&&(console.error(p.red(`
|
|
5
|
+
Error: Directory ${c} already exists.
|
|
6
|
+
`)),process.exit(1));let f=g("Scaffolding your project...").start();try{await e.ensureDir(s);let d=i.join(w,"..","template");if(await e.pathExists(d))await e.copy(d,s);else{let a=i.resolve(w,"../../.."),n=["node_modules","dist",".git","packages/create-croissant",".turbo","pnpm-lock.yaml"];await e.copy(a,s,{filter:t=>{let r=i.relative(a,t);return!n.some(o=>r.startsWith(o))}})}if(l.mobile){let a=i.join(s,"packages/auth/src/lib/auth.ts");if(await e.pathExists(a)){let t=await e.readFile(a,"utf8");t.includes("@better-auth/expo")||(t=`import { expo } from "@better-auth/expo";
|
|
7
7
|
${t}`),t.includes("plugins: [expo()]")||(t=t.replace("emailAndPassword: { enabled: true },",`emailAndPassword: { enabled: true },
|
|
8
8
|
plugins: [expo()],
|
|
9
9
|
trustedOrigins: [
|
|
@@ -16,7 +16,7 @@ ${t}`),t.includes("plugins: [expo()]")||(t=t.replace("emailAndPassword: { enable
|
|
|
16
16
|
"http://localhost:8081",
|
|
17
17
|
]
|
|
18
18
|
: []),
|
|
19
|
-
],`)),await e.writeFile(a,t)}let n=i.join(s,"packages/auth/package.json");if(await e.pathExists(n)){let t=await e.readJson(n);t.dependencies=t.dependencies||{},t.dependencies["@better-auth/expo"]||(t.dependencies["@better-auth/expo"]="latest",await e.writeJson(n,t,{spaces:2}))}}else{let a=i.join(s,"apps/mobile");if(await e.pathExists(a)){await e.remove(a);let n=i.join(s,"package.json");if(await e.pathExists(n)){let o=await e.readJson(n);o.scripts&&Object.keys(o.scripts).forEach(
|
|
20
|
-
Next steps:`)),console.log(` cd ${
|
|
21
|
-
`),console.log(
|
|
22
|
-
`))}catch(d){
|
|
19
|
+
],`)),await e.writeFile(a,t)}let n=i.join(s,"packages/auth/package.json");if(await e.pathExists(n)){let t=await e.readJson(n);t.dependencies=t.dependencies||{},t.dependencies["@better-auth/expo"]||(t.dependencies["@better-auth/expo"]="latest",await e.writeJson(n,t,{spaces:2}))}}else{let a=i.join(s,"apps/mobile");if(await e.pathExists(a)){await e.remove(a);let n=i.join(s,"package.json");if(await e.pathExists(n)){let o=await e.readJson(n);o.scripts&&Object.keys(o.scripts).forEach(m=>{(m.includes("mobile")||m.includes("ios")||m.includes("android"))&&delete o.scripts[m]}),await e.writeJson(n,o,{spaces:2})}let t=i.join(s,"packages/auth/src/lib/auth.ts");if(await e.pathExists(t)){let o=await e.readFile(t,"utf8");o=o.replace(/import \{ expo \} from "@better-auth\/expo";\n/,""),o=o.replace(/\s+plugins: \[expo\(\)\],/,""),o=o.replace(/\s+trustedOrigins: \[[\s\S]*?\],/,""),await e.writeFile(t,o)}let r=i.join(s,"packages/auth/package.json");if(await e.pathExists(r)){let o=await e.readJson(r);o.dependencies&&o.dependencies["@better-auth/expo"]&&(delete o.dependencies["@better-auth/expo"],await e.writeJson(r,o,{spaces:2}))}}}if(!l.desktop){let a=i.join(s,"apps/desktop");if(await e.pathExists(a)){await e.remove(a);let n=i.join(s,"package.json");if(await e.pathExists(n)){let t=await e.readJson(n);t.scripts&&Object.keys(t.scripts).forEach(r=>{r.includes("desktop")&&delete t.scripts[r]}),await e.writeJson(n,t,{spaces:2})}}}let h=i.join(s,"package.json");if(await e.pathExists(h)){let a=await e.readJson(h);a.name=c,a.version="0.1.0",delete a.private,await e.writeJson(h,a,{spaces:2})}if(f.succeed(p.green(`Project ${c} created at ${s}`)),l.install){let a=g("Installing dependencies...").start();try{await P("pnpm",["install"],{cwd:s}),a.succeed(p.green("Dependencies installed!"))}catch{a.fail(p.red("Failed to install dependencies. You may need to run pnpm install manually."))}}console.log(p.bold.cyan(`
|
|
20
|
+
Next steps:`)),console.log(` cd ${c}`),console.log(" pnpm run db:up # Start your PostgreSQL database"),console.log(` pnpm run dev # Start development server
|
|
21
|
+
`),console.log(p.yellow(`Happy hacking! \u{1F950}
|
|
22
|
+
`))}catch(d){f.fail(p.red("An error occurred during scaffolding.")),console.error(d),process.exit(1)}});x.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-croissant",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"description": "Scaffold a new project using the Croissant Stack",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,12 +20,6 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "npm run prepare-template && tsup src/index.ts src/add.ts --format esm --clean --minify",
|
|
25
|
-
"dev": "tsup src/index.ts src/add.ts --format esm --watch",
|
|
26
|
-
"typecheck": "tsc --noEmit",
|
|
27
|
-
"prepare-template": "node scripts/prepare-template.js"
|
|
28
|
-
},
|
|
29
23
|
"dependencies": {
|
|
30
24
|
"chalk": "^5.6.2",
|
|
31
25
|
"commander": "^14.0.3",
|
|
@@ -38,7 +32,13 @@
|
|
|
38
32
|
"@types/fs-extra": "^11.0.4",
|
|
39
33
|
"@types/inquirer": "^9.0.9",
|
|
40
34
|
"@types/node": "^25.6.0",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
35
|
+
"tsup": "^8.5.1",
|
|
36
|
+
"@workspace/config-typescript": "0.0.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "pnpm run prepare-template && tsup src/index.ts src/add.ts --format esm --clean --minify",
|
|
40
|
+
"dev": "tsup src/index.ts src/add.ts --format esm --watch",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"prepare-template": "node scripts/prepare-template.js"
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|
package/template/.env.example
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/auth
|
|
2
|
-
BETTER_AUTH_URL=
|
|
2
|
+
BETTER_AUTH_URL=https://platform.local
|
|
3
3
|
BETTER_AUTH_SECRET=your-secret-here
|
|
4
4
|
# For production, set this to your domain
|
|
5
|
-
# NEXT_PUBLIC_APP_URL=
|
|
5
|
+
# NEXT_PUBLIC_APP_URL=https://platform.local
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pnpm"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
open-pull-requests-limit: 10
|
|
8
|
+
groups:
|
|
9
|
+
dependencies:
|
|
10
|
+
patterns:
|
|
11
|
+
- "*"
|
|
12
|
+
- package-ecosystem: "github-actions"
|
|
13
|
+
directory: "/"
|
|
14
|
+
schedule:
|
|
15
|
+
interval: "monthly"
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
name: Build and Test
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout Repo
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: 24
|
|
27
|
+
|
|
28
|
+
- name: Setup pnpm
|
|
29
|
+
uses: pnpm/action-setup@v4
|
|
30
|
+
with:
|
|
31
|
+
version: 9.15.0
|
|
32
|
+
run_install: false
|
|
33
|
+
|
|
34
|
+
- name: Get pnpm store directory
|
|
35
|
+
shell: bash
|
|
36
|
+
run: |
|
|
37
|
+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
38
|
+
|
|
39
|
+
- name: Setup pnpm cache
|
|
40
|
+
uses: actions/cache@v4
|
|
41
|
+
with:
|
|
42
|
+
path: ${{ env.STORE_PATH }}
|
|
43
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
44
|
+
restore-keys: |
|
|
45
|
+
${{ runner.os }}-pnpm-store-
|
|
46
|
+
|
|
47
|
+
- name: Install Dependencies
|
|
48
|
+
run: pnpm install
|
|
49
|
+
|
|
50
|
+
- name: Lint
|
|
51
|
+
run: pnpm run lint
|
|
52
|
+
|
|
53
|
+
- name: Typecheck
|
|
54
|
+
run: pnpm run typecheck
|
|
55
|
+
|
|
56
|
+
- name: Build
|
|
57
|
+
run: pnpm run build
|
|
58
|
+
|
|
59
|
+
release:
|
|
60
|
+
name: Release create-croissant
|
|
61
|
+
needs: build
|
|
62
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- name: Checkout Repo
|
|
66
|
+
uses: actions/checkout@v4
|
|
67
|
+
with:
|
|
68
|
+
fetch-depth: 0
|
|
69
|
+
|
|
70
|
+
- name: Setup Node.js
|
|
71
|
+
uses: actions/setup-node@v4
|
|
72
|
+
with:
|
|
73
|
+
node-version: 24
|
|
74
|
+
registry-url: "https://registry.npmjs.org"
|
|
75
|
+
|
|
76
|
+
- name: Setup pnpm
|
|
77
|
+
uses: pnpm/action-setup@v4
|
|
78
|
+
with:
|
|
79
|
+
version: 9.15.0
|
|
80
|
+
run_install: false
|
|
81
|
+
|
|
82
|
+
- name: Install Dependencies
|
|
83
|
+
run: pnpm install
|
|
84
|
+
|
|
85
|
+
- name: Bump Version and Publish
|
|
86
|
+
run: |
|
|
87
|
+
# Configure git
|
|
88
|
+
git config --global user.name "github-actions[bot]"
|
|
89
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
90
|
+
|
|
91
|
+
# Prepare the template from the latest monorepo state
|
|
92
|
+
pnpm --filter create-croissant run prepare-template
|
|
93
|
+
|
|
94
|
+
# Move into the package directory for versioning and publishing
|
|
95
|
+
cd packages/create-croissant
|
|
96
|
+
|
|
97
|
+
# Get the latest version from npm to avoid conflicts
|
|
98
|
+
NPM_VERSION=$(pnpm view create-croissant version 2>/dev/null || echo "0.0.0")
|
|
99
|
+
LOCAL_VERSION=$(node -p "require('./package.json').version")
|
|
100
|
+
|
|
101
|
+
echo "NPM version: $NPM_VERSION"
|
|
102
|
+
echo "Local version: $LOCAL_VERSION"
|
|
103
|
+
|
|
104
|
+
# If npm has a higher version, sync local version first
|
|
105
|
+
if [ "$NPM_VERSION" != "$LOCAL_VERSION" ] && [ "$(printf '%s\n' "$NPM_VERSION" "$LOCAL_VERSION" | sort -V | tail -n1)" = "$NPM_VERSION" ] && [ "$NPM_VERSION" != "0.0.0" ]; then
|
|
106
|
+
echo "Syncing local version to $NPM_VERSION to avoid conflict"
|
|
107
|
+
npm version $NPM_VERSION --no-git-tag-version
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
# Bump version (patch)
|
|
111
|
+
npm version patch --no-git-tag-version
|
|
112
|
+
|
|
113
|
+
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
114
|
+
echo "New version to be published: $NEW_VERSION"
|
|
115
|
+
|
|
116
|
+
# Build the package
|
|
117
|
+
pnpm run build
|
|
118
|
+
|
|
119
|
+
# Publish to npm (using Trusted Publishing)
|
|
120
|
+
pnpm publish --provenance --access public --no-git-checks
|
|
121
|
+
|
|
122
|
+
# Go back to root for git operations
|
|
123
|
+
cd ../..
|
|
124
|
+
|
|
125
|
+
# After successful publish, commit the version change and tag it
|
|
126
|
+
git add packages/create-croissant/package.json
|
|
127
|
+
git commit -m "chore: release create-croissant v$NEW_VERSION [skip ci]"
|
|
128
|
+
git tag "v$NEW_VERSION"
|
|
129
|
+
|
|
130
|
+
# Push the version bump commit and tag back to main
|
|
131
|
+
git push origin main --follow-tags
|
|
132
|
+
|
|
133
|
+
# Create a GitHub Release
|
|
134
|
+
# --generate-notes automatically creates a changelog based on commits
|
|
135
|
+
# We use --target main to ensure the release is associated with the pushed branch
|
|
136
|
+
gh release create "v$NEW_VERSION" \
|
|
137
|
+
--target main \
|
|
138
|
+
--title "Release v$NEW_VERSION (create-croissant)" \
|
|
139
|
+
--generate-notes \
|
|
140
|
+
--latest
|
|
141
|
+
env:
|
|
142
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
143
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Dependabot Auto-Merge
|
|
2
|
+
on: pull_request
|
|
3
|
+
|
|
4
|
+
permissions:
|
|
5
|
+
contents: write
|
|
6
|
+
pull-requests: write
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
dependabot:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
if: github.actor == 'dependabot[bot]'
|
|
12
|
+
steps:
|
|
13
|
+
- name: Dependabot metadata
|
|
14
|
+
id: metadata
|
|
15
|
+
uses: dependabot/fetch-metadata@v3
|
|
16
|
+
with:
|
|
17
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
18
|
+
- name: Enable auto-merge for Dependabot PRs
|
|
19
|
+
if: steps.metadata.outputs.update-type != 'version-update:semver-major'
|
|
20
|
+
run: gh pr merge --auto --squash "$PR_URL"
|
|
21
|
+
env:
|
|
22
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
|
23
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
package/template/.husky/pre-push
CHANGED
|
File without changes
|
package/template/README.md
CHANGED
|
@@ -7,7 +7,7 @@ A modern, type-safe full-stack monorepo powered by **TanStack Start**, **Better
|
|
|
7
7
|
The fastest way to scaffold a new project with the Croissant Stack is using our CLI:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
pnpm dlx create-croissant@latest
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
---
|
|
@@ -21,7 +21,7 @@ npx create-croissant@latest
|
|
|
21
21
|
- **API**: [oRPC](https://orpc.sh/) with a modular, namespaced router for end-to-end type-safety.
|
|
22
22
|
- **Database**: [Drizzle ORM](https://orm.drizzle.team/) with PostgreSQL and Docker Compose setup.
|
|
23
23
|
- **Styling**: [shadcn/ui](https://ui.shadcn.com/) components with Tailwind CSS.
|
|
24
|
-
- **Monorepo Management**: Powered by [Turborepo](https://turbo.build/) for lightning-fast builds and smart task orchestration.
|
|
24
|
+
- **Monorepo Management**: Powered by [pnpm](https://pnpm.io/) and [Turborepo](https://turbo.build/) for lightning-fast builds and smart task orchestration.
|
|
25
25
|
- **Developer Experience**:
|
|
26
26
|
- Path aliases (`@/`) for clean imports.
|
|
27
27
|
- Strict TypeScript across the entire stack.
|
|
@@ -47,7 +47,7 @@ npx create-croissant@latest
|
|
|
47
47
|
### 1. Install Dependencies
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
|
|
50
|
+
pnpm install
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
### 2. Set Up the Database
|
|
@@ -55,7 +55,7 @@ npm install
|
|
|
55
55
|
Start the PostgreSQL database using Docker Compose:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
|
|
58
|
+
pnpm run db:up
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
This command runs a PostgreSQL container named `samstack` on port `5432`.
|
|
@@ -72,7 +72,7 @@ Ensure you provide the necessary variables:
|
|
|
72
72
|
|
|
73
73
|
```env
|
|
74
74
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/auth
|
|
75
|
-
BETTER_AUTH_URL=
|
|
75
|
+
BETTER_AUTH_URL=https://platform.local
|
|
76
76
|
BETTER_AUTH_SECRET=your-secret-here
|
|
77
77
|
```
|
|
78
78
|
|
|
@@ -82,36 +82,36 @@ Synchronize your schema with the database:
|
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
# From packages/db or via turbo
|
|
85
|
-
|
|
85
|
+
pnpm run db:push --filter @workspace/db
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
### 5. Run Development Server
|
|
89
89
|
|
|
90
90
|
```bash
|
|
91
|
-
|
|
91
|
+
pnpm run dev
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
The web application will be available at `
|
|
94
|
+
The web application will be available at `https://platform.local`.
|
|
95
95
|
|
|
96
96
|
## 📦 Scripts
|
|
97
97
|
|
|
98
98
|
All scripts are orchestrated by Turborepo. You can run them from the root directory:
|
|
99
99
|
|
|
100
100
|
### Core Scripts
|
|
101
|
-
- `
|
|
102
|
-
- `
|
|
103
|
-
- `
|
|
104
|
-
- `
|
|
105
|
-
- `
|
|
106
|
-
- `
|
|
101
|
+
- `pnpm run dev`: Start all applications in development mode.
|
|
102
|
+
- `pnpm run build`: Build all applications for production.
|
|
103
|
+
- `pnpm run quality`: Run all quality checks (linting and formatting) using Oxc.
|
|
104
|
+
- `pnpm run quality:fix`: Automatically fix linting and formatting issues using Oxc.
|
|
105
|
+
- `pnpm run typecheck`: Run TypeScript type checking across the workspace.
|
|
106
|
+
- `pnpm run ci`: Run linting, type-checking, and build (used in CI/CD).
|
|
107
107
|
|
|
108
108
|
### 🗄️ Database Scripts
|
|
109
109
|
These handle Docker and Drizzle operations:
|
|
110
|
-
- `
|
|
111
|
-
- `
|
|
112
|
-
- `
|
|
113
|
-
- `
|
|
114
|
-
- `
|
|
110
|
+
- `pnpm run db:up`: Start the PostgreSQL Docker container.
|
|
111
|
+
- `pnpm run db:down`: Stop and remove the database container.
|
|
112
|
+
- `pnpm run db:logs`: Tail logs from the database container.
|
|
113
|
+
- `pnpm run db:push --filter @workspace/db`: Push Drizzle schema to the database.
|
|
114
|
+
- `pnpm run db:studio --filter @workspace/db`: Open Drizzle Studio to explore your data.
|
|
115
115
|
|
|
116
116
|
## 🎯 Turborepo Power
|
|
117
117
|
|
|
@@ -120,10 +120,10 @@ Turbo allows you to run tasks for specific packages using the `--filter` flag:
|
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
122
|
# Only lint the platform app
|
|
123
|
-
|
|
123
|
+
pnpm run lint --filter platform
|
|
124
124
|
|
|
125
125
|
# Build the db package and everything that depends on it
|
|
126
|
-
|
|
126
|
+
pnpm run build --filter @workspace/db...
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### Smart Caching
|
|
@@ -151,14 +151,14 @@ type Outputs = InferRouterOutputs<typeof router>;
|
|
|
151
151
|
To add components to the shared UI package:
|
|
152
152
|
|
|
153
153
|
```bash
|
|
154
|
-
|
|
154
|
+
pnpm dlx shadcn@latest add [component-name] -c apps/platform
|
|
155
155
|
```
|
|
156
156
|
|
|
157
157
|
This will place the UI components in `packages/ui/src/components`.
|
|
158
158
|
|
|
159
159
|
## 🛡️ Quality & Git Hooks
|
|
160
160
|
|
|
161
|
-
This project uses **Husky** to ensure code quality. When pushing to the `main` branch, it automatically runs the CI pipeline (`
|
|
161
|
+
This project uses **Husky** to ensure code quality. When pushing to the `main` branch, it automatically runs the CI pipeline (`pnpm run ci`) to prevent broken code from being pushed.
|
|
162
162
|
|
|
163
163
|
Formatting and linting are handled by **Oxc**, which is significantly faster than ESLint and Prettier.
|
|
164
164
|
|
|
@@ -11,24 +11,24 @@ An Electron application with React and TypeScript
|
|
|
11
11
|
### Install
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
$
|
|
14
|
+
$ pnpm install
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
### Development
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
$
|
|
20
|
+
$ pnpm run dev
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Build
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# For windows
|
|
27
|
-
$
|
|
27
|
+
$ pnpm run build:win
|
|
28
28
|
|
|
29
29
|
# For macOS
|
|
30
|
-
$
|
|
30
|
+
$ pnpm run build:mac
|
|
31
31
|
|
|
32
32
|
# For Linux
|
|
33
|
-
$
|
|
33
|
+
$ pnpm run build:linux
|
|
34
34
|
```
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
|
|
10
10
|
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
|
|
11
|
-
"typecheck": "
|
|
11
|
+
"typecheck": "pnpm run typecheck:node && pnpm run typecheck:web",
|
|
12
12
|
"start": "electron-vite preview",
|
|
13
13
|
"dev": "electron-vite dev",
|
|
14
|
-
"build": "
|
|
14
|
+
"build": "pnpm run typecheck && electron-vite build",
|
|
15
15
|
"postinstall": "electron-builder install-app-deps",
|
|
16
|
-
"build:unpack": "
|
|
17
|
-
"build:win": "
|
|
16
|
+
"build:unpack": "pnpm run build && electron-builder --dir",
|
|
17
|
+
"build:win": "pnpm run build && electron-builder --win",
|
|
18
18
|
"build:mac": "electron-vite build && electron-builder --mac",
|
|
19
19
|
"build:linux": "electron-vite build && electron-builder --linux"
|
|
20
20
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@electron-toolkit/tsconfig": "^2.0.0",
|
|
28
28
|
"@types/node": "^22.19.1",
|
|
29
29
|
"@vitejs/plugin-react": "^5.1.1",
|
|
30
|
-
"@workspace/config-typescript": "
|
|
30
|
+
"@workspace/config-typescript": "workspace:*",
|
|
31
31
|
"electron": "39.8.9",
|
|
32
32
|
"electron-builder": "^26.0.12",
|
|
33
33
|
"electron-vite": "^5.0.0"
|
|
@@ -7,13 +7,13 @@ This is an [Expo](https://expo.dev) project created with [`create-expo-app`](htt
|
|
|
7
7
|
1. Install dependencies
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
pnpm install
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
2. Start the app
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
pnpm dlx expo start
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
In the output, you'll find options to open the app in a
|
|
@@ -30,7 +30,7 @@ You can start developing by editing the files inside the **app** directory. This
|
|
|
30
30
|
When you're ready, run:
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
|
|
33
|
+
pnpm run reset-project
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
|
|
@@ -1,45 +1,30 @@
|
|
|
1
|
-
import { useEffect
|
|
2
|
-
import { View, Text, StyleSheet, ScrollView,
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { View, Text, StyleSheet, ScrollView, Platform } from "react-native";
|
|
3
3
|
import { useRouter } from "expo-router";
|
|
4
4
|
import { authClient } from "@/lib/auth-client";
|
|
5
|
-
import {
|
|
5
|
+
import { useSecretData } from "@workspace/orpc/react";
|
|
6
6
|
import { Button } from "@/components/ui/button";
|
|
7
7
|
|
|
8
8
|
export default function DashboardScreen() {
|
|
9
9
|
const router = useRouter();
|
|
10
|
-
const { data: session, isPending } = authClient.useSession();
|
|
11
|
-
|
|
12
|
-
const
|
|
10
|
+
const { data: session, isPending: isAuthPending } = authClient.useSession();
|
|
11
|
+
|
|
12
|
+
const { data: secretData, isLoading: isLoadingSecret, error: secretError } = useSecretData({
|
|
13
|
+
enabled: !!session,
|
|
14
|
+
});
|
|
13
15
|
|
|
14
16
|
useEffect(() => {
|
|
15
|
-
if (!
|
|
17
|
+
if (!isAuthPending && !session) {
|
|
16
18
|
router.replace("/login");
|
|
17
|
-
return;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
if (session) {
|
|
21
|
-
const fetchSecret = async () => {
|
|
22
|
-
setLoadingSecret(true);
|
|
23
|
-
try {
|
|
24
|
-
const res = await orpc.getSecretData();
|
|
25
|
-
setSecretData(res.secret);
|
|
26
|
-
} catch (err: any) {
|
|
27
|
-
setSecretData("Error: " + (err.message || "Unknown error"));
|
|
28
|
-
} finally {
|
|
29
|
-
setLoadingSecret(false);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
fetchSecret();
|
|
34
|
-
}
|
|
35
|
-
}, [session, isPending, router]);
|
|
20
|
+
}, [session, isAuthPending, router]);
|
|
36
21
|
|
|
37
22
|
const handleSignOut = async () => {
|
|
38
23
|
await authClient.signOut();
|
|
39
24
|
router.replace("/");
|
|
40
25
|
};
|
|
41
26
|
|
|
42
|
-
if (
|
|
27
|
+
if (isAuthPending) {
|
|
43
28
|
return (
|
|
44
29
|
<View style={styles.center}>
|
|
45
30
|
<Text>Loading dashboard...</Text>
|
|
@@ -57,7 +42,15 @@ export default function DashboardScreen() {
|
|
|
57
42
|
|
|
58
43
|
<View style={styles.secureBox}>
|
|
59
44
|
<Text style={styles.secureTitle}>Secure oRPC Data:</Text>
|
|
60
|
-
|
|
45
|
+
{isLoadingSecret ? (
|
|
46
|
+
<Text style={styles.secureContent}>Loading secret data...</Text>
|
|
47
|
+
) : secretError ? (
|
|
48
|
+
<Text style={[styles.secureContent, styles.errorText]}>
|
|
49
|
+
Error: {secretError.message || "Unknown error"}
|
|
50
|
+
</Text>
|
|
51
|
+
) : (
|
|
52
|
+
<Text style={styles.secureContent}>{secretData?.secret}</Text>
|
|
53
|
+
)}
|
|
61
54
|
</View>
|
|
62
55
|
|
|
63
56
|
<Button variant="destructive" onPress={handleSignOut} style={styles.signOutBtn}>
|
|
@@ -110,6 +103,9 @@ const styles = StyleSheet.create({
|
|
|
110
103
|
fontFamily: Platform.OS === "ios" ? "Courier" : "monospace",
|
|
111
104
|
fontSize: 12,
|
|
112
105
|
},
|
|
106
|
+
errorText: {
|
|
107
|
+
color: "#ef4444",
|
|
108
|
+
},
|
|
113
109
|
signOutBtn: {
|
|
114
110
|
marginTop: 12,
|
|
115
111
|
},
|