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.
- package/index.mjs +18 -13
- 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: '
|
|
468
|
+
SUPABASE_ACCESS_TOKEN: 'sbp_66e351be37d4e570fe4347ea7c78bbebc8988219',
|
|
469
469
|
};
|
|
470
470
|
|
|
471
471
|
try {
|
|
472
|
-
|
|
473
|
-
|
|
472
|
+
let rcContent = fs.existsSync(shellRc) ? fs.readFileSync(shellRc, 'utf-8') : '';
|
|
473
|
+
let changed = false;
|
|
474
474
|
|
|
475
|
-
|
|
476
|
-
const
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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 {
|