create-alta-app 3.1.0 → 4.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 +35 -11
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -467,11 +467,11 @@ async function main() {
467
467
  if (credentials) {
468
468
  const spinnerLink = ora({ text: 'Linking Supabase project...', indent: 2 }).start();
469
469
  try {
470
- // Use npx --yes to auto-download supabase CLI (workspace hoists deps to root)
470
+ // Use pnpm dlx to download+run supabase CLI (npx doesn't work in pnpm workspaces)
471
471
  spinnerLink.text = 'Logging in to Supabase...';
472
- runVerbose(`npx --yes supabase login --token ${credentials.supabaseToken}`, targetDir);
472
+ runVerbose(`pnpm dlx supabase login --token ${credentials.supabaseToken}`, targetDir);
473
473
  spinnerLink.text = `Linking Supabase project: ${credentials.supabaseProjectRef}...`;
474
- runVerbose(`npx --yes supabase link --project-ref ${credentials.supabaseProjectRef}`, targetDir);
474
+ runVerbose(`pnpm dlx supabase link --project-ref ${credentials.supabaseProjectRef}`, targetDir);
475
475
  spinnerLink.succeed(pc.green('Supabase project linked'));
476
476
  } catch (err) {
477
477
  spinnerLink.warn(pc.yellow('Could not link Supabase project'));
@@ -583,12 +583,18 @@ async function main() {
583
583
  console.log('');
584
584
  }
585
585
 
586
- // ── Step 9: Commit, push & trigger Vercel auto-deploy ──
586
+ // ── Step 9: Commit, push & create PR to trigger Vercel preview deploy ──
587
587
  if (credentials) {
588
588
  const spinnerDeploy = ora({ text: 'Preparing deploy...', indent: 2 }).start();
589
589
  try {
590
590
  const relAppPath = path.relative(process.cwd(), targetDir);
591
591
  const monorepoRoot = process.cwd();
592
+ const branchName = `feat/add-${projectName}`;
593
+
594
+ // Create a new branch for the PR
595
+ spinnerDeploy.text = `Creating branch: ${branchName}...`;
596
+ runVerbose(`git checkout -b ${branchName}`, monorepoRoot);
597
+ spinnerDeploy.text = `On branch: ${branchName}`;
592
598
 
593
599
  // Format files to pass pre-commit prettier check
594
600
  spinnerDeploy.text = 'Formatting files with Prettier...';
@@ -609,19 +615,37 @@ async function main() {
609
615
  runVerbose(`git commit --no-verify -m "feat: add ${projectName}"`, monorepoRoot);
610
616
  spinnerDeploy.text = `Committed: feat: add ${projectName}`;
611
617
 
612
- // Push to GitHub triggers Vercel auto-deploy
613
- spinnerDeploy.text = 'Pushing to GitHub...';
614
- runVerbose('git push', monorepoRoot);
615
- spinnerDeploy.succeed(pc.green('Pushed to GitHub'));
618
+ // Push the new branch to GitHub
619
+ spinnerDeploy.text = `Pushing branch ${branchName}...`;
620
+ runVerbose(`git push -u origin ${branchName}`, monorepoRoot);
621
+ spinnerDeploy.text = `Pushed branch: ${branchName}`;
622
+
623
+ // Create PR via gh CLI — this triggers Vercel preview deploy
624
+ spinnerDeploy.text = 'Creating pull request...';
625
+ let prUrl = '';
626
+ try {
627
+ prUrl = runVerbose(
628
+ `gh pr create --title "feat: add ${projectName}" --body "Auto-generated by create-alta-app" --base main --head ${branchName}`,
629
+ monorepoRoot
630
+ ).trim();
631
+ spinnerDeploy.succeed(pc.green('PR created — Vercel preview deploy triggered'));
632
+ console.log(` ${pc.dim('PR:')} ${pc.cyan(prUrl)}`);
633
+ } catch (prErr) {
634
+ // gh CLI might not be installed — push still succeeded
635
+ spinnerDeploy.succeed(pc.green(`Pushed to GitHub (branch: ${branchName})`));
636
+ console.log(` ${pc.dim('Could not create PR automatically: ' + prErr.message)}`);
637
+ console.log(` ${pc.dim('Create PR manually:')} ${pc.cyan(`gh pr create --base main --head ${branchName}`)}`);
638
+ }
616
639
 
617
640
  const deployUrl = credentials.vercelUrl || `https://${projectName}.vercel.app`;
618
- console.log(` ${pc.dim('Vercel will auto-deploy →')} ${pc.cyan(deployUrl)}`);
619
- console.log(` ${pc.dim('Every future push to this branch will trigger a preview deploy')}`);
641
+ console.log(` ${pc.dim('Vercel preview:')} ${pc.cyan(deployUrl)}`);
642
+ console.log(` ${pc.dim('Production deploy will happen when PR is merged to main')}`);
620
643
  } catch (err) {
621
644
  spinnerDeploy.warn(pc.yellow('Could not push to GitHub'));
622
645
  console.log(` ${pc.dim('Error: ' + err.message)}`);
623
646
  console.log(` ${pc.dim('Push manually:')}`);
624
- console.log(` ${pc.cyan(`git add apps/ai-engineer/${projectName} && git commit -m "feat: add ${projectName}" && git push`)}`);
647
+ console.log(` ${pc.cyan(`git checkout -b feat/add-${projectName} && git add apps/ai-engineer/${projectName} && git commit -m "feat: add ${projectName}" && git push -u origin feat/add-${projectName}`)}`);
648
+ console.log(` ${pc.cyan(`gh pr create --base main --head feat/add-${projectName}`)}`);
625
649
  }
626
650
  }
627
651
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-alta-app",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "Create a new Alta project",
5
5
  "bin": {
6
6
  "create-alta-app": "./index.mjs"