create-alta-app 2.0.0 → 2.2.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/index.mjs +35 -86
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -148,17 +148,9 @@ export default function Root() {
|
|
|
148
148
|
|
|
149
149
|
fs.writeFileSync(
|
|
150
150
|
path.join(appDir, 'components', 'layout', 'header.tsx'),
|
|
151
|
-
`
|
|
152
|
-
import { Text } from '@alta/design-system/components/ui/text';
|
|
153
|
-
|
|
154
|
-
export function Header() {
|
|
151
|
+
`export function Header() {
|
|
155
152
|
return (
|
|
156
|
-
<header className="flex h-14 items-center
|
|
157
|
-
<Separator orientation="vertical" className="h-4" />
|
|
158
|
-
<div className="ml-auto flex items-center gap-3">
|
|
159
|
-
<Text variant="muted">Alta App</Text>
|
|
160
|
-
</div>
|
|
161
|
-
</header>
|
|
153
|
+
<header className="flex h-14 items-center justify-end border-b px-4" />
|
|
162
154
|
);
|
|
163
155
|
}
|
|
164
156
|
`
|
|
@@ -166,49 +158,10 @@ export function Header() {
|
|
|
166
158
|
|
|
167
159
|
fs.writeFileSync(
|
|
168
160
|
path.join(appDir, 'routes', 'app', 'dashboard.tsx'),
|
|
169
|
-
`
|
|
170
|
-
import { Text } from '@alta/design-system/components/ui/text';
|
|
171
|
-
import { Badge } from '@alta/design-system/components/ui/badge';
|
|
172
|
-
import { Separator } from '@alta/design-system/components/ui/separator';
|
|
173
|
-
|
|
174
|
-
export default function DashboardRoute() {
|
|
161
|
+
`export default function DashboardRoute() {
|
|
175
162
|
return (
|
|
176
163
|
<div className="space-y-6">
|
|
177
|
-
<
|
|
178
|
-
<Text variant="heading3">Dashboard</Text>
|
|
179
|
-
<Text variant="muted" className="mt-1">Welcome to your app</Text>
|
|
180
|
-
</div>
|
|
181
|
-
<Separator />
|
|
182
|
-
<div className="grid gap-4 md:grid-cols-3">
|
|
183
|
-
<Card>
|
|
184
|
-
<CardHeader className="flex flex-row items-center justify-between pb-2">
|
|
185
|
-
<CardTitle className="text-sm font-medium text-muted-foreground">Status</CardTitle>
|
|
186
|
-
<Badge variant="default">Active</Badge>
|
|
187
|
-
</CardHeader>
|
|
188
|
-
<CardContent>
|
|
189
|
-
<Text variant="heading3">All systems go</Text>
|
|
190
|
-
<Text variant="small" className="mt-1 text-muted-foreground">Your app is running smoothly</Text>
|
|
191
|
-
</CardContent>
|
|
192
|
-
</Card>
|
|
193
|
-
<Card>
|
|
194
|
-
<CardHeader className="pb-2">
|
|
195
|
-
<CardTitle className="text-sm font-medium text-muted-foreground">Environment</CardTitle>
|
|
196
|
-
</CardHeader>
|
|
197
|
-
<CardContent>
|
|
198
|
-
<Text variant="heading3">Development</Text>
|
|
199
|
-
<Text variant="small" className="mt-1 text-muted-foreground">Local dev server</Text>
|
|
200
|
-
</CardContent>
|
|
201
|
-
</Card>
|
|
202
|
-
<Card>
|
|
203
|
-
<CardHeader className="pb-2">
|
|
204
|
-
<CardTitle className="text-sm font-medium text-muted-foreground">Framework</CardTitle>
|
|
205
|
-
</CardHeader>
|
|
206
|
-
<CardContent>
|
|
207
|
-
<Text variant="heading3">Alta</Text>
|
|
208
|
-
<Text variant="small" className="mt-1 text-muted-foreground">React + Supabase + Vercel</Text>
|
|
209
|
-
</CardContent>
|
|
210
|
-
</Card>
|
|
211
|
-
</div>
|
|
164
|
+
<h1 className="text-2xl font-bold">Dashboard</h1>
|
|
212
165
|
</div>
|
|
213
166
|
);
|
|
214
167
|
}
|
|
@@ -217,24 +170,10 @@ export default function DashboardRoute() {
|
|
|
217
170
|
|
|
218
171
|
fs.writeFileSync(
|
|
219
172
|
path.join(appDir, 'routes', 'app', 'settings.tsx'),
|
|
220
|
-
`
|
|
221
|
-
import { Text } from '@alta/design-system/components/ui/text';
|
|
222
|
-
|
|
223
|
-
export default function SettingsRoute() {
|
|
173
|
+
`export default function SettingsRoute() {
|
|
224
174
|
return (
|
|
225
175
|
<div className="space-y-6">
|
|
226
|
-
<
|
|
227
|
-
<Text variant="heading3">Settings</Text>
|
|
228
|
-
<Text variant="muted" className="mt-1">Manage your app preferences</Text>
|
|
229
|
-
</div>
|
|
230
|
-
<Card>
|
|
231
|
-
<CardHeader>
|
|
232
|
-
<CardTitle>App Settings</CardTitle>
|
|
233
|
-
</CardHeader>
|
|
234
|
-
<CardContent>
|
|
235
|
-
<Text variant="paragraph">Configure your app here.</Text>
|
|
236
|
-
</CardContent>
|
|
237
|
-
</Card>
|
|
176
|
+
<h1 className="text-2xl font-bold">Settings</h1>
|
|
238
177
|
</div>
|
|
239
178
|
);
|
|
240
179
|
}
|
|
@@ -430,30 +369,17 @@ async function main() {
|
|
|
430
369
|
credentials = null;
|
|
431
370
|
}
|
|
432
371
|
|
|
433
|
-
// ── Step 4:
|
|
434
|
-
const SUPABASE_TOKEN = 'sbp_66e351be37d4e570fe4347ea7c78bbebc8988219';
|
|
435
|
-
const spinnerLogin = ora({ text: 'Logging in to Supabase CLI...', indent: 2 }).start();
|
|
436
|
-
try {
|
|
437
|
-
run(`npx supabase login --token ${SUPABASE_TOKEN}`, targetDir);
|
|
438
|
-
process.env.SUPABASE_ACCESS_TOKEN = SUPABASE_TOKEN;
|
|
439
|
-
spinnerLogin.succeed(pc.green('Supabase CLI authenticated'));
|
|
440
|
-
} catch {
|
|
441
|
-
spinnerLogin.warn(pc.yellow('Could not login to Supabase CLI'));
|
|
442
|
-
console.log(` ${pc.dim('Run manually: npx supabase login')}`);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// ── Step 5: Wait for Supabase project to provision & get anon key ──
|
|
372
|
+
// ── Step 4: Wait for Supabase project to provision & get anon key ──
|
|
446
373
|
let anonKey = '';
|
|
447
374
|
if (credentials) {
|
|
448
375
|
const spinnerKeys = ora({ text: 'Waiting for Supabase project to provision...', indent: 2 }).start();
|
|
449
|
-
const token = process.env.SUPABASE_ACCESS_TOKEN;
|
|
450
376
|
const ref = credentials.supabaseProjectRef;
|
|
451
377
|
|
|
452
378
|
for (let i = 0; i < 24; i++) {
|
|
453
379
|
await new Promise((r) => setTimeout(r, 5000));
|
|
454
380
|
try {
|
|
455
381
|
const res = await fetch(`https://api.supabase.com/v1/projects/${ref}/api-keys`, {
|
|
456
|
-
headers: { Authorization: `Bearer ${
|
|
382
|
+
headers: { Authorization: `Bearer ${credentials.supabaseToken}` },
|
|
457
383
|
});
|
|
458
384
|
if (res.ok) {
|
|
459
385
|
const keys = await res.json();
|
|
@@ -522,15 +448,38 @@ async function main() {
|
|
|
522
448
|
}
|
|
523
449
|
|
|
524
450
|
|
|
525
|
-
// ── Step 6:
|
|
451
|
+
// ── Step 6: Login & link Supabase ──
|
|
526
452
|
if (credentials) {
|
|
527
453
|
const spinnerLink = ora({ text: 'Linking Supabase project...', indent: 2 }).start();
|
|
528
454
|
try {
|
|
455
|
+
run(`npx supabase login --token ${credentials.supabaseToken}`, targetDir);
|
|
529
456
|
run(`npx supabase link --project-ref ${credentials.supabaseProjectRef}`, targetDir);
|
|
530
457
|
spinnerLink.succeed(pc.green('Supabase project linked'));
|
|
531
458
|
} catch {
|
|
532
459
|
spinnerLink.warn(pc.yellow('Could not link Supabase project'));
|
|
533
|
-
console.log(` ${pc.dim(`Run manually:
|
|
460
|
+
console.log(` ${pc.dim(`Run manually: npx supabase login && npx supabase link --project-ref ${credentials.supabaseProjectRef}`)}`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// ── Step 6b: Login & link Vercel ──
|
|
465
|
+
if (credentials) {
|
|
466
|
+
// Check if already logged in to Vercel
|
|
467
|
+
if (!canRun('npx vercel whoami')) {
|
|
468
|
+
console.log(`\n ${pc.cyan('Vercel login required — opening browser...')}\n`);
|
|
469
|
+
try {
|
|
470
|
+
execSync('npx vercel login', { cwd: targetDir, stdio: 'inherit' });
|
|
471
|
+
} catch {
|
|
472
|
+
console.log(` ${pc.dim('Vercel login skipped — run "vercel login" later to enable deploys')}`);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const spinnerVercel = ora({ text: 'Linking Vercel project...', indent: 2 }).start();
|
|
477
|
+
try {
|
|
478
|
+
run(`npx vercel link --project ${projectName} --yes`, targetDir);
|
|
479
|
+
spinnerVercel.succeed(pc.green('Vercel project linked'));
|
|
480
|
+
} catch {
|
|
481
|
+
spinnerVercel.warn(pc.yellow('Could not link Vercel project'));
|
|
482
|
+
console.log(` ${pc.dim('Run manually: vercel link --project ' + projectName)}`);
|
|
534
483
|
}
|
|
535
484
|
}
|
|
536
485
|
|
|
@@ -546,7 +495,7 @@ async function main() {
|
|
|
546
495
|
supabase: {
|
|
547
496
|
url: `https://mcp.supabase.com/mcp`,
|
|
548
497
|
headers: {
|
|
549
|
-
'x-supabase-access-token':
|
|
498
|
+
'x-supabase-access-token': credentials.supabaseToken,
|
|
550
499
|
'x-project-ref': credentials.supabaseProjectRef,
|
|
551
500
|
},
|
|
552
501
|
},
|
|
@@ -600,7 +549,7 @@ async function main() {
|
|
|
600
549
|
spinnerDeploy.succeed(pc.green('Deployed to Vercel'));
|
|
601
550
|
} catch {
|
|
602
551
|
spinnerDeploy.warn(pc.yellow('Could not deploy to Vercel'));
|
|
603
|
-
console.log(` ${pc.dim('Deploy manually: cd ' + projectName + ' && pnpm deploy')}`);
|
|
552
|
+
console.log(` ${pc.dim('Deploy manually: cd ' + projectName + ' && pnpm run deploy')}`);
|
|
604
553
|
}
|
|
605
554
|
}
|
|
606
555
|
|