skuba 12.2.0-main-20250904041733 → 12.2.0-patch-jest-snapshots-20250905002311

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.
@@ -0,0 +1,2 @@
1
+ import type { Patches } from '../../index.js';
2
+ export declare const patches: Patches;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __exports = {};
20
+ __export(__exports, {
21
+ patches: () => patches
22
+ });
23
+ module.exports = __toCommonJS(__exports);
24
+ var import_patchJestSnapshots = require("./patchJestSnapshots.js");
25
+ const patches = [
26
+ {
27
+ apply: import_patchJestSnapshots.tryPatchJestSnapshots,
28
+ description: "Update Jest snapshot URLs to the new documentation site"
29
+ }
30
+ ];
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ patches
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.1.1/index.ts"],
4
+ "sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryPatchJestSnapshots } from './patchJestSnapshots.js';\n\nexport const patches: Patches = [\n {\n apply: tryPatchJestSnapshots,\n description: 'Update Jest snapshot URLs to the new documentation site',\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,gCAAsC;AAE/B,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { PatchFunction, PatchReturnType } from '../../index.js';
2
+ export declare const patchJestSnapshots: (mode: "lint" | "format") => Promise<PatchReturnType>;
3
+ export declare const tryPatchJestSnapshots: PatchFunction;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var patchJestSnapshots_exports = {};
30
+ __export(patchJestSnapshots_exports, {
31
+ patchJestSnapshots: () => patchJestSnapshots,
32
+ tryPatchJestSnapshots: () => tryPatchJestSnapshots
33
+ });
34
+ module.exports = __toCommonJS(patchJestSnapshots_exports);
35
+ var import_util = require("util");
36
+ var import_fast_glob = __toESM(require("fast-glob"));
37
+ var import_fs_extra = __toESM(require("fs-extra"));
38
+ var import_logging = require("../../../../../../utils/logging.js");
39
+ const JEST_SNAPSHOT_OLD_URL = "https://goo.gl/fbAQLP";
40
+ const JEST_SNAPSHOT_NEW_URL = "https://jestjs.io/docs/snapshot-testing";
41
+ const patchJestSnapshots = async (mode) => {
42
+ const testFilePaths = await (0, import_fast_glob.default)(["*.test.ts", "*.test.ts.snap"], {
43
+ ignore: ["**/.git", "**/node_modules"]
44
+ });
45
+ if (testFilePaths.length === 0) {
46
+ return {
47
+ result: "skip",
48
+ reason: "no test files found"
49
+ };
50
+ }
51
+ const testsFiles = await Promise.all(
52
+ testFilePaths.map(async (file) => {
53
+ const contents = await import_fs_extra.default.readFile(file, "utf8");
54
+ return {
55
+ file,
56
+ contents
57
+ };
58
+ })
59
+ );
60
+ const testFilesToPatch = testsFiles.filter(
61
+ ({ contents }) => contents.includes(JEST_SNAPSHOT_OLD_URL)
62
+ );
63
+ if (testFilesToPatch.length === 0) {
64
+ return {
65
+ result: "skip",
66
+ reason: "no test files to patch"
67
+ };
68
+ }
69
+ if (mode === "lint") {
70
+ return {
71
+ result: "apply"
72
+ };
73
+ }
74
+ await Promise.all(
75
+ testFilesToPatch.map(async ({ file, contents }) => {
76
+ const updatedContents = contents.replaceAll(
77
+ JEST_SNAPSHOT_OLD_URL,
78
+ JEST_SNAPSHOT_NEW_URL
79
+ );
80
+ await import_fs_extra.default.writeFile(file, updatedContents, "utf8");
81
+ })
82
+ );
83
+ return {
84
+ result: "apply"
85
+ };
86
+ };
87
+ const tryPatchJestSnapshots = async ({ mode }) => {
88
+ try {
89
+ return await patchJestSnapshots(mode);
90
+ } catch (err) {
91
+ import_logging.log.warn("Failed to apply Jest snapshot URL patch.");
92
+ import_logging.log.subtle((0, import_util.inspect)(err));
93
+ return { result: "skip", reason: "due to an error" };
94
+ }
95
+ };
96
+ // Annotate the CommonJS export names for ESM import in node:
97
+ 0 && (module.exports = {
98
+ patchJestSnapshots,
99
+ tryPatchJestSnapshots
100
+ });
101
+ //# sourceMappingURL=patchJestSnapshots.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.1.1/patchJestSnapshots.ts"],
4
+ "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst JEST_SNAPSHOT_OLD_URL = 'https://goo.gl/fbAQLP';\nconst JEST_SNAPSHOT_NEW_URL = 'https://jestjs.io/docs/snapshot-testing';\n\nexport const patchJestSnapshots = async (\n mode: 'lint' | 'format',\n): Promise<PatchReturnType> => {\n const testFilePaths = await fg(['*.test.ts', '*.test.ts.snap'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (testFilePaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no test files found',\n };\n }\n\n const testsFiles = await Promise.all(\n testFilePaths.map(async (file) => {\n const contents = await fs.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n const testFilesToPatch = testsFiles.filter(({ contents }) =>\n contents.includes(JEST_SNAPSHOT_OLD_URL),\n );\n\n if (testFilesToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no test files to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n testFilesToPatch.map(async ({ file, contents }) => {\n const updatedContents = contents.replaceAll(\n JEST_SNAPSHOT_OLD_URL,\n JEST_SNAPSHOT_NEW_URL,\n );\n await fs.writeFile(file, updatedContents, 'utf8');\n }),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const tryPatchJestSnapshots: PatchFunction = async ({ mode }) => {\n try {\n return await patchJestSnapshots(mode);\n } catch (err) {\n log.warn('Failed to apply Jest snapshot URL patch.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAe;AACf,sBAAe;AAEf,qBAAoB;AAGpB,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAEvB,MAAM,qBAAqB,OAChC,SAC6B;AAC7B,QAAM,gBAAgB,UAAM,iBAAAA,SAAG,CAAC,aAAa,gBAAgB,GAAG;AAAA,IAC9D,QAAQ,CAAC,WAAW,iBAAiB;AAAA,EACvC,CAAC;AAED,MAAI,cAAc,WAAW,GAAG;AAC9B,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,aAAa,MAAM,QAAQ;AAAA,IAC/B,cAAc,IAAI,OAAO,SAAS;AAChC,YAAM,WAAW,MAAM,gBAAAC,QAAG,SAAS,MAAM,MAAM;AAE/C,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,mBAAmB,WAAW;AAAA,IAAO,CAAC,EAAE,SAAS,MACrD,SAAS,SAAS,qBAAqB;AAAA,EACzC;AAEA,MAAI,iBAAiB,WAAW,GAAG;AACjC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,iBAAiB,IAAI,OAAO,EAAE,MAAM,SAAS,MAAM;AACjD,YAAM,kBAAkB,SAAS;AAAA,QAC/B;AAAA,QACA;AAAA,MACF;AACA,YAAM,gBAAAA,QAAG,UAAU,MAAM,iBAAiB,MAAM;AAAA,IAClD,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,wBAAuC,OAAO,EAAE,KAAK,MAAM;AACtE,MAAI;AACF,WAAO,MAAM,mBAAmB,IAAI;AAAA,EACtC,SAAS,KAAK;AACZ,uBAAI,KAAK,0CAA0C;AACnD,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
+ "names": ["fg", "fs"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skuba",
3
- "version": "12.2.0-main-20250904041733",
3
+ "version": "12.2.0-patch-jest-snapshots-20250905002311",
4
4
  "private": false,
5
5
  "description": "SEEK development toolkit for backend applications and packages",
6
6
  "homepage": "https://github.com/seek-oss/skuba#readme",
@@ -97,7 +97,7 @@
97
97
  "tsx": "^4.16.2",
98
98
  "typescript": "~5.9.0",
99
99
  "zod": "^4.0.0",
100
- "eslint-config-skuba": "7.1.1-main-20250904041733"
100
+ "eslint-config-skuba": "7.1.1-patch-jest-snapshots-20250905002311"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@changesets/cli": "2.29.6",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^22.13.10",
20
- "skuba": "12.2.0-main-20250904041733"
20
+ "skuba": "12.2.0-patch-jest-snapshots-20250905002311"
21
21
  },
22
22
  "packageManager": "pnpm@10.15.0",
23
23
  "engines": {
@@ -35,7 +35,7 @@
35
35
  "datadog-lambda-js": "^12.0.0",
36
36
  "dd-trace": "^5.0.0",
37
37
  "pino-pretty": "^13.0.0",
38
- "skuba": "12.2.0-main-20250904041733"
38
+ "skuba": "12.2.0-patch-jest-snapshots-20250905002311"
39
39
  },
40
40
  "packageManager": "pnpm@10.15.0",
41
41
  "engines": {