genbox 1.0.33 → 1.0.34
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 +31 -14
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -1021,7 +1021,20 @@ function createProfilesFromScan(scan, definedEnvironments = []) {
|
|
|
1021
1021
|
const profiles = {};
|
|
1022
1022
|
const frontendApps = scan.apps.filter(a => a.type === 'frontend');
|
|
1023
1023
|
const backendApps = scan.apps.filter(a => a.type === 'backend' || a.type === 'api');
|
|
1024
|
-
|
|
1024
|
+
// Docker services are also runnable (api, web services from docker-compose)
|
|
1025
|
+
const dockerServices = scan.compose?.applications || [];
|
|
1026
|
+
const dockerServiceNames = dockerServices.map(s => s.name);
|
|
1027
|
+
// Combine backend apps + Docker services (avoid duplicates)
|
|
1028
|
+
const allBackendNames = new Set([
|
|
1029
|
+
...backendApps.map(a => a.name),
|
|
1030
|
+
...dockerServiceNames.filter(name => {
|
|
1031
|
+
// Include Docker services that aren't already in apps OR aren't frontend
|
|
1032
|
+
const existingApp = scan.apps.find(a => a.name === name);
|
|
1033
|
+
return !existingApp || existingApp.type !== 'frontend';
|
|
1034
|
+
}),
|
|
1035
|
+
]);
|
|
1036
|
+
const backendAppNames = Array.from(allBackendNames);
|
|
1037
|
+
const hasBackend = backendAppNames.length > 0;
|
|
1025
1038
|
// Determine which environment to use for remote connections
|
|
1026
1039
|
// Priority: staging > production > first defined
|
|
1027
1040
|
const remoteEnv = definedEnvironments.includes('staging')
|
|
@@ -1045,32 +1058,32 @@ function createProfilesFromScan(scan, definedEnvironments = []) {
|
|
|
1045
1058
|
// No remote environment - create local-only profiles
|
|
1046
1059
|
for (const frontend of frontendApps.slice(0, 3)) {
|
|
1047
1060
|
profiles[`${frontend.name}-local`] = {
|
|
1048
|
-
description: `${frontend.name} with local
|
|
1061
|
+
description: `${frontend.name} with local backend`,
|
|
1049
1062
|
size: 'medium',
|
|
1050
|
-
apps: [frontend.name, ...
|
|
1063
|
+
apps: [frontend.name, ...backendAppNames],
|
|
1051
1064
|
};
|
|
1052
1065
|
}
|
|
1053
1066
|
}
|
|
1054
1067
|
// Full local development (with DB copy from available environment)
|
|
1055
|
-
if (
|
|
1068
|
+
if (hasBackend && frontendApps.length > 0) {
|
|
1056
1069
|
const primaryFrontend = frontendApps[0];
|
|
1057
1070
|
const dbSource = remoteEnv || 'staging'; // Use defined env or default
|
|
1058
1071
|
profiles[`${primaryFrontend.name}-full`] = {
|
|
1059
|
-
description: `${primaryFrontend.name} + local
|
|
1072
|
+
description: `${primaryFrontend.name} + local backend + DB copy`,
|
|
1060
1073
|
size: 'large',
|
|
1061
|
-
apps: [primaryFrontend.name,
|
|
1074
|
+
apps: [primaryFrontend.name, ...backendAppNames],
|
|
1062
1075
|
database: {
|
|
1063
1076
|
mode: remoteEnv ? 'copy' : 'local', // Only copy if we have a source
|
|
1064
1077
|
...(remoteEnv && { source: dbSource }),
|
|
1065
1078
|
},
|
|
1066
1079
|
};
|
|
1067
1080
|
}
|
|
1068
|
-
//
|
|
1069
|
-
|
|
1070
|
-
profiles[
|
|
1071
|
-
description:
|
|
1081
|
+
// Backend/service development only (for each backend app and Docker service)
|
|
1082
|
+
for (const backendName of backendAppNames) {
|
|
1083
|
+
profiles[`${backendName}-dev`] = {
|
|
1084
|
+
description: `${backendName} with local infrastructure`,
|
|
1072
1085
|
size: 'medium',
|
|
1073
|
-
apps: [
|
|
1086
|
+
apps: [backendName],
|
|
1074
1087
|
database: {
|
|
1075
1088
|
mode: 'local',
|
|
1076
1089
|
},
|
|
@@ -1085,13 +1098,17 @@ function createProfilesFromScan(scan, definedEnvironments = []) {
|
|
|
1085
1098
|
default_connection: remoteEnv,
|
|
1086
1099
|
};
|
|
1087
1100
|
}
|
|
1088
|
-
// Full stack
|
|
1089
|
-
|
|
1101
|
+
// Full stack - combine apps + Docker services (deduplicated)
|
|
1102
|
+
const allRunnableNames = new Set([
|
|
1103
|
+
...scan.apps.filter(a => a.type !== 'library').map(a => a.name),
|
|
1104
|
+
...dockerServiceNames,
|
|
1105
|
+
]);
|
|
1106
|
+
if (allRunnableNames.size > 1) {
|
|
1090
1107
|
const dbSource = remoteEnv || 'staging';
|
|
1091
1108
|
profiles['full-stack'] = {
|
|
1092
1109
|
description: 'Everything local' + (remoteEnv ? ' with DB copy' : ''),
|
|
1093
1110
|
size: 'xl',
|
|
1094
|
-
apps:
|
|
1111
|
+
apps: Array.from(allRunnableNames),
|
|
1095
1112
|
database: {
|
|
1096
1113
|
mode: remoteEnv ? 'copy' : 'local',
|
|
1097
1114
|
...(remoteEnv && { source: dbSource }),
|