@storm-software/git-tools 2.124.86 → 2.125.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.
Files changed (118) hide show
  1. package/README.md +1 -1
  2. package/bin/chunk-3IBASKZ6.cjs +16 -0
  3. package/bin/chunk-3IBASKZ6.cjs.map +1 -0
  4. package/bin/chunk-6FITE6HP.js +52 -0
  5. package/bin/chunk-6FITE6HP.js.map +1 -0
  6. package/bin/chunk-C7APS633.cjs +19 -0
  7. package/bin/chunk-C7APS633.cjs.map +1 -0
  8. package/bin/{chunk-ZBLIE7F7.cjs → chunk-DFXXNV3C.cjs} +2 -3
  9. package/bin/chunk-DFXXNV3C.cjs.map +1 -0
  10. package/bin/chunk-EI723ABQ.cjs +59 -0
  11. package/bin/chunk-EI723ABQ.cjs.map +1 -0
  12. package/bin/{chunk-Q3DQKTOI.js → chunk-HBLWPOJV.js} +5 -5
  13. package/bin/chunk-HBLWPOJV.js.map +1 -0
  14. package/bin/chunk-IA2Z3BAB.cjs +18 -0
  15. package/bin/chunk-IA2Z3BAB.cjs.map +1 -0
  16. package/bin/chunk-JE32WMBP.js +17 -0
  17. package/bin/chunk-JE32WMBP.js.map +1 -0
  18. package/bin/chunk-LHPUN2YZ.js +22 -0
  19. package/bin/chunk-LHPUN2YZ.js.map +1 -0
  20. package/bin/chunk-N7J3ORRT.js +14 -0
  21. package/bin/chunk-N7J3ORRT.js.map +1 -0
  22. package/bin/chunk-ROGUZ46T.js +22 -0
  23. package/bin/chunk-ROGUZ46T.js.map +1 -0
  24. package/bin/chunk-RZZ5UCVV.js +22 -0
  25. package/bin/chunk-RZZ5UCVV.js.map +1 -0
  26. package/bin/{chunk-WQI3QHPS.js → chunk-S3E6UR4Y.js} +3 -3
  27. package/bin/chunk-S3E6UR4Y.js.map +1 -0
  28. package/bin/chunk-S7Z6YPPG.js +16 -0
  29. package/bin/chunk-S7Z6YPPG.js.map +1 -0
  30. package/bin/chunk-XHWHVOBP.cjs +24 -0
  31. package/bin/chunk-XHWHVOBP.cjs.map +1 -0
  32. package/bin/{chunk-AU5PZKTN.cjs → chunk-YHZNDNCW.cjs} +5 -5
  33. package/bin/chunk-YHZNDNCW.cjs.map +1 -0
  34. package/bin/chunk-Z64XNZ43.cjs +24 -0
  35. package/bin/chunk-Z64XNZ43.cjs.map +1 -0
  36. package/bin/chunk-ZW2KYP2Z.cjs +24 -0
  37. package/bin/chunk-ZW2KYP2Z.cjs.map +1 -0
  38. package/bin/git.cjs +206 -84
  39. package/bin/git.cjs.map +1 -1
  40. package/bin/git.js +129 -7
  41. package/bin/git.js.map +1 -1
  42. package/bin/post-checkout.cjs +9 -21
  43. package/bin/post-checkout.cjs.map +1 -1
  44. package/bin/post-checkout.js +5 -17
  45. package/bin/post-checkout.js.map +1 -1
  46. package/bin/post-commit.cjs +9 -21
  47. package/bin/post-commit.cjs.map +1 -1
  48. package/bin/post-commit.js +5 -17
  49. package/bin/post-commit.js.map +1 -1
  50. package/bin/post-merge.cjs +9 -21
  51. package/bin/post-merge.cjs.map +1 -1
  52. package/bin/post-merge.js +5 -17
  53. package/bin/post-merge.js.map +1 -1
  54. package/bin/pre-commit.cjs +8 -16
  55. package/bin/pre-commit.cjs.map +1 -1
  56. package/bin/pre-commit.js +4 -12
  57. package/bin/pre-commit.js.map +1 -1
  58. package/bin/pre-install.cjs +8 -13
  59. package/bin/pre-install.cjs.map +1 -1
  60. package/bin/pre-install.js +4 -9
  61. package/bin/pre-install.js.map +1 -1
  62. package/bin/pre-push.cjs +9 -72
  63. package/bin/pre-push.cjs.map +1 -1
  64. package/bin/pre-push.js +5 -63
  65. package/bin/pre-push.js.map +1 -1
  66. package/bin/prepare.cjs +8 -11
  67. package/bin/prepare.cjs.map +1 -1
  68. package/bin/prepare.js +4 -7
  69. package/bin/prepare.js.map +1 -1
  70. package/bin/version-warning.cjs +7 -7
  71. package/bin/version-warning.js +2 -2
  72. package/dist/chunk-2NF67ZEY.js +14 -0
  73. package/dist/chunk-5DVCH44C.cjs +22 -0
  74. package/dist/{chunk-NY53WLGC.cjs → chunk-7ZSL4J35.cjs} +9 -9
  75. package/dist/chunk-AU2RMJUK.js +20 -0
  76. package/dist/chunk-BUQYMEBK.cjs +17 -0
  77. package/dist/chunk-C6MBULOZ.js +15 -0
  78. package/dist/chunk-DMVL4OYZ.cjs +14 -0
  79. package/dist/chunk-ENL3GCXS.cjs +2 -0
  80. package/dist/chunk-F2HQMRJH.cjs +16 -0
  81. package/dist/chunk-FJL2V56E.cjs +24 -0
  82. package/dist/chunk-GTOCMU46.cjs +57 -0
  83. package/dist/chunk-HMHOHK22.js +17 -0
  84. package/dist/{chunk-VVJA5N2W.js → chunk-HVTQXN3A.js} +3 -285
  85. package/dist/chunk-JOPN56T4.js +22 -0
  86. package/dist/chunk-LSTKPCAN.cjs +22 -0
  87. package/dist/chunk-Q47SPRY7.js +1 -0
  88. package/dist/chunk-QCNDIFYQ.cjs +20 -0
  89. package/dist/chunk-RK75BACO.js +50 -0
  90. package/dist/{chunk-EMYFDYKP.cjs → chunk-RQ67RJVN.cjs} +13 -296
  91. package/dist/chunk-SIFTTG22.cjs +303 -0
  92. package/dist/chunk-UQMGLURT.js +20 -0
  93. package/dist/{chunk-JCEVFJCA.js → chunk-USTER7R2.js} +2 -2
  94. package/dist/chunk-X7F62ZNF.js +290 -0
  95. package/dist/chunk-YUE6ZNKC.js +12 -0
  96. package/dist/chunk-Z4CPTYLS.cjs +22 -0
  97. package/dist/chunk-ZKDVZXHI.js +20 -0
  98. package/dist/commit/minimal.cjs +4 -4
  99. package/dist/commit/minimal.js +2 -2
  100. package/dist/commit/monorepo.cjs +5 -5
  101. package/dist/commit/monorepo.js +3 -3
  102. package/dist/index.cjs +51 -12
  103. package/dist/index.d.cts +8 -0
  104. package/dist/index.d.ts +8 -0
  105. package/dist/index.js +15 -4
  106. package/dist/lefthook/minimal.yml +69 -0
  107. package/dist/lefthook/recommended.yml +60 -0
  108. package/dist/lefthook/strict.yml +32 -0
  109. package/dist/release/config.cjs +13 -11
  110. package/dist/release/config.js +6 -4
  111. package/package.json +79 -65
  112. package/bin/chunk-AU5PZKTN.cjs.map +0 -1
  113. package/bin/chunk-Q3DQKTOI.js.map +0 -1
  114. package/bin/chunk-WQI3QHPS.js.map +0 -1
  115. package/bin/chunk-ZBLIE7F7.cjs.map +0 -1
  116. package/dist/lefthook/config.yml +0 -119
  117. package/dist/{chunk-F7OO6L26.cjs → chunk-CT6VGZZS.cjs} +1 -1
  118. package/dist/{chunk-KZRVQ5RZ.js → chunk-WCAKLYL2.js} +1 -1
