genbox 1.0.50 → 1.0.51
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 +29 -8
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -875,9 +875,14 @@ async function setupProfiles(detected, environments) {
|
|
|
875
875
|
value: name,
|
|
876
876
|
}));
|
|
877
877
|
const profilesToEdit = await prompts.checkbox({
|
|
878
|
-
message: 'Select profiles to edit:',
|
|
878
|
+
message: 'Select profiles to edit (space to select, enter to confirm):',
|
|
879
879
|
choices: profileChoices,
|
|
880
|
+
required: true,
|
|
880
881
|
});
|
|
882
|
+
if (profilesToEdit.length === 0) {
|
|
883
|
+
console.log(chalk_1.default.dim('No profiles selected for editing.'));
|
|
884
|
+
return profiles;
|
|
885
|
+
}
|
|
881
886
|
for (const profileName of profilesToEdit) {
|
|
882
887
|
profiles[profileName] = await editSingleProfile(profileName, profiles[profileName], detected, environments);
|
|
883
888
|
}
|
|
@@ -963,6 +968,20 @@ async function editSingleProfile(name, profile, detected, environments) {
|
|
|
963
968
|
console.log(chalk_1.default.green(`✓ Updated profile: ${name}`));
|
|
964
969
|
return result;
|
|
965
970
|
}
|
|
971
|
+
/**
|
|
972
|
+
* Calculate recommended server size based on apps + infrastructure count
|
|
973
|
+
* 1-2: small, 3-5: medium, 6-9: large, 10+: xl
|
|
974
|
+
*/
|
|
975
|
+
function calculateSize(appCount, infraCount = 0) {
|
|
976
|
+
const total = appCount + infraCount;
|
|
977
|
+
if (total <= 2)
|
|
978
|
+
return 'small';
|
|
979
|
+
if (total <= 5)
|
|
980
|
+
return 'medium';
|
|
981
|
+
if (total <= 9)
|
|
982
|
+
return 'large';
|
|
983
|
+
return 'xl';
|
|
984
|
+
}
|
|
966
985
|
/**
|
|
967
986
|
* Generate default profiles based on detected apps and environments
|
|
968
987
|
*/
|
|
@@ -971,16 +990,17 @@ function generateDefaultProfiles(detected, environments) {
|
|
|
971
990
|
const frontendApps = Object.entries(detected.apps).filter(([, app]) => app.type === 'frontend');
|
|
972
991
|
const backendApps = Object.entries(detected.apps).filter(([, app]) => app.type === 'backend' || app.type === 'gateway');
|
|
973
992
|
const allRunnableApps = Object.entries(detected.apps).filter(([, app]) => app.type !== 'library');
|
|
993
|
+
const infraCount = detected.infrastructure?.length || 0;
|
|
974
994
|
const envNames = Object.keys(environments || {});
|
|
975
995
|
const remoteEnv = envNames.includes('staging') ? 'staging' :
|
|
976
996
|
envNames.includes('production') ? 'production' :
|
|
977
997
|
envNames[0];
|
|
978
|
-
// Quick UI profiles for frontends
|
|
998
|
+
// Quick UI profiles for frontends (no local infra needed when connecting to remote)
|
|
979
999
|
if (remoteEnv) {
|
|
980
1000
|
for (const [name] of frontendApps.slice(0, 2)) {
|
|
981
1001
|
profiles[`${name}-quick`] = {
|
|
982
1002
|
description: `${name} only, connected to ${remoteEnv}`,
|
|
983
|
-
size:
|
|
1003
|
+
size: calculateSize(1, 0),
|
|
984
1004
|
apps: [name],
|
|
985
1005
|
default_connection: remoteEnv,
|
|
986
1006
|
};
|
|
@@ -989,28 +1009,29 @@ function generateDefaultProfiles(detected, environments) {
|
|
|
989
1009
|
// Full local development - only create if multiple frontends exist (otherwise full-stack covers it)
|
|
990
1010
|
if (frontendApps.length > 1 && backendApps.length > 0) {
|
|
991
1011
|
for (const [frontendName] of frontendApps.slice(0, 2)) {
|
|
1012
|
+
const appCount = 1 + backendApps.length;
|
|
992
1013
|
profiles[`${frontendName}-full`] = {
|
|
993
1014
|
description: `${frontendName} + local backend` + (remoteEnv ? ' + DB copy' : ''),
|
|
994
|
-
size:
|
|
1015
|
+
size: calculateSize(appCount, infraCount),
|
|
995
1016
|
apps: [frontendName, ...backendApps.map(([n]) => n)],
|
|
996
1017
|
database: remoteEnv ? { mode: 'copy', source: remoteEnv } : { mode: 'local' },
|
|
997
1018
|
};
|
|
998
1019
|
}
|
|
999
1020
|
}
|
|
1000
|
-
// Backend development
|
|
1021
|
+
// Backend development (includes local infra like database)
|
|
1001
1022
|
for (const [name] of backendApps.slice(0, 2)) {
|
|
1002
1023
|
profiles[`${name}-dev`] = {
|
|
1003
1024
|
description: `${name} with local infrastructure`,
|
|
1004
|
-
size:
|
|
1025
|
+
size: calculateSize(1, infraCount),
|
|
1005
1026
|
apps: [name],
|
|
1006
1027
|
database: { mode: 'local' },
|
|
1007
1028
|
};
|
|
1008
1029
|
}
|
|
1009
|
-
// Full stack - includes all runnable apps
|
|
1030
|
+
// Full stack - includes all runnable apps + infra
|
|
1010
1031
|
if (allRunnableApps.length > 1) {
|
|
1011
1032
|
profiles['full-stack'] = {
|
|
1012
1033
|
description: 'Everything local' + (remoteEnv ? ' with DB copy' : ''),
|
|
1013
|
-
size:
|
|
1034
|
+
size: calculateSize(allRunnableApps.length, infraCount),
|
|
1014
1035
|
apps: allRunnableApps.map(([n]) => n),
|
|
1015
1036
|
database: remoteEnv ? { mode: 'copy', source: remoteEnv } : { mode: 'local' },
|
|
1016
1037
|
};
|