@williamthorsen/nmr-core 0.10.0 → 0.10.2
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 +1 -9
- package/dist/esm/hasErrnoCode.d.ts +3 -0
- package/dist/esm/hasErrnoCode.js +4 -0
- package/dist/esm/hashWorkingTree.js +2 -4
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -4,15 +4,7 @@ Shared utilities for node-monorepo-tools packages.
|
|
|
4
4
|
|
|
5
5
|
This package serves as the shared library foundation for the monorepo. For the nmr CLI tool, see [`@williamthorsen/nmr`](../nmr).
|
|
6
6
|
|
|
7
|
-
<!-- section:release-notes -->
|
|
8
|
-
## Release notes — v0.10.0 (2026-08-13)
|
|
9
|
-
|
|
10
|
-
### 🎉 Features
|
|
11
|
-
|
|
12
|
-
- Print a retained run with nmr --log (#669)
|
|
13
|
-
|
|
14
|
-
Adds `nmr --log <command>`, which prints what the last recorded pass wrote instead of running the command again. The whole transcript, up to a limit of 256 KiB, is now saved for any passing command that is not writing straight to a terminal; `--log` prints it under a header giving the instant, the duration, and the command chain that succeeded. The log of a composite is the sum of its constituents' excerpts. If a change disqualifies the recording, `--log` instead reports the change.
|
|
15
|
-
<!-- /section:release-notes -->
|
|
7
|
+
<!-- section:release-notes --><!-- /section:release-notes -->
|
|
16
8
|
|
|
17
9
|
## Installation
|
|
18
10
|
|
|
@@ -4,6 +4,7 @@ import { existsSync, lstatSync, readFileSync, readlinkSync } from 'node:fs';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { describeError } from '@williamthorsen/toolbelt.errors';
|
|
6
6
|
import { GIT_OUTPUT_LIMIT } from "./gitOutputLimit.js";
|
|
7
|
+
import { hasErrnoCode } from "./hasErrnoCode.js";
|
|
7
8
|
const HASH_FORMAT = 'nmr-working-tree-v1';
|
|
8
9
|
const PRECEDING_FIELD_COUNTS = {
|
|
9
10
|
1: 8,
|
|
@@ -112,7 +113,7 @@ function digestPathContent(toplevel, relativePath) {
|
|
|
112
113
|
stats = lstatSync(absolutePath);
|
|
113
114
|
}
|
|
114
115
|
catch (error) {
|
|
115
|
-
if (
|
|
116
|
+
if (hasErrnoCode(error, 'ENOENT')) {
|
|
116
117
|
return { ok: true, kind: 'absent', digest: '' };
|
|
117
118
|
}
|
|
118
119
|
return { ok: false, reason: `could not stat ${relativePath}: ${describeError(error)}` };
|
|
@@ -145,9 +146,6 @@ function extractPath(record, precedingFieldCount) {
|
|
|
145
146
|
const extracted = record.slice(index);
|
|
146
147
|
return extracted === '' ? undefined : extracted;
|
|
147
148
|
}
|
|
148
|
-
function isErrorWithCode(error, code) {
|
|
149
|
-
return error instanceof Error && 'code' in error && error.code === code;
|
|
150
|
-
}
|
|
151
149
|
function runGit(args, cwd) {
|
|
152
150
|
const result = spawnSync('git', args, { cwd, encoding: 'utf8', maxBuffer: GIT_OUTPUT_LIMIT });
|
|
153
151
|
if (result.error) {
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { CacheDirRef, CacheEntryRef } from './cache-store.js';
|
|
|
3
3
|
export { readCacheEntry, readJsonCacheEntry, removeCacheDir, removeCacheEntry, resolveCacheDir, resolveCacheEntryPath, writeCacheEntry, } from './cache-store.js';
|
|
4
4
|
export { findPackageRoot } from './findPackageRoot.js';
|
|
5
5
|
export { GIT_OUTPUT_LIMIT } from './gitOutputLimit.js';
|
|
6
|
+
export { hasErrnoCode } from './hasErrnoCode.js';
|
|
6
7
|
export type { WorkingTreeHashResult } from './hashWorkingTree.js';
|
|
7
8
|
export { hashWorkingTree, readHeadSha } from './hashWorkingTree.js';
|
|
8
9
|
export type { FlagDefinition, FlagSchema, ParseArgsOptions, ParsedArgs, ParsedFlags, ParseErrorKind, } from './parseArgs.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export const PACKAGE_NAME = '@williamthorsen/nmr-core';
|
|
|
2
2
|
export { readCacheEntry, readJsonCacheEntry, removeCacheDir, removeCacheEntry, resolveCacheDir, resolveCacheEntryPath, writeCacheEntry, } from "./cache-store.js";
|
|
3
3
|
export { findPackageRoot } from "./findPackageRoot.js";
|
|
4
4
|
export { GIT_OUTPUT_LIMIT } from "./gitOutputLimit.js";
|
|
5
|
+
export { hasErrnoCode } from "./hasErrnoCode.js";
|
|
5
6
|
export { hashWorkingTree, readHeadSha } from "./hashWorkingTree.js";
|
|
6
7
|
export { parseArgs, parseArgsOrExit, ParseError } from "./parseArgs.js";
|
|
7
8
|
export { readPackageVersion } from "./readPackageVersion.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@williamthorsen/nmr-core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared utilities for node-monorepo-tools packages",
|
|
6
6
|
"keywords": [
|
|
@@ -32,7 +32,12 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@williamthorsen/toolbelt.errors": "0.
|
|
35
|
+
"@williamthorsen/toolbelt.errors": "0.5.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@williamthorsen/toolbelt.filesystem": "0.6.0",
|
|
39
|
+
"@williamthorsen/toolbelt.testing": "0.3.0",
|
|
40
|
+
"@williamthorsen/toolbelt.vitest": "0.4.0"
|
|
36
41
|
},
|
|
37
42
|
"engines": {
|
|
38
43
|
"node": ">=24"
|