@@ -1,9 +1,8 @@
1
- import { DEFAULT_MONOREPO_COMMIT_QUESTIONS } from './chunk-JCEVFJCA.js';
1
+ import { DEFAULT_MONOREPO_COMMIT_QUESTIONS } from './chunk-USTER7R2.js';
2
2
  import { DEFAULT_COMMIT_TYPES } from './chunk-3GGWHKRP.js';
3
+ import { writeTrace, formatLogMessage, writeWarning, getLogLevel, LogLevel, getLogLevelLabel } from './chunk-X7F62ZNF.js';
3
4
  import defu from 'defu';
4
5
  import { loadConfig } from 'c12';
5
- import 'date-fns/formatDistanceToNow';
6
- import chalk from 'chalk';
7
6
  import { existsSync } from 'node:fs';
8
7
  import { join } from 'node:path';
9
8
  import { readFile } from 'node:fs/promises';
@@ -12,6 +11,7 @@ import DefaultChangelogRenderer from 'nx/release/changelog-renderer';
12
11
  import { DEFAULT_CONVENTIONAL_COMMITS_CONFIG } from 'nx/src/command-line/release/config/conventional-commits';
13
12
  import { major } from 'semver';
14
13
  import '@nx/devkit';
14
+ import 'chalk';
15
15
  import 'nx/src/command-line/release/utils/print-changes';
