@williamthorsen/nmr 0.18.2 → 0.20.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.
Files changed (41) hide show
  1. package/AGENTS.md +5 -84
  2. package/README.md +187 -46
  3. package/bin/nmr-taze.js +11 -0
  4. package/dist/esm/cli-ensure-prepublish-hooks.js +1 -1
  5. package/dist/esm/cli-report-overrides.js +1 -1
  6. package/dist/esm/cli-sync-agent-files.js +1 -1
  7. package/dist/esm/cli-taze.js +10 -0
  8. package/dist/esm/commands/build.d.ts +1 -1
  9. package/dist/esm/commands/build.js +8 -6
  10. package/dist/esm/commands/clean.js +2 -1
  11. package/dist/esm/commands/ensure-prepublish-hooks.js +1 -1
  12. package/dist/esm/commands/taze.d.ts +12 -0
  13. package/dist/esm/commands/taze.js +32 -0
  14. package/dist/esm/context.d.ts +0 -2
  15. package/dist/esm/context.js +8 -61
  16. package/dist/esm/default-scripts.js +3 -5
  17. package/dist/esm/help.js +9 -6
  18. package/dist/esm/helpers/workspace-patterns.d.ts +1 -0
  19. package/dist/esm/helpers/workspace-patterns.js +29 -0
  20. package/dist/esm/index.d.ts +0 -1
  21. package/dist/esm/runCli.js +16 -16
  22. package/dist/esm/taze.d.ts +5 -0
  23. package/dist/esm/taze.js +6 -0
  24. package/dist/esm/workspace.d.ts +2 -0
  25. package/dist/esm/workspace.js +38 -0
  26. package/package.json +16 -12
  27. package/bin/nmr-sync-pnpm-version.js +0 -11
  28. package/dist/esm/cli-sync-pnpm-version.js +0 -11
  29. package/dist/esm/commands/sync-pnpm-version.d.ts +0 -3
  30. package/dist/esm/commands/sync-pnpm-version.js +0 -40
  31. package/dist/esm/helpers/code-quality-pnpm-action.d.ts +0 -13
  32. package/dist/esm/helpers/code-quality-pnpm-action.js +0 -22
  33. package/dist/esm/tests/consistency.d.ts +0 -7
  34. package/dist/esm/tests/consistency.js +0 -57
  35. package/dist/esm/tests/helpers/get-runtime-version-from-asdf.d.ts +0 -1
  36. package/dist/esm/tests/helpers/get-runtime-version-from-asdf.js +0 -12
  37. package/dist/esm/tests/helpers/get-string-from-yaml-file.d.ts +0 -1
  38. package/dist/esm/tests/helpers/get-string-from-yaml-file.js +0 -12
  39. package/dist/esm/tests/helpers/get-value-at-path.d.ts +0 -1
  40. package/dist/esm/tests/helpers/get-value-at-path.js +0 -34
  41. /package/dist/esm/{cli-sync-pnpm-version.d.ts → cli-taze.d.ts} +0 -0
@@ -1,12 +0,0 @@
1
- import assert from 'node:assert';
2
- import fs from 'node:fs';
3
- import { parse } from 'yaml';
4
- import { getValueAtPathOrThrow } from "./get-value-at-path.js";
5
- export async function getStringFromYamlFile(filePath, keyPath, label) {
6
- const raw = await fs.promises.readFile(filePath, { encoding: 'utf8' });
7
- const parsed = parse(raw);
8
- assert.ok(parsed, `YAML content not found in ${filePath}`);
9
- const value = getValueAtPathOrThrow(parsed, keyPath);
10
- assert.ok(typeof value === 'string' && value.length > 0, `${label} not found at ${keyPath}`);
11
- return value;
12
- }
@@ -1 +0,0 @@
1
- export declare function getValueAtPathOrThrow(obj: unknown, objPath: string): unknown;
@@ -1,34 +0,0 @@
1
- function isObject(value) {
2
- return typeof value === 'object' && value !== null && !Array.isArray(value);
3
- }
4
- export function getValueAtPathOrThrow(obj, objPath) {
5
- if (!isObject(obj)) {
6
- throw new Error('Expected an object as root value.');
7
- }
8
- const keys = objPath.split('.');
9
- let current = obj;
10
- for (const key of keys) {
11
- if (Array.isArray(current)) {
12
- const index = Number(key);
13
- if (Number.isNaN(index)) {
14
- throw new TypeError(`Expected array index at segment "${key}" in path "${objPath}"`);
15
- }
16
- if (index >= 0 && index < current.length) {
17
- current = current[index];
18
- }
19
- else {
20
- throw new Error(`Array index out of bounds: "${key}" in path "${objPath}"`);
21
- }
22
- }
23
- else if (isObject(current)) {
24
- if (!(key in current)) {
25
- throw new Error(`Missing key "${key}" in path "${objPath}"`);
26
- }
27
- current = current[key];
28
- }
29
- else {
30
- throw new Error(`Unexpected non-object/non-array at segment "${key}" in path "${objPath}"`);
31
- }
32
- }
33
- return current;
34
- }