@atlashub/smartstack-cli 2.6.2 → 2.6.3
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 +54 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -124629,7 +124629,7 @@ function readAllPackageReferences(csprojContent) {
|
|
|
124629
124629
|
}
|
|
124630
124630
|
return packages;
|
|
124631
124631
|
}
|
|
124632
|
-
async function
|
|
124632
|
+
async function findAllProjects(projectDir) {
|
|
124633
124633
|
const srcDir = (0, import_path7.join)(projectDir, "src");
|
|
124634
124634
|
if (!await import_fs_extra6.default.pathExists(srcDir)) {
|
|
124635
124635
|
return [];
|
|
@@ -124645,13 +124645,11 @@ async function findProjectsWithSmartStack(projectDir) {
|
|
|
124645
124645
|
const csprojPath = (0, import_path7.join)(folderPath, csproj);
|
|
124646
124646
|
const content = await import_fs_extra6.default.readFile(csprojPath, "utf-8");
|
|
124647
124647
|
const currentVersion = readPackageVersion(content, "SmartStack");
|
|
124648
|
-
|
|
124649
|
-
|
|
124650
|
-
|
|
124651
|
-
|
|
124652
|
-
|
|
124653
|
-
});
|
|
124654
|
-
}
|
|
124648
|
+
projects.push({
|
|
124649
|
+
csprojPath,
|
|
124650
|
+
relPath: csprojPath.replace(projectDir, "").replace(/^[/\\]/, ""),
|
|
124651
|
+
currentVersion
|
|
124652
|
+
});
|
|
124655
124653
|
}
|
|
124656
124654
|
}
|
|
124657
124655
|
}
|
|
@@ -124833,51 +124831,62 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
|
|
|
124833
124831
|
logger.success(`Latest npm version: ${source_default.cyan(npmVersion)}`);
|
|
124834
124832
|
}
|
|
124835
124833
|
console.log();
|
|
124836
|
-
logger.info("Scanning for
|
|
124837
|
-
const
|
|
124838
|
-
if (
|
|
124839
|
-
logger.warning("No .NET projects found
|
|
124840
|
-
logger.info('Tip: Ensure your .csproj files contain <PackageReference Include="SmartStack" Version="..." />');
|
|
124834
|
+
logger.info("Scanning for .NET projects...");
|
|
124835
|
+
const allProjects = await findAllProjects(projectDir);
|
|
124836
|
+
if (allProjects.length === 0) {
|
|
124837
|
+
logger.warning("No .NET projects found in src/ directory.");
|
|
124841
124838
|
} else {
|
|
124842
|
-
|
|
124843
|
-
|
|
124844
|
-
|
|
124845
|
-
|
|
124846
|
-
const
|
|
124847
|
-
|
|
124839
|
+
const smartStackProjects = allProjects.filter((p) => p.currentVersion !== null);
|
|
124840
|
+
const otherProjects = allProjects.filter((p) => p.currentVersion === null);
|
|
124841
|
+
if (smartStackProjects.length > 0) {
|
|
124842
|
+
logger.info(`Found ${source_default.cyan(smartStackProjects.length)} project(s) with SmartStack:`);
|
|
124843
|
+
for (const p of smartStackProjects) {
|
|
124844
|
+
const versionInfo = `${source_default.yellow(p.currentVersion)} \u2192 ${source_default.cyan(nugetVersion)}`;
|
|
124845
|
+
const upToDate = p.currentVersion === nugetVersion;
|
|
124846
|
+
const statusIcon = upToDate ? source_default.green("\u2713") : source_default.yellow("\u2191");
|
|
124847
|
+
logger.info(` ${statusIcon} ${p.relPath} (${upToDate ? source_default.green("up to date") : versionInfo})`);
|
|
124848
|
+
}
|
|
124849
|
+
}
|
|
124850
|
+
if (otherProjects.length > 0) {
|
|
124851
|
+
logger.info(`Found ${source_default.cyan(otherProjects.length)} other project(s):`);
|
|
124852
|
+
for (const p of otherProjects) {
|
|
124853
|
+
logger.info(` ${source_default.gray("\u25CB")} ${p.relPath}`);
|
|
124854
|
+
}
|
|
124848
124855
|
}
|
|
124849
124856
|
console.log();
|
|
124850
|
-
|
|
124851
|
-
|
|
124852
|
-
|
|
124853
|
-
|
|
124854
|
-
|
|
124855
|
-
|
|
124856
|
-
|
|
124857
|
-
|
|
124858
|
-
|
|
124859
|
-
|
|
124860
|
-
|
|
124861
|
-
|
|
124862
|
-
|
|
124863
|
-
|
|
124857
|
+
if (smartStackProjects.length > 0) {
|
|
124858
|
+
const projectsToUpgrade = smartStackProjects.filter((p) => p.currentVersion !== nugetVersion);
|
|
124859
|
+
result.nugetSkipped = smartStackProjects.length - projectsToUpgrade.length;
|
|
124860
|
+
if (projectsToUpgrade.length === 0) {
|
|
124861
|
+
logger.success(`All ${smartStackProjects.length} SmartStack project(s) already at ${source_default.cyan(nugetVersion)}`);
|
|
124862
|
+
} else {
|
|
124863
|
+
logger.info(`Upgrading SmartStack in ${projectsToUpgrade.length} project(s)...`);
|
|
124864
|
+
for (const project of projectsToUpgrade) {
|
|
124865
|
+
logger.info(`Upgrading ${source_default.cyan(project.relPath)}...`);
|
|
124866
|
+
try {
|
|
124867
|
+
execCommand2(`dotnet add "${project.csprojPath}" package SmartStack --version ${nugetVersion}`, void 0, dryRun);
|
|
124868
|
+
result.nugetUpgraded++;
|
|
124869
|
+
} catch (error) {
|
|
124870
|
+
result.nugetFailed++;
|
|
124871
|
+
logger.error(`Failed to upgrade ${project.relPath}: ${error instanceof Error ? error.message : error}`);
|
|
124872
|
+
}
|
|
124873
|
+
}
|
|
124874
|
+
if (result.nugetUpgraded > 0) {
|
|
124875
|
+
logger.success(`${result.nugetUpgraded} project(s) upgraded to ${source_default.cyan(nugetVersion)}`);
|
|
124876
|
+
}
|
|
124877
|
+
if (result.nugetFailed > 0) {
|
|
124878
|
+
logger.error(`${result.nugetFailed} project(s) failed to upgrade`);
|
|
124864
124879
|
}
|
|
124865
124880
|
}
|
|
124866
|
-
|
|
124867
|
-
logger.success(`${result.nugetUpgraded} project(s) upgraded to ${source_default.cyan(nugetVersion)}`);
|
|
124868
|
-
}
|
|
124869
|
-
if (result.nugetFailed > 0) {
|
|
124870
|
-
logger.error(`${result.nugetFailed} project(s) failed to upgrade`);
|
|
124871
|
-
}
|
|
124881
|
+
console.log();
|
|
124872
124882
|
}
|
|
124873
|
-
console.log();
|
|
124874
124883
|
logger.info("Checking other NuGet packages...");
|
|
124875
|
-
for (const project of
|
|
124884
|
+
for (const project of allProjects) {
|
|
124876
124885
|
const content = await import_fs_extra6.default.readFile(project.csprojPath, "utf-8");
|
|
124877
124886
|
const allPackages = readAllPackageReferences(content);
|
|
124878
124887
|
const otherPackages = allPackages.filter((p) => p.name !== "SmartStack");
|
|
124879
124888
|
if (otherPackages.length === 0) continue;
|
|
124880
|
-
|
|
124889
|
+
logger.info(` ${source_default.cyan(project.relPath)}:`);
|
|
124881
124890
|
for (const pkg2 of otherPackages) {
|
|
124882
124891
|
try {
|
|
124883
124892
|
const output = dryRun ? `[DRY RUN] dotnet add "${project.csprojPath}" package ${pkg2.name}` : (0, import_child_process6.execSync)(
|
|
@@ -124885,21 +124894,21 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
|
|
|
124885
124894
|
{ shell: true, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
124886
124895
|
);
|
|
124887
124896
|
if (dryRun) {
|
|
124888
|
-
logger.info(`
|
|
124897
|
+
logger.info(` [DRY RUN] ${pkg2.name} ${source_default.yellow(pkg2.currentVersion)} \u2192 latest`);
|
|
124889
124898
|
result.otherPkgUpdated++;
|
|
124890
124899
|
continue;
|
|
124891
124900
|
}
|
|
124892
124901
|
const newContent = await import_fs_extra6.default.readFile(project.csprojPath, "utf-8");
|
|
124893
124902
|
const newVersion = readPackageVersion(newContent, pkg2.name);
|
|
124894
124903
|
if (newVersion && newVersion !== pkg2.currentVersion) {
|
|
124895
|
-
logger.success(`
|
|
124904
|
+
logger.success(` ${source_default.green("\u2713")} ${pkg2.name} ${source_default.yellow(pkg2.currentVersion)} \u2192 ${source_default.cyan(newVersion)}`);
|
|
124896
124905
|
result.otherPkgUpdated++;
|
|
124897
124906
|
} else {
|
|
124898
124907
|
result.otherPkgSkipped++;
|
|
124899
124908
|
}
|
|
124900
124909
|
} catch (error) {
|
|
124901
124910
|
result.otherPkgFailed++;
|
|
124902
|
-
logger.error(`
|
|
124911
|
+
logger.error(` ${source_default.red("\u2717")} ${pkg2.name}: ${error instanceof Error ? error.message : error}`);
|
|
124903
124912
|
}
|
|
124904
124913
|
}
|
|
124905
124914
|
}
|