16
16
  import 'nx/src/command-line/release/utils/shared';
17
17
  import 'nx/src/tasks-runner/utils';
@@ -158,288 +158,6 @@ function omit(obj, keys) {
158
158
  }
159
159
  return result;
160
160
  }
161
-
162
- // ../config-tools/src/types.ts
163
- var LogLevel = {
164
- SILENT: 0,
165
- FATAL: 10,
166
- ERROR: 20,
167
- WARN: 30,
168
- SUCCESS: 35,
169
- INFO: 40,
170
- DEBUG: 60,
171
- TRACE: 70,
172
- ALL: 100
173
- };
174
- var LogLevelLabel = {
175
- SILENT: "silent",
176
- FATAL: "fatal",
177
- ERROR: "error",
178
- WARN: "warn",
179
- SUCCESS: "success",
180
- INFO: "info",
181
- DEBUG: "debug",
182
- TRACE: "trace",
183
- ALL: "all"
184
- };
185
-
186
- // ../config-tools/src/utilities/colors.ts
187
- var DEFAULT_COLOR_CONFIG = {
188
- dark: {
189
- brand: "#2dd4bf",
190
- success: "#10b981",
191
- info: "#58a6ff",
192
- debug: "#8afafc",
193
- warning: "#f3d371",
194
- danger: "#D8314A",
195
- fatal: "#a40e26"}
196
- };
197
- var chalkDefault = {
198
- hex: (_) => (message) => message,
199
- bgHex: (_) => ({
200
- whiteBright: (message) => message,
201
- white: (message) => message
202
- }),
203
- white: (message) => message,
204
- whiteBright: (message) => message,
205
- gray: (message) => message,
206
- bold: {
207
- hex: (_) => (message) => message,
208
- bgHex: (_) => ({
209
- whiteBright: (message) => message,
210
- white: (message) => message
211
- }),
212
- whiteBright: (message) => message,
213
- white: (message) => message
214
- },
215
- dim: {
216
- hex: (_) => (message) => message,
217
- gray: (message) => message
218
- }
219
- };
220
- var getChalk = () => {
221
- let _chalk = chalk;
222
- if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
223
- _chalk = chalkDefault;
224
- }
225
- return _chalk;
226
- };
227
-
228
- // ../config-tools/src/logger/is-unicode-supported.ts
229
- function isUnicodeSupported() {
230
- if (process.platform !== "win32") {
231
- return process.env.TERM !== "linux";
232
- }
233
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
234
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
235
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
236
- process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
237
- }
238
-
239
- // ../config-tools/src/logger/console-icons.ts
240
- var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
241
- var CONSOLE_ICONS = {
242
- [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
243
- [LogLevelLabel.FATAL]: useIcon("\u{1F571}", "\xD7"),
244
- [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
245
- [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
246
- [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
247
- [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
248
- [LogLevelLabel.TRACE]: useIcon("\u2699", "T"),
249
- [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
250
- };
251
-
252
- // ../config-tools/src/logger/format-timestamp.ts
253
- var formatTimestamp = (date2 = /* @__PURE__ */ new Date()) => {
254
- return `${date2.toLocaleDateString()} ${date2.toLocaleTimeString()}`;
255
- };
256
-
257
- // ../config-tools/src/logger/get-log-level.ts
258
- var getLogLevel = (label) => {
259
- switch (label) {
260
- case "all":
261
- return LogLevel.ALL;
262
- case "trace":
263
- return LogLevel.TRACE;
264
- case "debug":
265
- return LogLevel.DEBUG;
266
- case "info":
267
- return LogLevel.INFO;
268
- case "warn":
269
- return LogLevel.WARN;
270
- case "error":
271
- return LogLevel.ERROR;
272
- case "fatal":
273
- return LogLevel.FATAL;
274
- case "silent":
275
- return LogLevel.SILENT;
276
- default:
277
- return LogLevel.INFO;
278
- }
279
- };
280
- var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
281
- if (logLevel >= LogLevel.ALL) {
282
- return LogLevelLabel.ALL;
283
- }
284
- if (logLevel >= LogLevel.TRACE) {
285
- return LogLevelLabel.TRACE;
286
- }
287
- if (logLevel >= LogLevel.DEBUG) {
288
- return LogLevelLabel.DEBUG;
289
- }
290
- if (logLevel >= LogLevel.INFO) {
291
- return LogLevelLabel.INFO;
292
- }
293
- if (logLevel >= LogLevel.WARN) {
294
- return LogLevelLabel.WARN;
295
- }
296
- if (logLevel >= LogLevel.ERROR) {
297
- return LogLevelLabel.ERROR;
298
- }
299
- if (logLevel >= LogLevel.FATAL) {
300
- return LogLevelLabel.FATAL;
301
- }
302
- if (logLevel <= LogLevel.SILENT) {
303
- return LogLevelLabel.SILENT;
304
- }
305
- return LogLevelLabel.INFO;
306
- };
307
-
308
- // ../config-tools/src/logger/console.ts
309
- var getLogFn = (logLevel = LogLevel.INFO, config2 = {}, _chalk = getChalk()) => {
310
- const colors = !config2.colors?.dark && !config2.colors?.["base"] && !config2.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config2.colors?.dark && typeof config2.colors.dark === "string" ? config2.colors : config2.colors?.["base"]?.dark && typeof config2.colors["base"].dark === "string" ? config2.colors["base"].dark : config2.colors?.["base"] ? config2.colors?.["base"] : DEFAULT_COLOR_CONFIG;
311
- const configLogLevel = config2.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
312
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
313
- return (_) => {
314
- };
315
- }
316
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
317
- return (message) => {
318
- console.error(
319
- `
320
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(
321
- colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal
322
- )(
323
- `[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `
324
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
325
- `
326
- );
327
- };
328
- }
329
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
330
- return (message) => {
331
- console.error(
332
- `
333
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(
334
- colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger
335
- )(
336
- `[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `
337
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
338
- `
339
- );
340
- };
341
- }
342
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
343
- return (message) => {
344
- console.warn(
345
- `
346
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(
347
- colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning
348
- )(
349
- `[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `
350
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
351
- `
352
- );
353
- };
354
- }
355
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
356
- return (message) => {
357
- console.info(
358
- `
359
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(
360
- colors.success ?? DEFAULT_COLOR_CONFIG.dark.success
361
- )(
362
- `[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `
363
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
364
- `
365
- );
366
- };
367
- }
368
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
369
- return (message) => {
370
- console.info(
371
- `
372
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(
373
- colors.info ?? DEFAULT_COLOR_CONFIG.dark.info
374
- )(
375
- `[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `
376
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
377
- `
378
- );
379
- };
380
- }
381
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
382
- return (message) => {
383
- console.debug(
384
- `
385
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(
386
- colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug
387
- )(
388
- `[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `
389
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
390
- `
391
- );
392
- };
393
- }
394
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
395
- return (message) => {
396
- console.debug(
397
- `
398
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#bbbbbb")(
399
- `[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `
400
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
401
- `
402
- );
403
- };
404
- }
405
- return (message) => {
406
- console.log(
407
- `
408
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(
409
- colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand
410
- )(
411
- `[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `
412
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
413
- `
414
- );
415
- };
416
- };
417
- var writeWarning = (message, config2) => getLogFn(LogLevel.WARN, config2)(message);
418
- var writeTrace = (message, config2) => getLogFn(LogLevel.TRACE, config2)(message);
419
- var MAX_DEPTH = 6;
420
- var formatLogMessage = (message, options = {}, depth2 = 0) => {
421
- if (depth2 > MAX_DEPTH) {
422
- return "<max depth>";
423
- }
424
- const prefix = options.prefix ?? "-";
425
- const skip = options.skip ?? [];
426
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
427
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
428
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
429
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
430
- message[key],
431
- { prefix: `${prefix}-`, skip },
432
- depth2 + 1
433
- ) : message[key]}`
434
- ).join("\n")}` : message;
435
- };
436
- var _isFunction = (value) => {
437
- try {
438
- return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
439
- } catch {
440
- return false;
441
- }
442
- };
443
161
  var MAX_PATH_SEARCH_DEPTH = 30;
444
162
  var depth = 0;
445
163
  function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
@@ -0,0 +1,22 @@
1
+ import { execSync } from 'node:child_process';
2
+
3
+ // ../config-tools/src/utilities/run.ts
4
+ var LARGE_BUFFER = 1024 * 1e6;
5
+ var run = (config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
6
+ return execSync(command, {
7
+ cwd,
8
+ env: {
9
+ ...process.env,
10
+ ...env,
11
+ CLICOLOR: "true",
12
+ FORCE_COLOR: "true"
13
+ },
14
+ windowsHide: true,
15
+ stdio,
16
+ maxBuffer: LARGE_BUFFER,
17
+ killSignal: "SIGTERM",
18
+ encoding: "utf8"
19
+ });
20
+ };
21
+
22
+ export { run };
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var chunkQCNDIFYQ_cjs = require('./chunk-QCNDIFYQ.cjs');
4
+ var chunkFJL2V56E_cjs = require('./chunk-FJL2V56E.cjs');
5
+ var chunkSIFTTG22_cjs = require('./chunk-SIFTTG22.cjs');
6
+
7
+ // src/hooks/post-checkout.ts
8
+ async function postCheckoutHook(config, files) {
9
+ chunkSIFTTG22_cjs.writeInfo("Running post-checkout hook...", config);
10
+ chunkQCNDIFYQ_cjs.checkPackageVersion(files);
11
+ try {
12
+ chunkFJL2V56E_cjs.run(config, "git-lfs version");
13
+ } catch (error) {
14
+ throw new Error(
15
+ `This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.
16
+ Error: ${error?.message}`
17
+ );
18
+ }
19
+ chunkFJL2V56E_cjs.run(config, "git lfs post-checkout");
20
+ }
21
+
22
+ exports.postCheckoutHook = postCheckoutHook;
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ // src/utilities/check-package-version.ts
4
+ var isPackageVersionChanged = (files) => files?.some(
5
+ (arg) => arg.includes("package-lock.json") || arg.includes("yarn.lock") || arg.includes("pnpm-lock.json") || arg.includes("pnpm-lock.yaml") || arg.includes("pnpm-lock.yml") || arg.includes("bun.lockb")
6
+ );
7
+ var checkPackageVersion = (files) => {
8
+ if (isPackageVersionChanged(files)) {
9
+ console.warn(
10
+ [
11
+ "\u26A0\uFE0F ----------------------------------------------------------------------------------------- \u26A0\uFE0F",
12
+ "\u26A0\uFE0F The pnpm-lock file changed! Please run `pnpm i` to ensure your packages are up to date. \u26A0\uFE0F",
13
+ "\u26A0\uFE0F ----------------------------------------------------------------------------------------- \u26A0\uFE0F"
14
+ ].join("\n")
15
+ );
16
+ }
17
+ };
18
+
19
+ exports.checkPackageVersion = checkPackageVersion;
20
+ exports.isPackageVersionChanged = isPackageVersionChanged;
@@ -0,0 +1,50 @@
1
+ import { checkPackageVersion } from './chunk-HMHOHK22.js';
2
+ import { writeInfo, writeSuccess } from './chunk-X7F62ZNF.js';
3
+ import fs from 'node:fs';
4
+ import { readFile } from 'node:fs/promises';
5
+ import path from 'node:path';
6
+
7
+ async function prePushHook(config, files) {
8
+ writeInfo("Running pre-push hook...", config);
9
+ checkPackageVersion(files);
10
+ writeInfo("\u{1F512}\u{1F512}\u{1F512} Validating lock files \u{1F512}\u{1F512}\u{1F512}\n", config);
11
+ const errors = [];
12
+ if (fs.existsSync(path.join(config.workspaceRoot ?? "./", "package-lock.json"))) {
13
+ errors.push(
14
+ 'Invalid occurrence of "package-lock.json" file. Please remove it and use only "pnpm-lock.yaml"'
15
+ );
16
+ }
17
+ if (fs.existsSync(path.join(config.workspaceRoot ?? "./", "yarn.lock"))) {
18
+ errors.push(
19
+ 'Invalid occurrence of "yarn.lock" file. Please remove it and use only "pnpm-lock.yaml"'
20
+ );
21
+ }
22
+ try {
23
+ const content = await readFile(
24
+ path.join(config.workspaceRoot ?? "./", "pnpm-lock.yaml"),
25
+ {
26
+ encoding: "utf8"
27
+ }
28
+ );
29
+ if (content?.match(/localhost:487/)) {
30
+ errors.push(
31
+ 'The "pnpm-lock.yaml" has reference to local repository ("localhost:4873"). Please use ensure you disable local registry before running "pnpm i"'
32
+ );
33
+ }
34
+ if (content?.match(/resolution: \{tarball/)) {
35
+ errors.push(
36
+ 'The "pnpm-lock.yaml" has reference to tarball package. Please use npm registry only'
37
+ );
38
+ }
39
+ } catch {
40
+ errors.push('The "pnpm-lock.yaml" does not exist or cannot be read');
41
+ }
42
+ if (errors.length > 0) {
43
+ throw new Error(
44
+ "\u274C Lock file validation failed\n" + errors.join("\n")
45
+ );
46
+ }
47
+ writeSuccess(" \u2714 Lock file is valid for push", config);
48
+ }
49
+
50
+ export { prePushHook };