create-alta-app 2.0.0 → 2.1.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 +41 -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,44 @@ async function main() {
|
|
|
522
448
|
}
|
|
523
449
|
|
|
524
450
|
|
|
525
|
-
// ── Step 6:
|
|
451
|
+
// ── Step 6: Login & link Supabase + Vercel ──
|
|
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
|
+
const spinnerVercel = ora({ text: 'Authenticating Vercel CLI...', indent: 2 }).start();
|
|
464
|
+
try {
|
|
465
|
+
// Persist Vercel auth globally so user doesn't need --token on every command
|
|
466
|
+
const vercelConfigDir = path.join(process.env.HOME, 'Library', 'Application Support', 'com.vercel.cli');
|
|
467
|
+
if (!fs.existsSync(vercelConfigDir)) fs.mkdirSync(vercelConfigDir, { recursive: true });
|
|
468
|
+
|
|
469
|
+
fs.writeFileSync(
|
|
470
|
+
path.join(vercelConfigDir, 'auth.json'),
|
|
471
|
+
JSON.stringify({ token: credentials.vercelToken }) + '\n'
|
|
472
|
+
);
|
|
473
|
+
|
|
474
|
+
// Set current team scope
|
|
475
|
+
const configPath = path.join(vercelConfigDir, 'config.json');
|
|
476
|
+
let vercelConfig = {};
|
|
477
|
+
if (fs.existsSync(configPath)) {
|
|
478
|
+
vercelConfig = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
479
|
+
}
|
|
480
|
+
vercelConfig.currentTeam = credentials.vercelTeamId;
|
|
481
|
+
fs.writeFileSync(configPath, JSON.stringify(vercelConfig, null, 2) + '\n');
|
|
482
|
+
|
|
483
|
+
// Link the project to Vercel
|
|
484
|
+
run(`npx vercel link --project ${projectName} --yes`, targetDir);
|
|
485
|
+
spinnerVercel.succeed(pc.green('Vercel authenticated & project linked'));
|
|
486
|
+
} catch {
|
|
487
|
+
spinnerVercel.warn(pc.yellow('Could not link Vercel project'));
|
|
488
|
+
console.log(` ${pc.dim('Deploy manually: cd ' + projectName + ' && pnpm run deploy')}`);
|
|
534
489
|
}
|
|
535
490
|
}
|
|
536
491
|
|
|
@@ -546,7 +501,7 @@ async function main() {
|
|
|
546
501
|
supabase: {
|
|
547
502
|
url: `https://mcp.supabase.com/mcp`,
|
|
548
503
|
headers: {
|
|
549
|
-
'x-supabase-access-token':
|
|
504
|
+
'x-supabase-access-token': credentials.supabaseToken,
|
|
550
505
|
'x-project-ref': credentials.supabaseProjectRef,
|
|
551
506
|
},
|
|
552
507
|
},
|
|
@@ -600,7 +555,7 @@ async function main() {
|
|
|
600
555
|
spinnerDeploy.succeed(pc.green('Deployed to Vercel'));
|
|
601
556
|
} catch {
|
|
602
557
|
spinnerDeploy.warn(pc.yellow('Could not deploy to Vercel'));
|
|
603
|
-
console.log(` ${pc.dim('Deploy manually: cd ' + projectName + ' && pnpm deploy')}`);
|
|
558
|
+
console.log(` ${pc.dim('Deploy manually: cd ' + projectName + ' && pnpm run deploy')}`);
|
|
604
559
|
}
|
|
605
560
|
}
|
|
606
561
|
|