create-alta-app 2.7.0 → 3.0.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.
Files changed (2) hide show
  1. package/index.mjs +37 -20
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -450,8 +450,7 @@ async function main() {
450
450
  if (canRun('pnpm --version')) {
451
451
  const spinnerInstall = ora({ text: 'Installing dependencies...', indent: 2 }).start();
452
452
  try {
453
- // Install from monorepo root so pnpm workspace resolves deps correctly
454
- run('pnpm install', process.cwd());
453
+ run('pnpm install', targetDir);
455
454
  spinnerInstall.succeed(pc.green('Dependencies installed'));
456
455
  } catch {
457
456
  spinnerInstall.fail(pc.yellow('Failed to install dependencies'));
@@ -467,11 +466,15 @@ async function main() {
467
466
  if (credentials) {
468
467
  const spinnerLink = ora({ text: 'Linking Supabase project...', indent: 2 }).start();
469
468
  try {
470
- run(`npx supabase login --token ${credentials.supabaseToken}`, targetDir);
471
- run(`npx supabase link --project-ref ${credentials.supabaseProjectRef}`, targetDir);
469
+ // Both run from app dir where node_modules/.bin/supabase exists
470
+ spinnerLink.text = 'Logging in to Supabase...';
471
+ runVerbose(`npx supabase login --token ${credentials.supabaseToken}`, targetDir);
472
+ spinnerLink.text = `Linking Supabase project: ${credentials.supabaseProjectRef}...`;
473
+ runVerbose(`npx supabase link --project-ref ${credentials.supabaseProjectRef}`, targetDir);
472
474
  spinnerLink.succeed(pc.green('Supabase project linked'));
473
- } catch {
475
+ } catch (err) {
474
476
  spinnerLink.warn(pc.yellow('Could not link Supabase project'));
477
+ console.log(` ${pc.dim('Error: ' + err.message)}`);
475
478
  console.log(` ${pc.dim(`Run manually: npx supabase login && npx supabase link --project-ref ${credentials.supabaseProjectRef}`)}`);
476
479
  }
477
480
  }
@@ -508,8 +511,7 @@ async function main() {
508
511
  spinnerVercel.text = 'Could not source ~/.zshrc — using process.env instead';
509
512
  }
510
513
 
511
- // Link the Vercel project
512
- // Link from monorepo root so rootDirectory (apps/ai-engineer/<name>) resolves correctly
514
+ // Link from monorepo root — matches rootDirectory setting on Vercel project
513
515
  spinnerVercel.text = `Linking Vercel project: ${projectName}...`;
514
516
  runVerbose(`npx vercel link --project ${projectName} --yes --token ${credentials.vercelToken}`, process.cwd());
515
517
  spinnerVercel.succeed(pc.green('Vercel configured & linked'));
@@ -573,29 +575,44 @@ async function main() {
573
575
  console.log('');
574
576
  console.log(` ${pc.magenta('◆')} ${pc.dim('Supabase')} ${credentials.supabaseUrl}`);
575
577
  if (credentials.vercelUrl) {
576
- console.log(` ${pc.magenta('◆')} ${pc.dim('Vercel')} ${credentials.vercelUrl} ${pc.dim('(first deploy may take a few minutes)')}`);
578
+ console.log(` ${pc.magenta('◆')} ${pc.dim('Vercel')} ${credentials.vercelUrl} ${pc.dim('(auto-deploys on every push)')}`);
577
579
  }
578
580
  console.log(` ${pc.magenta('◆')} ${pc.dim('Config')} alta.config.json`);
579
581
  console.log(` ${pc.magenta('◆')} ${pc.dim('Location')} ${targetDir}`);
580
582
  console.log('');
581
583
  }
582
584
 
583
- // ── Step 9: Deploy to Vercel ──
584
- if (credentials?.vercelToken) {
585
- const spinnerDeploy = ora({ text: 'Deploying to Vercel...', indent: 2 }).start();
585
+ // ── Step 9: Commit, push & trigger Vercel auto-deploy ──
586
+ if (credentials) {
587
+ const spinnerDeploy = ora({ text: 'Preparing deploy...', indent: 2 }).start();
586
588
  try {
587
- // Deploy from monorepo root so rootDirectory (apps/ai-engineer/<name>) resolves correctly
588
- spinnerDeploy.text = `Running: vercel --token ${credentials.vercelToken.slice(0, 8)}... from monorepo root`;
589
- const deployOutput = runVerbose(`npx vercel --yes --token ${credentials.vercelToken}`, process.cwd());
590
- if (deployOutput) console.log(`\n${pc.dim(deployOutput.trim())}`);
591
- spinnerDeploy.succeed(pc.green(`Deployed to Vercel ${credentials.vercelUrl || projectName + '.vercel.app'}`));
589
+ const relAppPath = path.relative(process.cwd(), targetDir);
590
+ const monorepoRoot = process.cwd();
591
+
592
+ // Stage the new app files
593
+ spinnerDeploy.text = `Staging files: ${relAppPath}...`;
594
+ runVerbose(`git add "${relAppPath}"`, monorepoRoot);
595
+ spinnerDeploy.text = `Staged ${relAppPath}`;
596
+
597
+ // Commit
598
+ spinnerDeploy.text = `Committing: feat: add ${projectName}...`;
599
+ runVerbose(`git commit -m "feat: add ${projectName}"`, monorepoRoot);
600
+ spinnerDeploy.text = `Committed: feat: add ${projectName}`;
601
+
602
+ // Push to GitHub — triggers Vercel auto-deploy
603
+ spinnerDeploy.text = 'Pushing to GitHub...';
604
+ runVerbose('git push', monorepoRoot);
605
+ spinnerDeploy.succeed(pc.green('Pushed to GitHub'));
606
+
607
+ const deployUrl = credentials.vercelUrl || `https://${projectName}.vercel.app`;
608
+ console.log(` ${pc.dim('Vercel will auto-deploy →')} ${pc.cyan(deployUrl)}`);
609
+ console.log(` ${pc.dim('Every future push to this branch will trigger a preview deploy')}`);
592
610
  } catch (err) {
593
- spinnerDeploy.warn(pc.yellow('Could not deploy to Vercel'));
611
+ spinnerDeploy.warn(pc.yellow('Could not push to GitHub'));
594
612
  console.log(` ${pc.dim('Error: ' + err.message)}`);
595
- console.log(` ${pc.dim('Deploy manually: cd ' + projectName + ' && vercel --token $VERCEL_TOKEN')}`);
613
+ console.log(` ${pc.dim('Push manually:')}`);
614
+ console.log(` ${pc.cyan(`git add apps/ai-engineer/${projectName} && git commit -m "feat: add ${projectName}" && git push`)}`);
596
615
  }
597
- } else {
598
- console.log(` ${pc.dim('Skipping Vercel deploy — no token available')}`);
599
616
  }
600
617
 
601
618
  // ── Step 10: Start dev server ──
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-alta-app",
3
- "version": "2.7.0",
3
+ "version": "3.0.0",
4
4
  "description": "Create a new Alta project",
5
5
  "bin": {
6
6
  "create-alta-app": "./index.mjs"