@zukhruf/git-hooks 0.8.20 → 0.8.22

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 (115) hide show
  1. package/README.md +275 -37
  2. package/dist/build.d.ts +1 -1
  3. package/dist/build.d.ts.map +1 -1
  4. package/dist/build.js +44 -46
  5. package/dist/build.js.map +1 -1
  6. package/dist/codegen.d.ts.map +1 -1
  7. package/dist/codegen.js +41 -8
  8. package/dist/codegen.js.map +1 -1
  9. package/dist/commit.d.ts +29 -10
  10. package/dist/commit.d.ts.map +1 -1
  11. package/dist/commit.js +244 -85
  12. package/dist/commit.js.map +1 -1
  13. package/dist/dependency-checks.d.ts.map +1 -1
  14. package/dist/dependency-checks.js +49 -44
  15. package/dist/dependency-checks.js.map +1 -1
  16. package/dist/dockerfile-installs.d.ts +7 -0
  17. package/dist/dockerfile-installs.d.ts.map +1 -0
  18. package/dist/dockerfile-installs.js +132 -0
  19. package/dist/dockerfile-installs.js.map +1 -0
  20. package/dist/format.d.ts.map +1 -1
  21. package/dist/format.js +33 -24
  22. package/dist/format.js.map +1 -1
  23. package/dist/git.d.ts +3 -0
  24. package/dist/git.d.ts.map +1 -0
  25. package/dist/git.js +20 -0
  26. package/dist/git.js.map +1 -0
  27. package/dist/index.d.ts +8 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +3 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/lockfile-sync.d.ts +8 -0
  32. package/dist/lockfile-sync.d.ts.map +1 -0
  33. package/dist/lockfile-sync.js +82 -0
  34. package/dist/lockfile-sync.js.map +1 -0
  35. package/dist/no-numeric-pins.d.ts.map +1 -1
  36. package/dist/no-numeric-pins.js +12 -3
  37. package/dist/no-numeric-pins.js.map +1 -1
  38. package/dist/npm/lockfile.d.ts +18 -0
  39. package/dist/npm/lockfile.d.ts.map +1 -0
  40. package/dist/npm/lockfile.js +108 -0
  41. package/dist/npm/lockfile.js.map +1 -0
  42. package/dist/npmrc-policy.d.ts +7 -0
  43. package/dist/npmrc-policy.d.ts.map +1 -0
  44. package/dist/npmrc-policy.js +93 -0
  45. package/dist/npmrc-policy.js.map +1 -0
  46. package/dist/push.d.ts +14 -9
  47. package/dist/push.d.ts.map +1 -1
  48. package/dist/push.js +20 -93
  49. package/dist/push.js.map +1 -1
  50. package/dist/ref-update.d.ts +1 -1
  51. package/dist/ref-update.d.ts.map +1 -1
  52. package/dist/run/commit-msg.d.ts +9 -0
  53. package/dist/run/commit-msg.d.ts.map +1 -0
  54. package/dist/run/commit-msg.js +8 -0
  55. package/dist/run/commit-msg.js.map +1 -0
  56. package/dist/run/pre-commit.d.ts +14 -0
  57. package/dist/run/pre-commit.d.ts.map +1 -0
  58. package/dist/run/pre-commit.js +41 -0
  59. package/dist/run/pre-commit.js.map +1 -0
  60. package/dist/run/pre-push.d.ts +14 -0
  61. package/dist/run/pre-push.d.ts.map +1 -0
  62. package/dist/run/pre-push.js +27 -0
  63. package/dist/run/pre-push.js.map +1 -0
  64. package/dist/run/step-runner.d.ts +17 -0
  65. package/dist/run/step-runner.d.ts.map +1 -0
  66. package/dist/run/step-runner.js +27 -0
  67. package/dist/run/step-runner.js.map +1 -0
  68. package/dist/scripts/commit-msg.d.ts +1 -1
  69. package/dist/scripts/commit-msg.d.ts.map +1 -1
  70. package/dist/scripts/commit-msg.js +14 -19
  71. package/dist/scripts/commit-msg.js.map +1 -1
  72. package/dist/scripts/host.d.ts +10 -0
  73. package/dist/scripts/host.d.ts.map +1 -0
  74. package/dist/scripts/host.js +37 -0
  75. package/dist/scripts/host.js.map +1 -0
  76. package/dist/scripts/pre-commit.d.ts +1 -1
  77. package/dist/scripts/pre-commit.d.ts.map +1 -1
  78. package/dist/scripts/pre-commit.js +14 -17
  79. package/dist/scripts/pre-commit.js.map +1 -1
  80. package/dist/scripts/pre-push.d.ts +1 -1
  81. package/dist/scripts/pre-push.d.ts.map +1 -1
  82. package/dist/scripts/pre-push.js +16 -32
  83. package/dist/scripts/pre-push.js.map +1 -1
  84. package/dist/snapshot/drift.d.ts +0 -2
  85. package/dist/snapshot/drift.d.ts.map +1 -1
  86. package/dist/snapshot/drift.js +5 -57
  87. package/dist/snapshot/drift.js.map +1 -1
  88. package/dist/snapshot/installs.d.ts +1 -0
  89. package/dist/snapshot/installs.d.ts.map +1 -1
  90. package/dist/snapshot/installs.js +85 -29
  91. package/dist/snapshot/installs.js.map +1 -1
  92. package/dist/snapshot/snapshot.d.ts +21 -0
  93. package/dist/snapshot/snapshot.d.ts.map +1 -0
  94. package/dist/snapshot/snapshot.js +54 -0
  95. package/dist/snapshot/snapshot.js.map +1 -0
  96. package/dist/snapshot/snapshots.d.ts +30 -0
  97. package/dist/snapshot/snapshots.d.ts.map +1 -0
  98. package/dist/snapshot/snapshots.js +180 -0
  99. package/dist/snapshot/snapshots.js.map +1 -0
  100. package/dist/sync.d.ts.map +1 -1
  101. package/dist/sync.js +16 -16
  102. package/dist/sync.js.map +1 -1
  103. package/dist/testing.d.ts +23 -0
  104. package/dist/testing.d.ts.map +1 -0
  105. package/dist/testing.js +41 -0
  106. package/dist/testing.js.map +1 -0
  107. package/dist/tree.d.ts +24 -0
  108. package/dist/tree.d.ts.map +1 -0
  109. package/dist/tree.js +96 -0
  110. package/dist/tree.js.map +1 -0
  111. package/package.json +10 -4
  112. package/dist/snapshot/nx.d.ts +0 -7
  113. package/dist/snapshot/nx.d.ts.map +0 -1
  114. package/dist/snapshot/nx.js +0 -20
  115. package/dist/snapshot/nx.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ import { withoutRepoVariables } from "./repo-variables.js";
