@williamthorsen/nmr 2.0.0 → 2.0.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.
@@ -1,8 +1,12 @@
1
+ import process from 'node:process';
1
2
  import { formatGlyphLine, UserError } from '@williamthorsen/nmr-core';
3
+ import { defineCommand, runCli } from '@williamthorsen/nmr-core/cli';
4
+ import { NMR_REPORT_OVERRIDES_BIN } from "../bins.js";
2
5
  import { NMR_GLYPHS } from "../glyphs.js";
3
6
  import { getPnpmOverrides, readPackageJson } from "../helpers/package-json.js";
4
7
  import { reportClosing } from "../helpers/reportClosing.js";
5
- import { readWorkspaceOverrides } from "../workspace.js";
8
+ import { resolveBinStyles } from "../resolveBinStyles.js";
9
+ import { findMonorepoRoot, readWorkspaceOverrides } from "../workspace.js";
6
10
  export function reportOverrides(monorepoRoot, style) {
7
11
  const declaredOverrides = listEntries(readWorkspaceOverrides(monorepoRoot));
8
12
  if (declaredOverrides.length > 0) {
@@ -14,6 +18,21 @@ export function reportOverrides(monorepoRoot, style) {
14
18
  }
15
19
  rejectLegacyOverrides(monorepoRoot);
16
20
  }
21
+ export async function runReportOverrides(argv, cwd) {
22
+ const command = defineCommand({
23
+ summary: 'Report the pnpm overrides that the monorepo declares',
24
+ run: () => {
25
+ reportOverrides(findMonorepoRoot(cwd), resolveBinStyles().stderr);
26
+ return 0;
27
+ },
28
+ });
29
+ return runCli(argv, command, {
30
+ name: NMR_REPORT_OVERRIDES_BIN,
31
+ stdout: process.stdout,
32
+ stderr: process.stderr,
33
+ baseDir: cwd,
34
+ });
35
+ }
17
36
  function describeOverrides(count) {
18
37
  return count === 1
19
38
  ? '1 override is active. Check whether it is still needed.'
package/docs/upgrades.md CHANGED
@@ -130,7 +130,7 @@ These commands are available as `nmr` subcommands and as standalone `nmr-`-prefi
130
130
 
131
131
  ### `report-catalog`
132
132
 
133
- Report the dependencies that the current package takes from a [pnpm catalog](https://pnpm.io/catalogs), which a package-scoped `upgrade` cannot read (see [dependency upgrades](#dependency-upgrades) for why). Each line names the dependency, its `catalog:` specifier, and the monorepo root from which a covering pass runs. The workspace `upgrade` script runs it automatically, so a repo does not need to wire it up. The subcommand belongs to the workspace registry and runs from a package directory. The `nmr-report-catalog` bin reports nothing when run from the monorepo root, because a root-scoped pass reads the catalog itself.
133
+ Report the dependencies that the current package takes from a [pnpm catalog](https://pnpm.io/catalogs), which a package-scoped `upgrade` cannot read (see [dependency upgrades](#dependency-upgrades) for why). Each line names the dependency, its `catalog:` specifier, and the monorepo root from which a covering pass runs. The workspace `upgrade` script runs it automatically, so a repo does not need to wire it up. The subcommand belongs to the workspace registry and runs from a package directory. The `nmr-report-catalog` bin reports nothing when run from the monorepo root, because a root-scoped pass reads the catalog itself. It takes no arguments: `--help` prints its usage, and any other argument is a usage error, which exits 2 without reporting.
134
134
 
135
135
  ```bash
136
136
  nmr report-catalog
package/docs/utilities.md CHANGED
@@ -12,7 +12,7 @@ nmr-actionlint
12
12
 
13
13
  ## `nmr-clean`
14
14
 
15
- Remove a package's build output (`dist`) and its `nmr-compile` cache entries, the key and the recorded emit duration, so that the next build cannot skip on leftover state. Run from a package directory, it cleans that package; run from the monorepo root, it sweeps every workspace package in a single pass, running each package's resolved `clean`, so a package that overrides `clean`, in `.config/nmr.config.ts` or in its own `package.json`, gets its own command rather than the sweep. Removal is idempotent: Cleaning an unbuilt package is a silent no-op. This is the default `clean` script at both levels.
15
+ Remove a package's build output (`dist`) and its `nmr-compile` cache entries, the key and the recorded emit duration, so that the next build cannot skip on leftover state. Run from a package directory, it cleans that package; run from the monorepo root, it sweeps every workspace package in a single pass, running each package's resolved `clean`, so a package that overrides `clean`, in `.config/nmr.config.ts` or in its own `package.json`, gets its own command rather than the sweep. Removal is idempotent: Cleaning an unbuilt package is a silent no-op. This is the default `clean` script at both levels. It takes no arguments: `--help` prints its usage, and any other argument is a usage error, which exits 2 without removing anything.
16
16
 
17
17
  ```bash
18
18
  nmr-clean
@@ -20,7 +20,7 @@ nmr-clean
20
20
 
21
21
  ## `nmr-compile`
22
22
 
23
- Compile a single package's `src` tree to `dist/esm` with the TypeScript compiler API, emitting `.js` from one program and `.d.ts` from a second that reuses it. The package's own `removeComments` governs the `.js` emit; the declarations emit forces it off, so `.d.ts` files keep their doc comments either way. Because the compiler parses each source file, every relative import form (static, re-export, dynamic `import()`, and bare side-effect) is rewritten from `.ts` or `.tsx` to `.js` in both outputs, and `.ts` occurrences inside strings and comments are left intact. tsconfig `paths` aliases are resolved to runnable relative `.js` specifiers in both outputs, sourced from the package's tsconfig. An aliased import whose target resolves outside the package's `src/` and is not resolvable without the alias mapping fails the build with a diagnostic, rather than being emitted verbatim to produce output that fails at runtime. The build is skipped when every input is unchanged and the previous output is still on disk (the key is cached under `node_modules/.cache/nmr-compile/`, outside the published output). Deleting the output by any means (`nmr clean`, `rm -rf dist`, `git clean`) therefore forces a rebuild rather than a skip. This is the default `compile` script; run it from a package directory.
23
+ Compile a single package's `src` tree to `dist/esm` with the TypeScript compiler API, emitting `.js` from one program and `.d.ts` from a second that reuses it. The package's own `removeComments` governs the `.js` emit; the declarations emit forces it off, so `.d.ts` files keep their doc comments either way. Because the compiler parses each source file, every relative import form (static, re-export, dynamic `import()`, and bare side-effect) is rewritten from `.ts` or `.tsx` to `.js` in both outputs, and `.ts` occurrences inside strings and comments are left intact. tsconfig `paths` aliases are resolved to runnable relative `.js` specifiers in both outputs, sourced from the package's tsconfig. An aliased import whose target resolves outside the package's `src/` and is not resolvable without the alias mapping fails the build with a diagnostic, rather than being emitted verbatim to produce output that fails at runtime. The build is skipped when every input is unchanged and the previous output is still on disk (the key is cached under `node_modules/.cache/nmr-compile/`, outside the published output). Deleting the output by any means (`nmr clean`, `rm -rf dist`, `git clean`) therefore forces a rebuild rather than a skip. This is the default `compile` script; run it from a package directory. It takes no arguments: `--help` prints its usage, and any other argument is a usage error, which exits 2 without compiling.
24
24
 
25
25
  **What it compiles.** Entry points are `src/**/*.{ts,tsx}` less the directories that contain test scaffolding rather than published code: `__fixtures__/`, `__mocks__/`, `__tests__/`, and `test-utils/`. Add to that list per package with [`build.extraIgnorePatterns`](scripts.md#package-level-configuration). Ignoring a directory drops it as an _entry point_, not from the emit: The compiler still emits whatever the surviving entry points import, so a helper that production code uses is still compiled and the compiler never emits a dangling specifier in its importer. This list is deliberately not the Vitest [coverage exclusions](vitest.md#what-the-config-excludes): Helpers live in `test-utils/` precisely so that they stay covered.
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@williamthorsen/nmr",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "description": "Context-aware script runner for pnpm monorepos",
6
6
  "keywords": [
@@ -81,8 +81,8 @@
81
81
  ],
82
82
  "dependencies": {
83
83
  "@williamthorsen/nmr-core": "0.16.1",
84
- "@williamthorsen/toolbelt.errors": "0.9.0",
85
- "@williamthorsen/toolbelt.filesystem": "0.10.0",
84
+ "@williamthorsen/toolbelt.errors": "0.9.1",
85
+ "@williamthorsen/toolbelt.filesystem": "0.10.1",
86
86
  "glob": "14.0.4",
87
87
  "prettier": "3.9.10",
88
88
  "prettier-plugin-sh": "0.20.2",
@@ -90,13 +90,13 @@
90
90
  "unconfig": "7.5.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@williamthorsen/toolbelt.testing": "0.8.0",
94
- "@williamthorsen/toolbelt.vitest": "0.13.2",
93
+ "@williamthorsen/toolbelt.testing": "0.8.1",
94
+ "@williamthorsen/toolbelt.vitest": "0.13.3",
95
95
  "esbuild": "0.28.2",
96
- "readyup": "0.45.0",
96
+ "readyup": "0.45.1",
97
97
  "tinyglobby": "0.2.17",
98
98
  "typescript": "6.0.3",
99
- "vite": "8.3.6",
99
+ "vite": "8.3.7",
100
100
  "vitest": "5.1.0",
101
101
  "yaml": "2.9.1"
102
102
  },