@cellajs/cli 0.6.0 → 0.6.1

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/README.md CHANGED
@@ -414,7 +414,8 @@ previous value, and a package.json without `type` gets upstream's. Set it yourse
414
414
 
415
415
  1. **Updates.** It lists the outdated packages and runtime pins in one table and asks once which to
416
416
  update. Rows with a high or critical advisory start ticked; submitting with nothing ticked skips
417
- this layer.
417
+ this layer. Above the prompt it prints what `pnpm audit` reports right now, including packages
418
+ that have no row, so a run you cancel has shown them too.
418
419
  2. **Security.** It audits the workspace as the picked updates leave it and brings three settings
419
420
  in `pnpm-workspace.yaml` in line with that audit.
420
421
 
package/dist/index.js CHANGED
@@ -228,7 +228,7 @@ import process5 from "process";
228
228
  // package.json
229
229
  var package_default = {
230
230
  name: "@cellajs/cli",
231
- version: "0.6.0",
231
+ version: "0.6.1",
232
232
  private: false,
233
233
  license: "MIT",
234
234
  description: "CLI for managing your monorepo and upgrading it with upstream Cella.",
@@ -4466,8 +4466,9 @@ async function runAudit(config) {
4466
4466
  }
4467
4467
  const runtimes = planRuntimeUpdates(pins, feeds, { releaseAgeMinutes, now });
4468
4468
  const localTools = planLocalTools(machine, { releaseAgeMinutes, now });
4469
+ const advisories = auditResult ? advisoriesFromAudit(auditResult) : null;
4469
4470
  const rows = [
4470
- ...packageRows(outdated, auditResult ? advisoriesFromAudit(auditResult) : []),
4471
+ ...packageRows(outdated, advisories ?? []),
4471
4472
  ...runtimes.updates.map(runtimeRow)
4472
4473
  ];
4473
4474
  if (rows.length === 0) {
@@ -4487,6 +4488,7 @@ async function runAudit(config) {
4487
4488
  await runSecurityPass(forkPath, { apply: false, releaseAgeMinutes });
4488
4489
  return;
4489
4490
  }
4491
+ printReported(advisories);
4490
4492
  const selected = await promptForUpdates(rows);
4491
4493
  if (!selected) return;
4492
4494
  const { edits, bumped } = await planEdits(forkPath, rows, selected, pins.nodeImageSuffixes);
@@ -4495,8 +4497,8 @@ async function runAudit(config) {
4495
4497
  spinner.stop();
4496
4498
  }
4497
4499
  }
4500
+ var worstSeverity = (advisories, name) => SEVERITIES.find((severity) => advisories.some((a) => a.module === name && a.severity === severity)) ?? null;
4498
4501
  function packageRows(outdated, advisories) {
4499
- const severityOf = (name) => SEVERITIES.find((severity) => advisories.some((a) => a.module === name && a.severity === severity)) ?? null;
4500
4502
  const readDependentPkg = createDependentPkgReader();
4501
4503
  const rows = Object.entries(outdated).map(([key, pkg]) => {
4502
4504
  const name = outdatedPackageName(key);
@@ -4520,7 +4522,7 @@ function packageRows(outdated, advisories) {
4520
4522
  pinnedIn,
4521
4523
  repoUrl,
4522
4524
  releasesUrl: getReleasesUrl(repoUrl),
4523
- severity: severityOf(name)
4525
+ severity: worstSeverity(advisories, name)
4524
4526
  };
4525
4527
  });
4526
4528
  return rows.sort((a, b) => inText(a).localeCompare(inText(b)) || a.name.localeCompare(b.name));
@@ -4626,6 +4628,40 @@ function printLocalTools(checks) {
4626
4628
  }
4627
4629
  console.info();
4628
4630
  }
4631
+ function printReported(advisories) {
4632
+ if (!advisories) {
4633
+ console.info(`${warningMark} pnpm audit gave no answer: a row in the table can lack its dot`);
4634
+ console.info();
4635
+ return;
4636
+ }
4637
+ if (advisories.length === 0) {
4638
+ console.info(`${checkMark} pnpm audit reports nothing ${colors_default.dim("\xB7 with the current overrides and ignores")}`);
4639
+ console.info();
4640
+ return;
4641
+ }
4642
+ const modules = [...new Set(advisories.map((a) => a.module))].map((name) => {
4643
+ const own = advisories.filter((a) => a.module === name);
4644
+ return {
4645
+ name,
4646
+ severity: worstSeverity(own, name) ?? own[0].severity,
4647
+ installed: [...new Set(own.flatMap((a) => a.installed))].join(", "),
4648
+ via: formatDependents([...new Set(own.flatMap((a) => a.via))]),
4649
+ direct: own.some((a) => a.direct)
4650
+ };
4651
+ });
4652
+ modules.sort((a, b) => SEVERITIES.indexOf(a.severity) - SEVERITIES.indexOf(b.severity));
4653
+ const nameWidth = Math.min(30, Math.max(...modules.map((m) => m.name.length)));
4654
+ const versionWidth = Math.max(...modules.map((m) => m.installed.length));
4655
+ console.info(`${colors_default.bold("pnpm audit")} ${colors_default.dim("\xB7 with the current overrides and ignores")}`);
4656
+ for (const m of modules) {
4657
+ const name = colors_default.white(middleTruncate(m.name, nameWidth).padEnd(nameWidth));
4658
+ const source = `${m.via}${m.direct ? " (direct)" : ""}`;
4659
+ console.info(
4660
+ `${getVulnIcon(m.severity)} ${name} ${m.severity.padEnd(8)} ${m.installed.padEnd(versionWidth)} ${colors_default.dim(source)}`
4661
+ );
4662
+ }
4663
+ console.info();
4664
+ }
4629
4665
  function buildUpdateChoices(rows) {
4630
4666
  const makeChoice = (row) => {
4631
4667
  const devTag = row.isDev ? colors_default.dim(" (dev)") : "";