genbox 1.0.29 → 1.0.30
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/init.js +8 -34
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -618,6 +618,14 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
618
618
|
const v4Config = convertV2ToV4(generated.config, scan);
|
|
619
619
|
// Update project name
|
|
620
620
|
v4Config.project.name = projectName;
|
|
621
|
+
// Environment configuration - do this BEFORE profiles so profiles can reference environments
|
|
622
|
+
// (skip only in non-interactive mode, always show for --from-scan since environments are required)
|
|
623
|
+
if (!nonInteractive) {
|
|
624
|
+
const envConfig = await setupEnvironments(scan, v4Config, isMultiRepoStructure, existingEnvValues);
|
|
625
|
+
if (envConfig) {
|
|
626
|
+
v4Config.environments = envConfig;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
621
629
|
// Ask about profiles (skip prompt when using --from-scan)
|
|
622
630
|
let createProfiles = true;
|
|
623
631
|
if (!nonInteractive && !options.fromScan) {
|
|
@@ -840,14 +848,6 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
840
848
|
};
|
|
841
849
|
}
|
|
842
850
|
}
|
|
843
|
-
// Environment configuration (skip only in non-interactive mode)
|
|
844
|
-
// For --from-scan, we still want to prompt for environments since they're required for genbox to work
|
|
845
|
-
if (!nonInteractive) {
|
|
846
|
-
const envConfig = await setupEnvironments(scan, v4Config, isMultiRepo, existingEnvValues);
|
|
847
|
-
if (envConfig) {
|
|
848
|
-
v4Config.environments = envConfig;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
851
|
// Script selection - always show multi-select UI (skip in non-interactive mode and --from-scan)
|
|
852
852
|
if (!nonInteractive && !options.fromScan) {
|
|
853
853
|
// Scan for scripts
|
|
@@ -935,32 +935,6 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
935
935
|
console.log(chalk_1.default.dim(` - ${warning}`));
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
-
// Show API URL guidance if environments are configured
|
|
939
|
-
if (v4Config.environments && Object.keys(v4Config.environments).length > 0) {
|
|
940
|
-
console.log('');
|
|
941
|
-
console.log(chalk_1.default.blue('=== API URL Configuration ==='));
|
|
942
|
-
console.log(chalk_1.default.dim('The following API URLs were added to .env.genbox:'));
|
|
943
|
-
console.log('');
|
|
944
|
-
console.log(chalk_1.default.dim(' LOCAL_API_URL=http://localhost:3050'));
|
|
945
|
-
for (const [envName, envConfig] of Object.entries(v4Config.environments)) {
|
|
946
|
-
// v4 format: urls.api contains the API URL
|
|
947
|
-
const apiUrl = envConfig.urls?.api || envConfig.urls?.gateway;
|
|
948
|
-
if (apiUrl) {
|
|
949
|
-
const varName = `${envName.toUpperCase()}_API_URL`;
|
|
950
|
-
console.log(chalk_1.default.dim(` ${varName}=${apiUrl}`));
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
console.log('');
|
|
954
|
-
console.log(chalk_1.default.yellow('To use dynamic API URLs:'));
|
|
955
|
-
console.log(chalk_1.default.dim(' Use ${API_URL} in your app env vars, e.g.:'));
|
|
956
|
-
console.log(chalk_1.default.cyan(' VITE_API_BASE_URL=${API_URL}'));
|
|
957
|
-
console.log(chalk_1.default.cyan(' NEXT_PUBLIC_API_URL=${API_URL}'));
|
|
958
|
-
console.log('');
|
|
959
|
-
console.log(chalk_1.default.dim(' At create time, ${API_URL} expands based on profile:'));
|
|
960
|
-
console.log(chalk_1.default.dim(' • default_connection: staging → uses STAGING_API_URL'));
|
|
961
|
-
console.log(chalk_1.default.dim(' • default_connection: production → uses PRODUCTION_API_URL'));
|
|
962
|
-
console.log(chalk_1.default.dim(' • local/no default_connection → uses LOCAL_API_URL'));
|
|
963
|
-
}
|
|
964
938
|
// CORS Configuration Warning
|
|
965
939
|
const hasBackendApps = scan.apps.some(a => a.type === 'backend' || a.type === 'api');
|
|
966
940
|
const hasFrontendApps = scan.apps.some(a => a.type === 'frontend');
|