@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 CHANGED
@@ -124629,7 +124629,7 @@ function readAllPackageReferences(csprojContent) {
124629
124629
  }
124630
124630
  return packages;
124631
124631
  }
124632
- async function findProjectsWithSmartStack(projectDir) {
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
- if (currentVersion !== null) {
124649
- projects.push({
124650
- csprojPath,
124651
- relPath: csprojPath.replace(projectDir, "").replace(/^[/\\]/, ""),
124652
- currentVersion
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 SmartStack projects...");
124837
- const projects = await findProjectsWithSmartStack(projectDir);
124838
- if (projects.length === 0) {
124839
- logger.warning("No .NET projects found with SmartStack PackageReference.");
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
- logger.info(`Found ${source_default.cyan(projects.length)} project(s):`);
124843
- for (const p of projects) {
124844
- const versionInfo = p.currentVersion ? `${source_default.yellow(p.currentVersion)} \u2192 ${source_default.cyan(nugetVersion)}` : source_default.gray("version unknown");
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})`);
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
- const projectsToUpgrade = projects.filter((p) => p.currentVersion !== nugetVersion);
124851
- result.nugetSkipped = projects.length - projectsToUpgrade.length;
124852
- if (projectsToUpgrade.length === 0) {
124853
- logger.success(`All ${projects.length} project(s) already at ${source_default.cyan(nugetVersion)}`);
124854
- } else {
124855
- logger.info(`Upgrading ${projectsToUpgrade.length} project(s)...`);
124856
- for (const project of projectsToUpgrade) {
124857
- logger.info(`Upgrading ${source_default.cyan(project.relPath)}...`);
124858
- try {
124859
- execCommand2(`dotnet add "${project.csprojPath}" package SmartStack --version ${nugetVersion}`, void 0, dryRun);
124860
- result.nugetUpgraded++;
124861
- } catch (error) {
124862
- result.nugetFailed++;
124863
- logger.error(`Failed to upgrade ${project.relPath}: ${error instanceof Error ? error.message : error}`);
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
- if (result.nugetUpgraded > 0) {
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 projects) {
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
- const relPath = project.relPath;
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(` [DRY RUN] ${pkg2.name} ${source_default.yellow(pkg2.currentVersion)} \u2192 latest`);
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(` ${source_default.green("\u2713")} ${pkg2.name} ${source_default.yellow(pkg2.currentVersion)} \u2192 ${source_default.cyan(newVersion)}`);
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(` ${source_default.red("\u2717")} ${pkg2.name}: ${error instanceof Error ? error.message : error}`);
124911
+ logger.error(` ${source_default.red("\u2717")} ${pkg2.name}: ${error instanceof Error ? error.message : error}`);
124903
124912
  }
124904
124913
  }
124905
124914
  }