dep-radius 0.1.0 → 0.2.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/README.md CHANGED
@@ -10,6 +10,7 @@ Which changes in a dependency update land on code you actually wrote.
10
10
  npx dep-radius # every direct dependency with an update waiting
11
11
  npx dep-radius schemakit # one package
12
12
  npx dep-radius schemakit@3.2.0 # an exact target
13
+ npx dep-radius --since main # the dependencies whose version changed since that commit
13
14
  ```
14
15
 
15
16
  ```
@@ -56,9 +57,10 @@ quiet verdict that stood on one net only is marked `*`.
56
57
 
57
58
  ## Options
58
59
 
59
- `--json`, `--markdown` (a pull request comment), `--offline`, `--min-age <duration>` (default 1d, or
60
- the project's `minimumReleaseAge`), `--latest`, `--no-notes`, `--no-surface`, `--prod`, `--verbose`.
61
- Set `GITHUB_TOKEN`, or log in with `gh`, to lift GitHub's limit from 60 to 5000 requests an hour.
60
+ `--json`, `--markdown` (a pull request comment), `--since <git-ref>` (compare with a commit, reading
61
+ its lockfile, nothing installed), `--offline`, `--min-age <duration>` (default 1d, or the project's
62
+ `minimumReleaseAge`), `--latest`, `--no-notes`, `--no-surface`, `--prod`, `--verbose`. Set
63
+ `GITHUB_TOKEN`, or log in with `gh`, to lift GitHub's limit from 60 to 5000 requests an hour.
62
64
 
63
65
  `--json` is a stable contract, `schemaVersion: 1`, described by
64
66
  [`brief-v1.schema.json`](../core/schema/brief-v1.schema.json), shipped in `@dep-radius/core` as
package/dist/cli.js CHANGED
@@ -12,6 +12,8 @@ const HELP = `radius: which changes in a dependency update land on code you wrot
12
12
  usage
13
13
  radius [path] every direct dependency with an update waiting
14
14
  radius <pkg>[@<version|tag>] ... only these packages (a version analyses that exact target)
15
+ radius --since <git-ref> the dependencies whose version changed since that commit,
16
+ for a pull request or right after an upgrade
15
17
 
16
18
  options
17
19
  --json the brief as JSON (schemaVersion 1)
@@ -49,6 +51,7 @@ async function main(argv) {
49
51
  offline: { type: "boolean" },
50
52
  "min-age": { type: "string" },
51
53
  latest: { type: "boolean" },
54
+ since: { type: "string" },
52
55
  notes: { type: "boolean", default: true },
53
56
  surface: { type: "boolean", default: true },
54
57
  prod: { type: "boolean" },
@@ -78,6 +81,10 @@ async function main(argv) {
78
81
  process.stderr.write("radius: --json and --markdown cannot be combined\n");
79
82
  return 3;
80
83
  }
84
+ if (v.since !== undefined && v.latest) {
85
+ process.stderr.write("radius: --since and --latest cannot be combined\n");
86
+ return 3;
87
+ }
81
88
  let root = process.cwd();
82
89
  const specs = [];
83
90
  // a path is written like one (./x, ../x, /x, a/b that exists); a bare word is a package, so a
@@ -126,6 +133,7 @@ async function main(argv) {
126
133
  offline: !!v.offline,
127
134
  minAgeMs,
128
135
  latest: !!v.latest,
136
+ ...(v.since ? { since: v.since } : {}),
129
137
  notes: v.notes !== false,
130
138
  surface: v.surface !== false,
131
139
  prod: !!v.prod,
@@ -1,5 +1,5 @@
1
1
  import { styleText } from "node:util";
2
- import { ago, coverageLabel, groupBriefs, oneNetOnly, opaqueLabel, siteLabel, sitesFor, surfaceLabel, } from "@dep-radius/core/render";
2
+ import { ago, coverageLabel, groupBriefs, oneNetOnly, opaqueLabel, sinceLabel, siteLabel, sitesFor, surfaceLabel, } from "@dep-radius/core/render";
3
3
  export function renderTerminal(brief, opts) {
4
4
  const c = (style, s) => (opts.color ? styleText(style, s) : s);
5
5
  const out = [];
@@ -7,7 +7,9 @@ export function renderTerminal(brief, opts) {
7
7
  const sources = [...new Set(brief.packages.map((p) => p.versionSource))].join(", ") ||
8
8
  "none";
9
9
  out.push(`${c("bold", "radius")} ${brief.root}`);
10
- out.push(c("dim", `${brief.manifests} ${brief.manifests === 1 ? "manifest" : "manifests"} · ${brief.packages.length} with an update · ${brief.upToDate} up to date · versions from ${sources}`));
10
+ out.push(c("dim", brief.since
11
+ ? `${brief.manifests} ${brief.manifests === 1 ? "manifest" : "manifests"} · since ${sinceLabel(brief.since)} · ${brief.packages.length} changed · ${brief.upToDate} unchanged`
12
+ : `${brief.manifests} ${brief.manifests === 1 ? "manifest" : "manifests"} · ${brief.packages.length} with an update · ${brief.upToDate} up to date · versions from ${sources}`));
11
13
  out.push("");
12
14
  const siteCap = opts.verbose ? Number.POSITIVE_INFINITY : 5;
13
15
  for (const p of g.detailed) {
@@ -53,7 +55,7 @@ export function renderTerminal(brief, opts) {
53
55
  }
54
56
  const count = (v) => brief.packages.filter((p) => p.verdict === v).length;
55
57
  out.push("");
56
- out.push(`${c("bold", `${brief.packages.length} with an update`)} ${c("green", `${count("quiet")} quiet`)} · ${c("yellow", `${count("review")} review`)} · ${c("red", `${count("blocked")} blocked`)} ${c("dim", `· ${brief.upToDate} up to date`)}`);
58
+ out.push(`${c("bold", `${brief.packages.length} ${brief.since ? "changed" : "with an update"}`)} ${c("green", `${count("quiet")} quiet`)} · ${c("yellow", `${count("review")} review`)} · ${c("red", `${count("blocked")} blocked`)} ${c("dim", `· ${brief.upToDate} ${brief.since ? "unchanged" : "up to date"}`)}`);
57
59
  return `${out.join("\n")}\n`;
58
60
  }
59
61
  function packageBlock(p, c, siteCap, opts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dep-radius",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Tells you which changes in a dependency update land on code you actually wrote.",
5
5
  "license": "MIT",
6
6
  "author": "prakticode",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@clack/prompts": "^1.8.0",
44
- "@dep-radius/core": "^0.1.0"
44
+ "@dep-radius/core": "^0.2.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@repo/eslint-config": "0.0.0",