genbox 1.0.9 → 1.0.10
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/dist/commands/create.js +4 -1
- package/dist/commands/init.js +19 -4
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -466,7 +466,10 @@ async function createLegacy(name, options) {
|
|
|
466
466
|
});
|
|
467
467
|
spinner.succeed(chalk_1.default.green(`Genbox '${name}' created!`));
|
|
468
468
|
if (genbox.ipAddress) {
|
|
469
|
-
(0, ssh_config_1.addSshConfigEntry)({ name, ipAddress: genbox.ipAddress });
|
|
469
|
+
const sshAdded = (0, ssh_config_1.addSshConfigEntry)({ name, ipAddress: genbox.ipAddress });
|
|
470
|
+
if (sshAdded) {
|
|
471
|
+
console.log(chalk_1.default.dim(` SSH config added: ssh ${(0, ssh_config_1.getSshAlias)(name)}`));
|
|
472
|
+
}
|
|
470
473
|
}
|
|
471
474
|
console.log(chalk_1.default.dim('───────────────────────────────────────────────'));
|
|
472
475
|
console.log(` ${chalk_1.default.bold('Environment:')} ${name}`);
|
package/dist/commands/init.js
CHANGED
|
@@ -137,6 +137,7 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
137
137
|
const configPath = path_1.default.join(process.cwd(), CONFIG_FILENAME);
|
|
138
138
|
const nonInteractive = options.yes || !process.stdin.isTTY;
|
|
139
139
|
// Check for existing config
|
|
140
|
+
let overwriteExisting = options.force || false;
|
|
140
141
|
if (fs_1.default.existsSync(configPath) && !options.force) {
|
|
141
142
|
if (nonInteractive) {
|
|
142
143
|
console.log(chalk_1.default.yellow('genbox.yaml already exists. Use --force to overwrite.'));
|
|
@@ -150,6 +151,7 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
150
151
|
if (!overwrite) {
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
154
|
+
overwriteExisting = true;
|
|
153
155
|
}
|
|
154
156
|
console.log(chalk_1.default.blue('Initializing Genbox...'));
|
|
155
157
|
console.log('');
|
|
@@ -310,6 +312,13 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
310
312
|
if (hasHttpsRepos) {
|
|
311
313
|
console.log('');
|
|
312
314
|
console.log(chalk_1.default.yellow('Private repositories require a GitHub token for cloning.'));
|
|
315
|
+
console.log('');
|
|
316
|
+
console.log(chalk_1.default.dim(' To create a token:'));
|
|
317
|
+
console.log(chalk_1.default.dim(' 1. Go to https://github.com/settings/tokens'));
|
|
318
|
+
console.log(chalk_1.default.dim(' 2. Click "Generate new token" → "Classic"'));
|
|
319
|
+
console.log(chalk_1.default.dim(' 3. Select scope: "repo" (Full control of private repositories)'));
|
|
320
|
+
console.log(chalk_1.default.dim(' 4. Generate and copy the token'));
|
|
321
|
+
console.log('');
|
|
313
322
|
const gitToken = await prompts.password({
|
|
314
323
|
message: 'GitHub Personal Access Token (leave empty to skip):',
|
|
315
324
|
});
|
|
@@ -446,7 +455,7 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
446
455
|
fs_1.default.writeFileSync(configPath, yamlContent);
|
|
447
456
|
console.log(chalk_1.default.green(`\n✔ Configuration saved to ${CONFIG_FILENAME}`));
|
|
448
457
|
// Generate .env.genbox
|
|
449
|
-
await setupEnvFile(projectName, v3Config, nonInteractive, scan, isMultiRepo, envVarsToAdd);
|
|
458
|
+
await setupEnvFile(projectName, v3Config, nonInteractive, scan, isMultiRepo, envVarsToAdd, overwriteExisting);
|
|
450
459
|
// Show warnings
|
|
451
460
|
if (generated.warnings.length > 0) {
|
|
452
461
|
console.log('');
|
|
@@ -739,11 +748,17 @@ async function setupEnvironments(scan, config, isMultiRepo = false) {
|
|
|
739
748
|
/**
|
|
740
749
|
* Setup .env.genbox file
|
|
741
750
|
*/
|
|
742
|
-
async function setupEnvFile(projectName, config, nonInteractive = false, scan, isMultiRepo = false, extraEnvVars = {}) {
|
|
751
|
+
async function setupEnvFile(projectName, config, nonInteractive = false, scan, isMultiRepo = false, extraEnvVars = {}, overwriteExisting = false) {
|
|
743
752
|
const envPath = path_1.default.join(process.cwd(), ENV_FILENAME);
|
|
753
|
+
// If overwriting, delete existing file
|
|
744
754
|
if (fs_1.default.existsSync(envPath)) {
|
|
745
|
-
|
|
746
|
-
|
|
755
|
+
if (overwriteExisting) {
|
|
756
|
+
fs_1.default.unlinkSync(envPath);
|
|
757
|
+
}
|
|
758
|
+
else {
|
|
759
|
+
console.log(chalk_1.default.dim(` ${ENV_FILENAME} already exists, skipping...`));
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
747
762
|
}
|
|
748
763
|
// For multi-repo: find env files in app directories
|
|
749
764
|
if (isMultiRepo && scan) {
|