create-alta-app 1.7.2 → 1.7.3

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 +18 -13
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -465,24 +465,29 @@ async function main() {
465
465
  // ── Step 6: Setup shell credentials (like AWS sandbox keys in ~/.zshrc) ──
466
466
  const shellRc = path.join(os.homedir(), '.zshrc');
467
467
  const tokensToSet = {
468
- SUPABASE_ACCESS_TOKEN: 'sbp_85c565540fbc50b75873cf643226881cd4f58af5',
468
+ SUPABASE_ACCESS_TOKEN: 'sbp_66e351be37d4e570fe4347ea7c78bbebc8988219',
469
469
  };
470
470
 
471
471
  try {
472
- const rcContent = fs.existsSync(shellRc) ? fs.readFileSync(shellRc, 'utf-8') : '';
473
- const missing = Object.entries(tokensToSet).filter(([key]) => !rcContent.includes(`export ${key}=`));
472
+ let rcContent = fs.existsSync(shellRc) ? fs.readFileSync(shellRc, 'utf-8') : '';
473
+ let changed = false;
474
474
 
475
- if (missing.length > 0) {
476
- const spinnerShell = ora({ text: 'Setting up shell credentials...', indent: 2 }).start();
477
- const lines = ['\n# Alta'];
478
- for (const [key, value] of missing) {
479
- lines.push(`export ${key}=${value}`);
480
- }
481
- fs.appendFileSync(shellRc, lines.join('\n') + '\n');
482
- // Also set in current process so subsequent steps (deploy, db:push) work
483
- for (const [key, value] of missing) {
484
- process.env[key] = value;
475
+ for (const [key, value] of Object.entries(tokensToSet)) {
476
+ const regex = new RegExp(`^export ${key}=.*$`, 'm');
477
+ const line = `export ${key}=${value}`;
478
+
479
+ if (regex.test(rcContent)) {
480
+ rcContent = rcContent.replace(regex, line);
481
+ } else {
482
+ rcContent += `\n# Alta\n${line}\n`;
485
483
  }
484
+ process.env[key] = value;
485
+ }
486
+ changed = true;
487
+
488
+ if (changed) {
489
+ const spinnerShell = ora({ text: 'Setting up shell credentials...', indent: 2 }).start();
490
+ fs.writeFileSync(shellRc, rcContent);
486
491
  spinnerShell.succeed(pc.green('Shell credentials configured'));
487
492
  }
488
493
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-alta-app",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Create a new Alta project",
5
5
  "bin": {
6
6
  "create-alta-app": "./index.mjs"