genbox 1.0.18 → 1.0.19
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 +32 -3
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -925,13 +925,42 @@ exports.initCommand = new commander_1.Command('init')
|
|
|
925
925
|
console.log(chalk_1.default.dim(' • default_connection: production → uses PRODUCTION_API_URL'));
|
|
926
926
|
console.log(chalk_1.default.dim(' • local/no default_connection → uses LOCAL_API_URL'));
|
|
927
927
|
}
|
|
928
|
+
// CORS Configuration Warning
|
|
929
|
+
const hasBackendApps = scan.apps.some(a => a.type === 'backend' || a.type === 'api');
|
|
930
|
+
const hasFrontendApps = scan.apps.some(a => a.type === 'frontend');
|
|
931
|
+
if (hasBackendApps && hasFrontendApps) {
|
|
932
|
+
console.log('');
|
|
933
|
+
console.log(chalk_1.default.yellow('=== CORS Configuration Required ==='));
|
|
934
|
+
console.log(chalk_1.default.white('To use genbox environments, add .genbox.dev to your backend CORS config:'));
|
|
935
|
+
console.log('');
|
|
936
|
+
console.log(chalk_1.default.dim(' NestJS (main.ts):'));
|
|
937
|
+
console.log(chalk_1.default.cyan(` app.enableCors({`));
|
|
938
|
+
console.log(chalk_1.default.cyan(` origin: [/\\.genbox\\.dev$/, ...otherOrigins],`));
|
|
939
|
+
console.log(chalk_1.default.cyan(` credentials: true,`));
|
|
940
|
+
console.log(chalk_1.default.cyan(` });`));
|
|
941
|
+
console.log('');
|
|
942
|
+
console.log(chalk_1.default.dim(' Express:'));
|
|
943
|
+
console.log(chalk_1.default.cyan(` app.use(cors({ origin: /\\.genbox\\.dev$/ }));`));
|
|
944
|
+
console.log('');
|
|
945
|
+
console.log(chalk_1.default.dim(' Or use env var: CORS_ORIGINS=*.genbox.dev'));
|
|
946
|
+
console.log('');
|
|
947
|
+
console.log(chalk_1.default.red(' Without this, you will see CORS errors when accessing genbox environments.'));
|
|
948
|
+
}
|
|
928
949
|
// Next steps
|
|
929
950
|
console.log('');
|
|
930
951
|
console.log(chalk_1.default.bold('Next steps:'));
|
|
931
952
|
console.log(chalk_1.default.dim(` 1. Review and edit ${CONFIG_FILENAME}`));
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
953
|
+
if (hasBackendApps && hasFrontendApps) {
|
|
954
|
+
console.log(chalk_1.default.yellow(` 2. Add .genbox.dev to your backend CORS configuration`));
|
|
955
|
+
console.log(chalk_1.default.dim(` 3. Update ${ENV_FILENAME} to use API URL variables where needed`));
|
|
956
|
+
console.log(chalk_1.default.dim(` 4. Run 'genbox profiles' to see available profiles`));
|
|
957
|
+
console.log(chalk_1.default.dim(` 5. Run 'genbox create <name> --profile <profile>' to create an environment`));
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
console.log(chalk_1.default.dim(` 2. Update ${ENV_FILENAME} to use API URL variables where needed`));
|
|
961
|
+
console.log(chalk_1.default.dim(` 3. Run 'genbox profiles' to see available profiles`));
|
|
962
|
+
console.log(chalk_1.default.dim(` 4. Run 'genbox create <name> --profile <profile>' to create an environment`));
|
|
963
|
+
}
|
|
935
964
|
}
|
|
936
965
|
catch (error) {
|
|
937
966
|
if (error.name === 'ExitPromptError' || error.message?.includes('force closed')) {
|