2
+ import { runCommitMsg } from "./run/commit-msg.js";
3
+ import { runPreCommit } from "./run/pre-commit.js";
4
+ import { runPrePush } from "./run/pre-push.js";
5
+ // Each function runs steps as its hook runs them, on the repo at `root`, and
6
+ // gives the outcome of each step that ran, so a repo tests its own steps
7
+ // through the real loop. `environment` stands for the hook environment.
8
+ // Runs pre-commit steps on the staged commit. When the hook would stop the
9
+ // commit after the steps, such as when the index changed while they ran, the
10
+ // last outcome is that fail.
11
+ export async function preCommit({ root, environment }, steps) {
12
+ const result = await runPreCommit({
13
+ root,
14
+ hookEnvironment: environment,
15
+ toolEnvironment: await withoutRepoVariables(environment),
16
+ print: () => { },
17
+ }, steps);
18
+ return result.kind === 'stopped'
19
+ ? [...result.outcomes, { kind: 'fail', message: result.reason }]
20
+ : result.outcomes;
21
+ }
22
+ // Runs pre-push steps on a push to `remote`. `input` holds the lines that git
23
+ // gives the hook on its standard input: `<local ref> <local sha> <remote ref>
24
+ // <remote sha>` for each ref update.
25
+ export async function prePush({ root, environment, remote, input, }, steps) {
26
+ const { outcomes } = await runPrePush({
27
+ root,
28
+ hookEnvironment: environment,
29
+ toolEnvironment: await withoutRepoVariables(environment),
30
+ print: () => { },
31
+ remote,
32
+ input,
33
+ }, steps);
34
+ return outcomes;
35
+ }
36
+ // Runs commit-msg steps on the message in `file`.
37
+ export async function commitMsg({ root, environment, file, }, steps) {
38
+ const { outcomes } = await runCommitMsg({ root, hookEnvironment: environment, print: () => { }, file }, steps);
39
+ return outcomes;
40
+ }
41
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,6EAA6E;AAC7E,yEAAyE;AACzE,wEAAwE;AAExE,2EAA2E;AAC3E,6EAA6E;AAC7E,6BAA6B;AAC7B,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,EAAE,IAAI,EAAE,WAAW,EAAoD,EACvE,KAA8B;IAE9B,MAAM,MAAM,GAAG,MAAM,YAAY,CAC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kind: 'file' | 'link' | 'submodule';
5
+ }
6
+ export type DiffEntry = {
7
+ readonly change: 'added' | 'modified' | 'type-changed';
8
+ readonly path: string;
9
+ readonly kind: TreeEntry['kind'];
10
+ } | {
11
+ readonly change: 'deleted';
12
+ readonly path: string;
13
+ };
14
+ export declare class Tree {
15
+ #private;
16
+ readonly id: string;
17
+ private constructor();
18
+ static list(id: string, git: Git): Promise<Tree>;
19
+ entries(globs?: readonly string[]): readonly TreeEntry[];
20
+ read(path: string): Promise<string | undefined>;
21
+ }
22
+ export declare function matches(path: string, globs: readonly string[]): boolean;
23
+ export declare function changesBetween(git: Git, from: string | undefined, to: string): Promise<DiffEntry[]>;
24
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../src/tree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAIpC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;CAC9C;AAKD,MAAM,MAAM,SAAS,GACjB;IACE,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CAClC,GACD;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAU1D,qBAAa,IAAI;;IACf,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAIpB,OAAO;WAWM,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAetD,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,SAAS,EAAE;IAalD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAKtD;AAID,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAEvE;AAKD,wBAAsB,cAAc,CAClC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,SAAS,EAAE,CAAC,CAmBtB"}
package/dist/tree.js ADDED
@@ -0,0 +1,96 @@
1
+ import { posix } from 'node:path';
2
+ // Git's tree object: the paths of a commit, with the mode and the content of
3
+ // each. A tree does not change, so it lists its entries one time, when it is
4
+ // made, and a step that reads it judges one state of the commit, also when
5
+ // the index changes while the hook runs.
6
+ export class Tree {
7
+ id;
8
+ #git;
9
+ #entries;
10
+ constructor(id, git, entries) {
11
+ this.id = id;
12
+ this.#git = git;
13
+ this.#entries = entries;
14
+ }
15
+ // The tree `id` of the repo that `git` reads.
16
+ static async list(id, git) {
17
+ const output = await git('ls-tree', '-r', '-z', '--full-tree', id);
18
+ const entries = new Map();
19
+ for (const record of output.split('\0')) {
20
+ if (record === '')
21
+ continue;
22
+ // `<mode> SP <type> SP <object> TAB <path>`
23
+ const tab = record.indexOf('\t');
24
+ const [mode = '', , object = ''] = record.slice(0, tab).split(' ');
25
+ const path = record.slice(tab + 1);
26
+ entries.set(path, { path, kind: kindOf(mode), object });
27
+ }
28
+ return new Tree(id, git, entries);
29
+ }
30
+ // The entries whose path matches one of the globs, or each entry.
31
+ entries(globs) {
32
+ const entries = [...this.#entries.values()].map(({ path, kind }) => ({
33
+ path,
34
+ kind,
35
+ }));
36
+ return globs === undefined
37
+ ? entries
38
+ : entries.filter(({ path }) => matches(path, globs));
39
+ }
40
+ // The content of the file or the link at `path`, as UTF-8 text: the text of
41
+ // a link is the path that it points to. A submodule has no content in this
42
+ // repo.
43
+ async read(path) {
44
+ const entry = this.#entries.get(path);
45
+ if (entry === undefined || entry.kind === 'submodule')
46
+ return undefined;
47
+ return this.#git('cat-file', 'blob', entry.object);
48
+ }
49
+ }
50
+ // Whether `path` matches one of the globs. A path of a tree always uses `/`,
51
+ // so the globs match as on POSIX, also on Windows.
52
+ export function matches(path, globs) {
53
+ return globs.some((glob) => posix.matchesGlob(path, glob));
54
+ }
55
+ // The diff entries from the tree `from` to the tree `to`. With no `from`, the
56
+ // diff starts from the empty tree, so each entry of `to` is added. A rename is
57
+ // a deleted entry and an added entry.
58
+ export async function changesBetween(git, from, to) {
59
+ const base = from ?? (await git('hash-object', '-t', 'tree', '--stdin')).trim();
60
+ const output = await git('diff-tree', '-r', '-z', '--no-renames', base, to);
61
+ // `:<old mode> SP <new mode> SP <old object> SP <new object> SP <letter>`,
62
+ // then the path, each ended by NUL.
63
+ const fields = output.split('\0');
64
+ const changes = [];
65
+ for (let index = 0; index + 1 < fields.length; index += 2) {
66
+ const [, mode = '', , , letter = ''] = (fields[index] ?? '').split(' ');
67
+ const path = fields[index + 1] ?? '';
68
+ const change = changeOf(letter);
69
+ changes.push(change === 'deleted'
70
+ ? { change, path }
71
+ : { change, path, kind: kindOf(mode) });
72
+ }
73
+ return changes;
74
+ }
75
+ function kindOf(mode) {
76
+ if (mode === '120000')
77
+ return 'link';
78
+ if (mode === '160000')
79
+ return 'submodule';
80
+ return 'file';
81
+ }
82
+ function changeOf(letter) {
83
+ switch (letter) {
84
+ case 'A':
85
+ return 'added';
86
+ case 'M':
87
+ return 'modified';
88
+ case 'T':
89
+ return 'type-changed';
90
+ case 'D':
91
+ return 'deleted';
92
+ default:
93
+ throw new TypeError(`git diff-tree gave the change "${letter}", which a diff of two trees without renames never has`);
94
+ }
95
+ }
96
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.js","sourceRoot":"","sources":["../src/tree.ts"],"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Q,CAAC,MAAc;IAC9B,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,OAAO,CAAC;QACjB,KAAK,GAAG;YACN,OAAO,UAAU,CAAC;QACpB,KAAK,GAAG;YACN,OAAO,cAAc,CAAC;QACxB,KAAK,GAAG;YACN,OAAO,SAAS,CAAC;QACnB;YACE,MAAM,IAAI,SAAS,CACjB,kCAAkC,MAAM,wDAAwD,CACjG,CAAC;IACN,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zukhruf/git-hooks",
3
- "version": "0.8.20",
3
+ "version": "0.8.22",
4
4
  "description": "Git hooks in TypeScript, a class per step. Pre-commit checks staged files with Prettier, stages only what nx sync wrote, and builds generated files. Commit-msg stops a subject whose scope nx release misreads. Pre-push builds pushed commits in snapshots.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,6 +35,12 @@
