@atlashub/smartstack-cli 2.8.0 → 2.9.0
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/index.js
CHANGED
|
@@ -116538,6 +116538,30 @@ EndGlobal
|
|
|
116538
116538
|
if (!dryRun) {
|
|
116539
116539
|
await import_fs_extra5.default.ensureDir((0, import_path6.join)(apiDir, "wwwroot"));
|
|
116540
116540
|
}
|
|
116541
|
+
if (!dryRun) {
|
|
116542
|
+
for (const { proj, type } of projects) {
|
|
116543
|
+
if (type === "classlib") {
|
|
116544
|
+
const class1Path = (0, import_path6.join)(srcDir, proj, "Class1.cs");
|
|
116545
|
+
if (await import_fs_extra5.default.pathExists(class1Path)) {
|
|
116546
|
+
await import_fs_extra5.default.remove(class1Path);
|
|
116547
|
+
logger.info(`Removed placeholder: ${proj}/Class1.cs`);
|
|
116548
|
+
}
|
|
116549
|
+
}
|
|
116550
|
+
}
|
|
116551
|
+
const apiPlaceholders = [
|
|
116552
|
+
"Program.cs",
|
|
116553
|
+
"appsettings.json",
|
|
116554
|
+
"appsettings.Development.json",
|
|
116555
|
+
(0, import_path6.join)("Properties", "launchSettings.json")
|
|
116556
|
+
];
|
|
116557
|
+
for (const placeholder of apiPlaceholders) {
|
|
116558
|
+
const placeholderPath = (0, import_path6.join)(apiDir, placeholder);
|
|
116559
|
+
if (await import_fs_extra5.default.pathExists(placeholderPath)) {
|
|
116560
|
+
await import_fs_extra5.default.remove(placeholderPath);
|
|
116561
|
+
logger.info(`Removed placeholder: ${projectName}.Api/${placeholder}`);
|
|
116562
|
+
}
|
|
116563
|
+
}
|
|
116564
|
+
}
|
|
116541
116565
|
const launchSettings = {
|
|
116542
116566
|
$schema: "https://json.schemastore.org/launchsettings.json",
|
|
116543
116567
|
profiles: {
|
|
@@ -116558,6 +116582,15 @@ EndGlobal
|
|
|
116558
116582
|
environmentVariables: {
|
|
116559
116583
|
ASPNETCORE_ENVIRONMENT: "Development"
|
|
116560
116584
|
}
|
|
116585
|
+
},
|
|
116586
|
+
Local: {
|
|
116587
|
+
commandName: "Project",
|
|
116588
|
+
dotnetRunMessages: true,
|
|
116589
|
+
launchBrowser: false,
|
|
116590
|
+
applicationUrl: "https://localhost:7142;http://localhost:5142",
|
|
116591
|
+
environmentVariables: {
|
|
116592
|
+
ASPNETCORE_ENVIRONMENT: "Development"
|
|
116593
|
+
}
|
|
116561
116594
|
}
|
|
116562
116595
|
}
|
|
116563
116596
|
};
|
|
@@ -116572,24 +116605,6 @@ EndGlobal
|
|
|
116572
116605
|
logSafeWriteResult(launchRelPath, launchResult);
|
|
116573
116606
|
recordFile(state, "backend", launchRelPath, launchResult.hash);
|
|
116574
116607
|
}
|
|
116575
|
-
if (!dryRun) {
|
|
116576
|
-
for (const { proj, type } of projects) {
|
|
116577
|
-
if (type === "classlib") {
|
|
116578
|
-
const class1Path = (0, import_path6.join)(srcDir, proj, "Class1.cs");
|
|
116579
|
-
if (await import_fs_extra5.default.pathExists(class1Path)) {
|
|
116580
|
-
await import_fs_extra5.default.remove(class1Path);
|
|
116581
|
-
logger.info(`Removed placeholder: ${proj}/Class1.cs`);
|
|
116582
|
-
}
|
|
116583
|
-
}
|
|
116584
|
-
}
|
|
116585
|
-
for (const placeholder of ["appsettings.json", "appsettings.Development.json"]) {
|
|
116586
|
-
const placeholderPath = (0, import_path6.join)(apiDir, placeholder);
|
|
116587
|
-
if (await import_fs_extra5.default.pathExists(placeholderPath)) {
|
|
116588
|
-
await import_fs_extra5.default.remove(placeholderPath);
|
|
116589
|
-
logger.info(`Removed placeholder: ${projectName}.Api/${placeholder}`);
|
|
116590
|
-
}
|
|
116591
|
-
}
|
|
116592
|
-
}
|
|
116593
116608
|
if (!dryRun) {
|
|
116594
116609
|
for (const { proj } of projects) {
|
|
116595
116610
|
const csprojPath = (0, import_path6.join)(srcDir, proj, `${proj}.csproj`);
|
|
@@ -124821,6 +124836,26 @@ async function executeMigrations(projectDir, fromVersion, toVersion, dryRun) {
|
|
|
124821
124836
|
hasErrors
|
|
124822
124837
|
};
|
|
124823
124838
|
}
|
|
124839
|
+
async function validateProgramCs(projectDir, baseNamespace) {
|
|
124840
|
+
const programPath = (0, import_path7.join)(projectDir, "src", `${baseNamespace}.Api`, "Program.cs");
|
|
124841
|
+
if (!await import_fs_extra6.default.pathExists(programPath)) {
|
|
124842
|
+
return ["Program.cs not found"];
|
|
124843
|
+
}
|
|
124844
|
+
const content = await import_fs_extra6.default.readFile(programPath, "utf-8");
|
|
124845
|
+
const requiredCalls = [
|
|
124846
|
+
{ pattern: /\.AddSmartStack\s*\(/, label: "AddSmartStack()" },
|
|
124847
|
+
{ pattern: /\.InitializeSmartStackAsync\s*\(/, label: "InitializeSmartStackAsync()" },
|
|
124848
|
+
{ pattern: /\.UseSmartStack\s*\(/, label: "UseSmartStack()" },
|
|
124849
|
+
{ pattern: /\.MapSmartStack\s*\(/, label: "MapSmartStack()" }
|
|
124850
|
+
];
|
|
124851
|
+
const missing = [];
|
|
124852
|
+
for (const { pattern, label } of requiredCalls) {
|
|
124853
|
+
if (!pattern.test(content)) {
|
|
124854
|
+
missing.push(label);
|
|
124855
|
+
}
|
|
124856
|
+
}
|
|
124857
|
+
return missing;
|
|
124858
|
+
}
|
|
124824
124859
|
async function syncAppSettings(projectDir, baseNamespace, dryRun) {
|
|
124825
124860
|
const appSettingsPath = (0, import_path7.join)(projectDir, "src", `${baseNamespace}.Api`, "appsettings.json");
|
|
124826
124861
|
if (!await import_fs_extra6.default.pathExists(appSettingsPath)) {
|
|
@@ -124858,7 +124893,8 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
|
|
|
124858
124893
|
otherPkgFailed: 0,
|
|
124859
124894
|
npmUpgraded: false,
|
|
124860
124895
|
npmSkipped: false,
|
|
124861
|
-
configSynced: 0
|
|
124896
|
+
configSynced: 0,
|
|
124897
|
+
programCsIssues: []
|
|
124862
124898
|
};
|
|
124863
124899
|
if (dryRun) {
|
|
124864
124900
|
logger.warning("DRY RUN MODE - No packages will be upgraded");
|
|
@@ -125049,6 +125085,26 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
|
|
|
125049
125085
|
logger.info(`appsettings.json ${source_default.green("\u2713")} up to date`);
|
|
125050
125086
|
console.log();
|
|
125051
125087
|
}
|
|
125088
|
+
logger.info("Validating Program.cs...");
|
|
125089
|
+
result.programCsIssues = await validateProgramCs(projectDir, config.baseNamespace);
|
|
125090
|
+
if (result.programCsIssues.length > 0) {
|
|
125091
|
+
logger.error("Program.cs is missing required SmartStack calls:");
|
|
125092
|
+
for (const issue of result.programCsIssues) {
|
|
125093
|
+
logger.warning(` ${source_default.red("\u2717")} ${issue}`);
|
|
125094
|
+
}
|
|
125095
|
+
console.log();
|
|
125096
|
+
logger.warning("Your Program.cs must contain these 4 calls in order:");
|
|
125097
|
+
logger.info(` 1. builder.Services.${source_default.cyan("AddSmartStack")}(builder.Configuration);`);
|
|
125098
|
+
logger.info(` 2. await app.${source_default.cyan("InitializeSmartStackAsync")}();`);
|
|
125099
|
+
logger.info(` 3. app.${source_default.cyan("UseSmartStack")}();`);
|
|
125100
|
+
logger.info(` 4. app.${source_default.cyan("MapSmartStack")}();`);
|
|
125101
|
+
console.log();
|
|
125102
|
+
logger.info(`Reference template: ${source_default.cyan("ss init --dry-run")} or check SmartStack docs`);
|
|
125103
|
+
console.log();
|
|
125104
|
+
} else {
|
|
125105
|
+
logger.info(`Program.cs ${source_default.green("\u2713")} all SmartStack calls present`);
|
|
125106
|
+
console.log();
|
|
125107
|
+
}
|
|
125052
125108
|
if (!dryRun && nugetVersion) {
|
|
125053
125109
|
config.smartStackVersion = nugetVersion;
|
|
125054
125110
|
const configPath = (0, import_path7.join)(projectDir, ".smartstack", "config.json");
|
|
@@ -125058,7 +125114,8 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
|
|
|
125058
125114
|
}
|
|
125059
125115
|
const totalChanged = result.nugetUpgraded + result.otherPkgUpdated + (result.npmUpgraded ? 1 : 0) + migrationSummary.totalApplied + result.configSynced;
|
|
125060
125116
|
const allUpToDate = totalChanged === 0 && result.nugetFailed === 0 && result.otherPkgFailed === 0;
|
|
125061
|
-
|
|
125117
|
+
const hasProgramIssues = result.programCsIssues.length > 0;
|
|
125118
|
+
if (allUpToDate && !hasProgramIssues) {
|
|
125062
125119
|
const summary = [
|
|
125063
125120
|
source_default.green.bold("Already up to date!"),
|
|
125064
125121
|
"",
|
|
@@ -125068,6 +125125,16 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
|
|
|
125068
125125
|
"All packages at latest versions."
|
|
125069
125126
|
].filter(Boolean);
|
|
125070
125127
|
logger.box(summary, "success");
|
|
125128
|
+
} else if (allUpToDate && hasProgramIssues) {
|
|
125129
|
+
const summary = [
|
|
125130
|
+
source_default.yellow.bold("Packages up to date, but Program.cs needs attention!"),
|
|
125131
|
+
"",
|
|
125132
|
+
` ${source_default.red("\u26A0")} Missing: ${result.programCsIssues.join(", ")}`,
|
|
125133
|
+
"",
|
|
125134
|
+
` Fix: Ensure Program.cs contains all 4 SmartStack bootstrap calls`,
|
|
125135
|
+
` Ref: ${source_default.cyan("ss init --dry-run")} to see the correct template`
|
|
125136
|
+
];
|
|
125137
|
+
logger.box(summary, "warning");
|
|
125071
125138
|
} else {
|
|
125072
125139
|
const lines = [
|
|
125073
125140
|
source_default.green.bold("Upgrade completed!"),
|
|
@@ -125100,12 +125167,18 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
|
|
|
125100
125167
|
if (result.configSynced > 0) {
|
|
125101
125168
|
lines.push(` ${source_default.green("\u2713")} Config: ${result.configSynced} new setting(s) added`);
|
|
125102
125169
|
}
|
|
125170
|
+
if (result.programCsIssues.length > 0) {
|
|
125171
|
+
lines.push(` ${source_default.red("\u26A0")} Program.cs: ${result.programCsIssues.length} missing call(s) - manual fix required`);
|
|
125172
|
+
}
|
|
125103
125173
|
lines.push("");
|
|
125104
125174
|
lines.push(source_default.yellow("Next steps:"));
|
|
125175
|
+
if (result.programCsIssues.length > 0) {
|
|
125176
|
+
lines.push(` ${source_default.red("!")} Fix Program.cs first (see warnings above)`);
|
|
125177
|
+
}
|
|
125105
125178
|
lines.push(` 1. Review changes: ${source_default.cyan("git diff")}`);
|
|
125106
125179
|
lines.push(` 2. Test your application`);
|
|
125107
125180
|
lines.push(` 3. Commit changes: ${source_default.cyan('git add . && git commit -m "chore: upgrade SmartStack to ' + nugetVersion + '"')}`);
|
|
125108
|
-
logger.box(lines, "success");
|
|
125181
|
+
logger.box(lines, result.programCsIssues.length > 0 ? "warning" : "success");
|
|
125109
125182
|
}
|
|
125110
125183
|
});
|
|
125111
125184
|
|