35
35
  "types": "./dist/index.d.ts",
36
36
  "import": "./dist/index.js",
37
37
  "default": "./dist/index.js"
38
+ },
39
+ "./testing": {
40
+ "@zukhruf/source": "./src/testing.ts",
41
+ "types": "./dist/testing.d.ts",
42
+ "import": "./dist/testing.js",
43
+ "default": "./dist/testing.js"
38
44
  }
39
45
  },
40
46
  "files": [
@@ -47,8 +53,8 @@
47
53
  "access": "public"
48
54
  },
49
55
  "dependencies": {
50
- "@zukhruf/async": "^0.8.20",
51
- "@zukhruf/fs": "^0.8.20"
56
+ "@zukhruf/async": "^0.8.22",
57
+ "@zukhruf/fs": "^0.8.22"
52
58
  },
53
59
  "peerDependencies": {
54
60
  "eslint": "^9.30.0 || ^10.0.0",
@@ -64,7 +70,7 @@
64
70
  }
65
71
  },
66
72
  "devDependencies": {
67
- "@zukhruf/testing": "^0.8.20",
73
+ "@zukhruf/testing": "^0.8.22",
68
74
  "eslint": "^10.12.0",
69
75
  "jsonc-eslint-parser": "^3.3.0",
70
76
  "prettier": "^3.9.9"
@@ -1,7 +0,0 @@
1
- export interface NxRun {
2
- readonly code: number;
3
- readonly stdout: string;
4
- readonly stderr: string;
5
- }
6
- export declare function runNx(folder: string, environment: NodeJS.ProcessEnv, args: readonly string[]): Promise<NxRun>;
7
- //# sourceMappingURL=nx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nx.d.ts","sourceRoot":"","sources":["../../src/snapshot/nx.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAID,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,CAAC,UAAU,EAC9B,IAAI,EAAE,SAAS,MAAM,EAAE,GACtB,OAAO,CAAC,KAAK,CAAC,CAoBhB"}
@@ -1,20 +0,0 @@
1
- import { execFile } from 'node:child_process';
2
- import { join } from 'node:path';
3
- // Runs the nx of the snapshot's node_modules in the snapshot. On Windows,
4
- // npm writes `.bin/nx.cmd`, which only a shell runs.
5
- export function runNx(folder, environment, args) {
6
- const windows = process.platform === 'win32';
7
- return new Promise((resolve) => {
8
- execFile(join(folder, 'node_modules/.bin', windows ? 'nx.cmd' : 'nx'), args, {
9
- cwd: folder,
10
- env: environment,
11
- encoding: 'utf8',
12
- maxBuffer: 2 ** 30,
13
- shell: windows,
14
- }, (error, stdout, stderr) => {
15
- const code = error === null ? 0 : typeof error.code === 'number' ? error.code : 1;
16
- resolve({ code, stdout, stderr });
17
- });
18
- });
19
- }
20
- //# sourceMappingURL=nx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nx.js","sourceRoot":"","sources":["../../src/snapshot/nx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,0EAA0E;AAC1E,qDAAqD;AACrD,MAAM,UAAU,KAAK,CACnB,MAAc,EACd,WAA8B,EAC9B,IAAuB;IAEvB,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;IAC7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CACN,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EAC5D,IAAI,EACJ;YACE,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,WAAW;YAChB,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,CAAC,IAAI,EAAE;YAClB,KAAK,EAAE,OAAO;SACf,EACD,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxB,MAAM,IAAI,GACR,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACvE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACpC,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}