@wise/wds-codemods 1.2.0-experimental-8fe5753 → 1.2.0-experimental-83cdebc
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/dist/{claude-cHSlHbX1.js → claude-DgCA6hwx.js} +27 -21
- package/dist/claude-DgCA6hwx.js.map +1 -0
- package/dist/common-Dej-huqF.js +53 -0
- package/dist/{common-nTdKnfMB.js.map → common-Dej-huqF.js.map} +1 -1
- package/dist/{helpers-9e0vtyED.js → helpers-Co55RkBl.js} +175 -130
- package/dist/helpers-Co55RkBl.js.map +1 -0
- package/dist/index.js +45 -43
- package/dist/index.js.map +1 -1
- package/dist/transforms/button/transformer.js +8 -3
- package/dist/transforms/button/transformer.js.map +1 -1
- package/dist/transforms/info-prompt/transformer.js +9 -8
- package/dist/transforms/info-prompt/transformer.js.map +1 -1
- package/dist/transforms/list-item/transformer.js +9 -8
- package/dist/transforms/list-item/transformer.js.map +1 -1
- package/package.json +4 -2
- package/dist/claude-cHSlHbX1.js.map +0 -1
- package/dist/common-nTdKnfMB.js +0 -13
- package/dist/helpers-9e0vtyED.js.map +0 -1
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
14
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
-
key = keys[i];
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
-
get: ((k) => from[k]).bind(null, key),
|
|
21
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
return to;
|
|
25
|
-
};
|
|
26
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
-
value: mod,
|
|
28
|
-
enumerable: true
|
|
29
|
-
}) : target, mod));
|
|
30
|
-
//#endregion
|
|
1
|
+
const require_common = require("./common-Dej-huqF.js");
|
|
2
|
+
let node_child_process = require("node:child_process");
|
|
3
|
+
let node_fs_promises = require("node:fs/promises");
|
|
4
|
+
node_fs_promises = require_common.__toESM(node_fs_promises);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_common.__toESM(node_path);
|
|
7
|
+
let _inquirer_prompts = require("@inquirer/prompts");
|
|
8
|
+
let node_fs = require("node:fs");
|
|
9
|
+
node_fs = require_common.__toESM(node_fs);
|
|
10
|
+
let node_util = require("node:util");
|
|
31
11
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js
|
|
32
|
-
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12
|
+
var require_constants = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
33
13
|
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
34
14
|
const MAX_LENGTH = 256;
|
|
35
15
|
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
@@ -54,12 +34,12 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
54
34
|
}));
|
|
55
35
|
//#endregion
|
|
56
36
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js
|
|
57
|
-
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
37
|
+
var require_debug = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
58
38
|
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
59
39
|
}));
|
|
60
40
|
//#endregion
|
|
61
41
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js
|
|
62
|
-
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
42
|
+
var require_re = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
63
43
|
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
64
44
|
const debug = require_debug();
|
|
65
45
|
exports = module.exports = {};
|
|
@@ -138,7 +118,7 @@ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
138
118
|
}));
|
|
139
119
|
//#endregion
|
|
140
120
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js
|
|
141
|
-
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
121
|
+
var require_parse_options = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
142
122
|
const looseOption = Object.freeze({ loose: true });
|
|
143
123
|
const emptyOpts = Object.freeze({});
|
|
144
124
|
const parseOptions = (options) => {
|
|
@@ -150,7 +130,7 @@ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
150
130
|
}));
|
|
151
131
|
//#endregion
|
|
152
132
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js
|
|
153
|
-
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
133
|
+
var require_identifiers = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
154
134
|
const numeric = /^[0-9]+$/;
|
|
155
135
|
const compareIdentifiers = (a, b) => {
|
|
156
136
|
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
@@ -170,7 +150,7 @@ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
170
150
|
}));
|
|
171
151
|
//#endregion
|
|
172
152
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js
|
|
173
|
-
var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
153
|
+
var require_semver$1 = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
174
154
|
const debug = require_debug();
|
|
175
155
|
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
176
156
|
const { safeRe: re, t } = require_re();
|
|
@@ -348,7 +328,7 @@ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
348
328
|
}));
|
|
349
329
|
//#endregion
|
|
350
330
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js
|
|
351
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
331
|
+
var require_parse = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
352
332
|
const SemVer = require_semver$1();
|
|
353
333
|
const parse = (version, options, throwErrors = false) => {
|
|
354
334
|
if (version instanceof SemVer) return version;
|
|
@@ -363,7 +343,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
363
343
|
}));
|
|
364
344
|
//#endregion
|
|
365
345
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js
|
|
366
|
-
var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
346
|
+
var require_valid$1 = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
367
347
|
const parse = require_parse();
|
|
368
348
|
const valid = (version, options) => {
|
|
369
349
|
const v = parse(version, options);
|
|
@@ -373,7 +353,7 @@ var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
373
353
|
}));
|
|
374
354
|
//#endregion
|
|
375
355
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js
|
|
376
|
-
var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
356
|
+
var require_clean = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
377
357
|
const parse = require_parse();
|
|
378
358
|
const clean = (version, options) => {
|
|
379
359
|
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
@@ -383,7 +363,7 @@ var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
383
363
|
}));
|
|
384
364
|
//#endregion
|
|
385
365
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js
|
|
386
|
-
var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
366
|
+
var require_inc = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
387
367
|
const SemVer = require_semver$1();
|
|
388
368
|
const inc = (version, release, options, identifier, identifierBase) => {
|
|
389
369
|
if (typeof options === "string") {
|
|
@@ -401,7 +381,7 @@ var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
401
381
|
}));
|
|
402
382
|
//#endregion
|
|
403
383
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js
|
|
404
|
-
var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
384
|
+
var require_diff = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
405
385
|
const parse = require_parse();
|
|
406
386
|
const diff = (version1, version2) => {
|
|
407
387
|
const v1 = parse(version1, null, true);
|
|
@@ -429,28 +409,28 @@ var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
429
409
|
}));
|
|
430
410
|
//#endregion
|
|
431
411
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js
|
|
432
|
-
var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
412
|
+
var require_major = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
433
413
|
const SemVer = require_semver$1();
|
|
434
414
|
const major = (a, loose) => new SemVer(a, loose).major;
|
|
435
415
|
module.exports = major;
|
|
436
416
|
}));
|
|
437
417
|
//#endregion
|
|
438
418
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js
|
|
439
|
-
var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
419
|
+
var require_minor = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
440
420
|
const SemVer = require_semver$1();
|
|
441
421
|
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
442
422
|
module.exports = minor;
|
|
443
423
|
}));
|
|
444
424
|
//#endregion
|
|
445
425
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js
|
|
446
|
-
var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
426
|
+
var require_patch = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
447
427
|
const SemVer = require_semver$1();
|
|
448
428
|
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
449
429
|
module.exports = patch;
|
|
450
430
|
}));
|
|
451
431
|
//#endregion
|
|
452
432
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js
|
|
453
|
-
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
433
|
+
var require_prerelease = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
454
434
|
const parse = require_parse();
|
|
455
435
|
const prerelease = (version, options) => {
|
|
456
436
|
const parsed = parse(version, options);
|
|
@@ -460,28 +440,28 @@ var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
460
440
|
}));
|
|
461
441
|
//#endregion
|
|
462
442
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js
|
|
463
|
-
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
443
|
+
var require_compare = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
464
444
|
const SemVer = require_semver$1();
|
|
465
445
|
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
466
446
|
module.exports = compare;
|
|
467
447
|
}));
|
|
468
448
|
//#endregion
|
|
469
449
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js
|
|
470
|
-
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
450
|
+
var require_rcompare = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
471
451
|
const compare = require_compare();
|
|
472
452
|
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
473
453
|
module.exports = rcompare;
|
|
474
454
|
}));
|
|
475
455
|
//#endregion
|
|
476
456
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js
|
|
477
|
-
var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
457
|
+
var require_compare_loose = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
478
458
|
const compare = require_compare();
|
|
479
459
|
const compareLoose = (a, b) => compare(a, b, true);
|
|
480
460
|
module.exports = compareLoose;
|
|
481
461
|
}));
|
|
482
462
|
//#endregion
|
|
483
463
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js
|
|
484
|
-
var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
464
|
+
var require_compare_build = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
485
465
|
const SemVer = require_semver$1();
|
|
486
466
|
const compareBuild = (a, b, loose) => {
|
|
487
467
|
const versionA = new SemVer(a, loose);
|
|
@@ -492,63 +472,63 @@ var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
492
472
|
}));
|
|
493
473
|
//#endregion
|
|
494
474
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js
|
|
495
|
-
var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
475
|
+
var require_sort = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
496
476
|
const compareBuild = require_compare_build();
|
|
497
477
|
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
498
478
|
module.exports = sort;
|
|
499
479
|
}));
|
|
500
480
|
//#endregion
|
|
501
481
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js
|
|
502
|
-
var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
482
|
+
var require_rsort = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
503
483
|
const compareBuild = require_compare_build();
|
|
504
484
|
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
505
485
|
module.exports = rsort;
|
|
506
486
|
}));
|
|
507
487
|
//#endregion
|
|
508
488
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js
|
|
509
|
-
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
489
|
+
var require_gt = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
510
490
|
const compare = require_compare();
|
|
511
491
|
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
512
492
|
module.exports = gt;
|
|
513
493
|
}));
|
|
514
494
|
//#endregion
|
|
515
495
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js
|
|
516
|
-
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
496
|
+
var require_lt = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
517
497
|
const compare = require_compare();
|
|
518
498
|
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
519
499
|
module.exports = lt;
|
|
520
500
|
}));
|
|
521
501
|
//#endregion
|
|
522
502
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js
|
|
523
|
-
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
503
|
+
var require_eq = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
524
504
|
const compare = require_compare();
|
|
525
505
|
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
526
506
|
module.exports = eq;
|
|
527
507
|
}));
|
|
528
508
|
//#endregion
|
|
529
509
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js
|
|
530
|
-
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
510
|
+
var require_neq = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
531
511
|
const compare = require_compare();
|
|
532
512
|
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
533
513
|
module.exports = neq;
|
|
534
514
|
}));
|
|
535
515
|
//#endregion
|
|
536
516
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js
|
|
537
|
-
var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
517
|
+
var require_gte = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
538
518
|
const compare = require_compare();
|
|
539
519
|
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
540
520
|
module.exports = gte;
|
|
541
521
|
}));
|
|
542
522
|
//#endregion
|
|
543
523
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js
|
|
544
|
-
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
524
|
+
var require_lte = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
545
525
|
const compare = require_compare();
|
|
546
526
|
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
547
527
|
module.exports = lte;
|
|
548
528
|
}));
|
|
549
529
|
//#endregion
|
|
550
530
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js
|
|
551
|
-
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
531
|
+
var require_cmp = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
552
532
|
const eq = require_eq();
|
|
553
533
|
const neq = require_neq();
|
|
554
534
|
const gt = require_gt();
|
|
@@ -580,7 +560,7 @@ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
580
560
|
}));
|
|
581
561
|
//#endregion
|
|
582
562
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js
|
|
583
|
-
var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
563
|
+
var require_coerce = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
584
564
|
const SemVer = require_semver$1();
|
|
585
565
|
const parse = require_parse();
|
|
586
566
|
const { safeRe: re, t } = require_re();
|
|
@@ -608,7 +588,7 @@ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
608
588
|
}));
|
|
609
589
|
//#endregion
|
|
610
590
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js
|
|
611
|
-
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
591
|
+
var require_lrucache = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
612
592
|
var LRUCache = class {
|
|
613
593
|
constructor() {
|
|
614
594
|
this.max = 1e3;
|
|
@@ -641,7 +621,7 @@ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
641
621
|
}));
|
|
642
622
|
//#endregion
|
|
643
623
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js
|
|
644
|
-
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
624
|
+
var require_range = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
645
625
|
const SPACE_CHARACTERS = /\s+/g;
|
|
646
626
|
module.exports = class Range {
|
|
647
627
|
constructor(range, options) {
|
|
@@ -913,7 +893,7 @@ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
913
893
|
}));
|
|
914
894
|
//#endregion
|
|
915
895
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js
|
|
916
|
-
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
896
|
+
var require_comparator = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
917
897
|
const ANY = Symbol("SemVer ANY");
|
|
918
898
|
module.exports = class Comparator {
|
|
919
899
|
static get ANY() {
|
|
@@ -983,7 +963,7 @@ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
983
963
|
}));
|
|
984
964
|
//#endregion
|
|
985
965
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js
|
|
986
|
-
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
966
|
+
var require_satisfies = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
987
967
|
const Range = require_range();
|
|
988
968
|
const satisfies = (version, range, options) => {
|
|
989
969
|
try {
|
|
@@ -997,14 +977,14 @@ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
997
977
|
}));
|
|
998
978
|
//#endregion
|
|
999
979
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
|
|
1000
|
-
var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
980
|
+
var require_to_comparators = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1001
981
|
const Range = require_range();
|
|
1002
982
|
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1003
983
|
module.exports = toComparators;
|
|
1004
984
|
}));
|
|
1005
985
|
//#endregion
|
|
1006
986
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
|
|
1007
|
-
var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
987
|
+
var require_max_satisfying = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1008
988
|
const SemVer = require_semver$1();
|
|
1009
989
|
const Range = require_range();
|
|
1010
990
|
const maxSatisfying = (versions, range, options) => {
|
|
@@ -1030,7 +1010,7 @@ var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1030
1010
|
}));
|
|
1031
1011
|
//#endregion
|
|
1032
1012
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
|
|
1033
|
-
var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1013
|
+
var require_min_satisfying = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1034
1014
|
const SemVer = require_semver$1();
|
|
1035
1015
|
const Range = require_range();
|
|
1036
1016
|
const minSatisfying = (versions, range, options) => {
|
|
@@ -1056,7 +1036,7 @@ var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
1056
1036
|
}));
|
|
1057
1037
|
//#endregion
|
|
1058
1038
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js
|
|
1059
|
-
var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1039
|
+
var require_min_version = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1060
1040
|
const SemVer = require_semver$1();
|
|
1061
1041
|
const Range = require_range();
|
|
1062
1042
|
const gt = require_gt();
|
|
@@ -1095,7 +1075,7 @@ var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1095
1075
|
}));
|
|
1096
1076
|
//#endregion
|
|
1097
1077
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js
|
|
1098
|
-
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1078
|
+
var require_valid = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1099
1079
|
const Range = require_range();
|
|
1100
1080
|
const validRange = (range, options) => {
|
|
1101
1081
|
try {
|
|
@@ -1108,7 +1088,7 @@ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1108
1088
|
}));
|
|
1109
1089
|
//#endregion
|
|
1110
1090
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js
|
|
1111
|
-
var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1091
|
+
var require_outside = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1112
1092
|
const SemVer = require_semver$1();
|
|
1113
1093
|
const Comparator = require_comparator();
|
|
1114
1094
|
const { ANY } = Comparator;
|
|
@@ -1161,21 +1141,21 @@ var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1161
1141
|
}));
|
|
1162
1142
|
//#endregion
|
|
1163
1143
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js
|
|
1164
|
-
var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1144
|
+
var require_gtr = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1165
1145
|
const outside = require_outside();
|
|
1166
1146
|
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
1167
1147
|
module.exports = gtr;
|
|
1168
1148
|
}));
|
|
1169
1149
|
//#endregion
|
|
1170
1150
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js
|
|
1171
|
-
var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1151
|
+
var require_ltr = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1172
1152
|
const outside = require_outside();
|
|
1173
1153
|
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
1174
1154
|
module.exports = ltr;
|
|
1175
1155
|
}));
|
|
1176
1156
|
//#endregion
|
|
1177
1157
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js
|
|
1178
|
-
var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1158
|
+
var require_intersects = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1179
1159
|
const Range = require_range();
|
|
1180
1160
|
const intersects = (r1, r2, options) => {
|
|
1181
1161
|
r1 = new Range(r1, options);
|
|
@@ -1186,7 +1166,7 @@ var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1186
1166
|
}));
|
|
1187
1167
|
//#endregion
|
|
1188
1168
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js
|
|
1189
|
-
var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1169
|
+
var require_simplify = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1190
1170
|
const satisfies = require_satisfies();
|
|
1191
1171
|
const compare = require_compare();
|
|
1192
1172
|
module.exports = (versions, range, options) => {
|
|
@@ -1216,7 +1196,7 @@ var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1216
1196
|
}));
|
|
1217
1197
|
//#endregion
|
|
1218
1198
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js
|
|
1219
|
-
var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1199
|
+
var require_subset = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1220
1200
|
const Range = require_range();
|
|
1221
1201
|
const Comparator = require_comparator();
|
|
1222
1202
|
const { ANY } = Comparator;
|
|
@@ -1311,7 +1291,7 @@ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1311
1291
|
}));
|
|
1312
1292
|
//#endregion
|
|
1313
1293
|
//#region node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js
|
|
1314
|
-
var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1294
|
+
var require_semver = /* @__PURE__ */ require_common.__commonJSMin(((exports, module) => {
|
|
1315
1295
|
const internalRe = require_re();
|
|
1316
1296
|
const constants = require_constants();
|
|
1317
1297
|
const SemVer = require_semver$1();
|
|
@@ -1368,9 +1348,9 @@ var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1368
1348
|
//#region src/controller/helpers/getCodemodConfig.ts
|
|
1369
1349
|
/** Retrieves a JSON object from a file path, returning null if the file does not exist */
|
|
1370
1350
|
const getJsonFromPath = (baseDir, fileName) => {
|
|
1371
|
-
const jsonPath = join(baseDir, fileName);
|
|
1351
|
+
const jsonPath = (0, node_path.join)(baseDir, fileName);
|
|
1372
1352
|
try {
|
|
1373
|
-
const jsonContent = readFileSync(jsonPath, "utf8");
|
|
1353
|
+
const jsonContent = (0, node_fs.readFileSync)(jsonPath, "utf8");
|
|
1374
1354
|
return JSON.parse(jsonContent);
|
|
1375
1355
|
} catch {
|
|
1376
1356
|
throw new Error(`Error reading ${jsonPath}`);
|
|
@@ -1378,20 +1358,20 @@ const getJsonFromPath = (baseDir, fileName) => {
|
|
|
1378
1358
|
};
|
|
1379
1359
|
function getCodemodConfig(codemodPath) {
|
|
1380
1360
|
try {
|
|
1381
|
-
return getJsonFromPath(dirname(codemodPath), "config.json");
|
|
1361
|
+
return getJsonFromPath((0, node_path.dirname)(codemodPath), "config.json");
|
|
1382
1362
|
} catch {
|
|
1383
1363
|
throw new Error(`Error reading codemod config for ${codemodPath}`);
|
|
1384
1364
|
}
|
|
1385
1365
|
}
|
|
1386
1366
|
//#endregion
|
|
1387
1367
|
//#region src/controller/helpers/repository.ts
|
|
1388
|
-
const execAsync = promisify(exec);
|
|
1368
|
+
const execAsync = (0, node_util.promisify)(node_child_process.exec);
|
|
1389
1369
|
/**
|
|
1390
1370
|
* Finds the root of the project by looking for the `.git` directory.
|
|
1391
1371
|
*/
|
|
1392
1372
|
function findProjectRoot() {
|
|
1393
1373
|
try {
|
|
1394
|
-
const gitRoot = execSync("git rev-parse --show-toplevel", {
|
|
1374
|
+
const gitRoot = (0, node_child_process.execSync)("git rev-parse --show-toplevel", {
|
|
1395
1375
|
cwd: process.cwd(),
|
|
1396
1376
|
encoding: "utf8",
|
|
1397
1377
|
stdio: [
|
|
@@ -1400,7 +1380,7 @@ function findProjectRoot() {
|
|
|
1400
1380
|
"ignore"
|
|
1401
1381
|
]
|
|
1402
1382
|
}).trim();
|
|
1403
|
-
return gitRoot && existsSync(gitRoot) ? gitRoot : "";
|
|
1383
|
+
return gitRoot && (0, node_fs.existsSync)(gitRoot) ? gitRoot : "";
|
|
1404
1384
|
} catch {
|
|
1405
1385
|
return "";
|
|
1406
1386
|
}
|
|
@@ -1423,7 +1403,7 @@ async function findPackages() {
|
|
|
1423
1403
|
cwd: findProjectRoot(),
|
|
1424
1404
|
encoding: "utf8"
|
|
1425
1405
|
});
|
|
1426
|
-
const packages = stdout.trim().split("\n").filter(Boolean).map(
|
|
1406
|
+
const packages = stdout.trim().split("\n").filter(Boolean).map(node_path.default.dirname);
|
|
1427
1407
|
if (packages.length === 0) throw new Error();
|
|
1428
1408
|
return packages;
|
|
1429
1409
|
} catch {
|
|
@@ -1474,7 +1454,7 @@ const renderTable = (data, indexHeading = "index") => {
|
|
|
1474
1454
|
};
|
|
1475
1455
|
//#endregion
|
|
1476
1456
|
//#region src/controller/helpers/dependencyChecks.ts
|
|
1477
|
-
var import_semver = /* @__PURE__ */ __toESM(require_semver()
|
|
1457
|
+
var import_semver = /* @__PURE__ */ require_common.__toESM(require_semver());
|
|
1478
1458
|
/**
|
|
1479
1459
|
* Checks if the installed version satisfies the given version requirement.
|
|
1480
1460
|
*/
|
|
@@ -1489,9 +1469,9 @@ function isVersionSatisfied(installedVersion, versionRequirement) {
|
|
|
1489
1469
|
*/
|
|
1490
1470
|
function getVersionFromNodeModules(packagePath, packageName) {
|
|
1491
1471
|
try {
|
|
1492
|
-
const nodeModulesPackageJson = join(packagePath, "node_modules", packageName, "package.json");
|
|
1493
|
-
if (!existsSync(nodeModulesPackageJson)) return "";
|
|
1494
|
-
return JSON.parse(readFileSync(nodeModulesPackageJson, "utf8")).version || "";
|
|
1472
|
+
const nodeModulesPackageJson = (0, node_path.join)(packagePath, "node_modules", packageName, "package.json");
|
|
1473
|
+
if (!(0, node_fs.existsSync)(nodeModulesPackageJson)) return "";
|
|
1474
|
+
return JSON.parse((0, node_fs.readFileSync)(nodeModulesPackageJson, "utf8")).version || "";
|
|
1495
1475
|
} catch {
|
|
1496
1476
|
return "";
|
|
1497
1477
|
}
|
|
@@ -1500,11 +1480,11 @@ function getVersionFromNodeModules(packagePath, packageName) {
|
|
|
1500
1480
|
* Finds the closest package.json by traversing up the directory tree
|
|
1501
1481
|
*/
|
|
1502
1482
|
function findClosestPackageJson(currentPath) {
|
|
1503
|
-
const resolvedPath = resolve(currentPath);
|
|
1483
|
+
const resolvedPath = (0, node_path.resolve)(currentPath);
|
|
1504
1484
|
const projectRoot = findProjectRoot();
|
|
1505
|
-
if (existsSync(join(resolvedPath, "package.json"))) return resolvedPath;
|
|
1485
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(resolvedPath, "package.json"))) return resolvedPath;
|
|
1506
1486
|
if (projectRoot && resolvedPath === projectRoot) return null;
|
|
1507
|
-
const parentPath = dirname(resolvedPath);
|
|
1487
|
+
const parentPath = (0, node_path.dirname)(resolvedPath);
|
|
1508
1488
|
if (parentPath === resolvedPath) return null;
|
|
1509
1489
|
return findClosestPackageJson(parentPath);
|
|
1510
1490
|
}
|
|
@@ -1514,13 +1494,13 @@ function findClosestPackageJson(currentPath) {
|
|
|
1514
1494
|
const assessPrerequisites = (packagePath, codemodPath) => {
|
|
1515
1495
|
try {
|
|
1516
1496
|
const codemodConfig = getCodemodConfig(codemodPath);
|
|
1517
|
-
const resolvedPackagePath = resolve(process.cwd(), packagePath);
|
|
1518
|
-
const actualPackagePath = existsSync(join(resolvedPackagePath, "package.json")) ? resolvedPackagePath : findClosestPackageJson(resolvedPackagePath);
|
|
1497
|
+
const resolvedPackagePath = (0, node_path.resolve)(process.cwd(), packagePath);
|
|
1498
|
+
const actualPackagePath = (0, node_fs.existsSync)((0, node_path.join)(resolvedPackagePath, "package.json")) ? resolvedPackagePath : findClosestPackageJson(resolvedPackagePath);
|
|
1519
1499
|
if (!actualPackagePath) {
|
|
1520
|
-
console.error(`${CONSOLE_ICONS.error} \x1b[1mCould not find a package.json in or above ${packagePath}\x1b[0m`);
|
|
1500
|
+
console.error(`${require_common.CONSOLE_ICONS.error} \x1b[1mCould not find a package.json in or above ${packagePath}\x1b[0m`);
|
|
1521
1501
|
return false;
|
|
1522
1502
|
}
|
|
1523
|
-
if (actualPackagePath !== resolvedPackagePath) console.info(`${CONSOLE_ICONS.info} Using package.json from ${actualPackagePath} for dependency checks`);
|
|
1503
|
+
if (actualPackagePath !== resolvedPackagePath) console.info(`${require_common.CONSOLE_ICONS.info} Using package.json from ${actualPackagePath} for dependency checks`);
|
|
1524
1504
|
const packageJson = getJsonFromPath(actualPackagePath, "package.json");
|
|
1525
1505
|
if (!packageJson) return false;
|
|
1526
1506
|
const { dependencies = {}, peerDependencies = {} } = packageJson;
|
|
@@ -1535,14 +1515,14 @@ const assessPrerequisites = (packagePath, codemodPath) => {
|
|
|
1535
1515
|
isCompliant = false;
|
|
1536
1516
|
comparisons[name] = {
|
|
1537
1517
|
required: versionRequirement,
|
|
1538
|
-
dependencies: isDependencySatisfied ? CONSOLE_ICONS.success : `${CONSOLE_ICONS.error} ${dependencies[name] || "N/A"}`,
|
|
1539
|
-
peerDependencies: isPeerDependencySatisfied ? CONSOLE_ICONS.success : `${CONSOLE_ICONS.error} ${peerDependencies[name] || "N/A"}`,
|
|
1540
|
-
node_modules: isInstalledSatisfied ? CONSOLE_ICONS.success : `${CONSOLE_ICONS.error} ${nodeModulesVersion || "N/A"}`
|
|
1518
|
+
dependencies: isDependencySatisfied ? require_common.CONSOLE_ICONS.success : `${require_common.CONSOLE_ICONS.error} ${dependencies[name] || "N/A"}`,
|
|
1519
|
+
peerDependencies: isPeerDependencySatisfied ? require_common.CONSOLE_ICONS.success : `${require_common.CONSOLE_ICONS.error} ${peerDependencies[name] || "N/A"}`,
|
|
1520
|
+
node_modules: isInstalledSatisfied ? require_common.CONSOLE_ICONS.success : `${require_common.CONSOLE_ICONS.error} ${nodeModulesVersion || "N/A"}`
|
|
1541
1521
|
};
|
|
1542
1522
|
}
|
|
1543
1523
|
});
|
|
1544
1524
|
if (!isCompliant) {
|
|
1545
|
-
console.info(`${CONSOLE_ICONS.error} \x1b[31mPrerequisite check failed -\x1b[0m \x1b[2m${packagePath}\x1b[0m`);
|
|
1525
|
+
console.info(`${require_common.CONSOLE_ICONS.error} \x1b[31mPrerequisite check failed -\x1b[0m \x1b[2m${packagePath}\x1b[0m`);
|
|
1546
1526
|
renderTable(comparisons, "package");
|
|
1547
1527
|
return false;
|
|
1548
1528
|
}
|
|
@@ -1562,8 +1542,8 @@ const assessPrerequisitesBatch = (targetPaths, codemodPath, spinnies) => {
|
|
|
1562
1542
|
const packageRootToTargets = /* @__PURE__ */ new Map();
|
|
1563
1543
|
const failedTargetsNoPackage = [];
|
|
1564
1544
|
for (const target of targetPaths) {
|
|
1565
|
-
const resolved = resolve(process.cwd(), target);
|
|
1566
|
-
const actual = existsSync(join(resolved, "package.json")) ? resolved : findClosestPackageJson(resolved);
|
|
1545
|
+
const resolved = (0, node_path.resolve)(process.cwd(), target);
|
|
1546
|
+
const actual = (0, node_fs.existsSync)((0, node_path.join)(resolved, "package.json")) ? resolved : findClosestPackageJson(resolved);
|
|
1567
1547
|
if (actual) {
|
|
1568
1548
|
const list = packageRootToTargets.get(actual) ?? [];
|
|
1569
1549
|
list.push(target);
|
|
@@ -1633,11 +1613,11 @@ const getDirectoryChoices = (rootPath, currentInput = "", maxDepth = 3) => {
|
|
|
1633
1613
|
const scanDirectory = (dirPath, depth = 0) => {
|
|
1634
1614
|
if (depth >= maxDepth) return;
|
|
1635
1615
|
try {
|
|
1636
|
-
const items = readdirSync(dirPath, { withFileTypes: true });
|
|
1616
|
+
const items = (0, node_fs.readdirSync)(dirPath, { withFileTypes: true });
|
|
1637
1617
|
for (const item of items) if (!item.name.startsWith(".") && !SKIP_DIRS.has(item.name)) {
|
|
1638
1618
|
if (item.isDirectory()) {
|
|
1639
|
-
const fullPath = join(dirPath, item.name);
|
|
1640
|
-
const relativePath = relative(rootPath, fullPath);
|
|
1619
|
+
const fullPath = (0, node_path.join)(dirPath, item.name);
|
|
1620
|
+
const relativePath = (0, node_path.relative)(rootPath, fullPath);
|
|
1641
1621
|
if (relativePath && !relativePath.startsWith("..") && !relativePath.includes("..")) {
|
|
1642
1622
|
choices.add(relativePath);
|
|
1643
1623
|
scanDirectory(fullPath, depth + 1);
|
|
@@ -1661,11 +1641,11 @@ const queryPackages = async (packages) => {
|
|
|
1661
1641
|
const message = "Path to run codemod on:";
|
|
1662
1642
|
const nonRootPackages = packages.filter((pkg) => pkg !== "." && pkg !== "./");
|
|
1663
1643
|
if (packages.length === 1 && (packages[0] === "." || packages[0] === "./")) {
|
|
1664
|
-
if (await confirm({
|
|
1644
|
+
if (await (0, _inquirer_prompts.confirm)({
|
|
1665
1645
|
message: "Do you want to target a specific folder instead of the entire project?",
|
|
1666
1646
|
default: false
|
|
1667
1647
|
})) {
|
|
1668
|
-
const customPath = await search({
|
|
1648
|
+
const customPath = await (0, _inquirer_prompts.search)({
|
|
1669
1649
|
message: "Enter the folder path (relative to project root):",
|
|
1670
1650
|
source: async (searchInput) => {
|
|
1671
1651
|
return getDirectoryChoices(process.cwd(), searchInput || "").map((choice) => ({
|
|
@@ -1676,9 +1656,9 @@ const queryPackages = async (packages) => {
|
|
|
1676
1656
|
},
|
|
1677
1657
|
validate: (path) => {
|
|
1678
1658
|
if (!path?.trim()) return "Path cannot be empty";
|
|
1679
|
-
const fullPath = join(process.cwd(), path);
|
|
1680
|
-
if (!existsSync(fullPath)) return "Folder does not exist";
|
|
1681
|
-
if (!statSync(fullPath).isDirectory()) return "Path must be a directory";
|
|
1659
|
+
const fullPath = (0, node_path.join)(process.cwd(), path);
|
|
1660
|
+
if (!(0, node_fs.existsSync)(fullPath)) return "Folder does not exist";
|
|
1661
|
+
if (!(0, node_fs.statSync)(fullPath).isDirectory()) return "Path must be a directory";
|
|
1682
1662
|
return true;
|
|
1683
1663
|
}
|
|
1684
1664
|
});
|
|
@@ -1688,7 +1668,7 @@ const queryPackages = async (packages) => {
|
|
|
1688
1668
|
logToInquirer(message, packages[0] === "./" ? "." : packages[0]);
|
|
1689
1669
|
return [packages[0] === "./" ? "." : packages[0]];
|
|
1690
1670
|
}
|
|
1691
|
-
if (nonRootPackages.length >= 1) return checkbox({
|
|
1671
|
+
if (nonRootPackages.length >= 1) return (0, _inquirer_prompts.checkbox)({
|
|
1692
1672
|
required: true,
|
|
1693
1673
|
message: "Select packages to transform:",
|
|
1694
1674
|
choices: nonRootPackages.map((file) => ({
|
|
@@ -1708,7 +1688,7 @@ const determineTransformer = async ({ candidate, transformFiles }) => {
|
|
|
1708
1688
|
logToInquirer(codemodMessage, candidate);
|
|
1709
1689
|
return candidate;
|
|
1710
1690
|
}
|
|
1711
|
-
return select({
|
|
1691
|
+
return (0, _inquirer_prompts.select)({
|
|
1712
1692
|
message: codemodMessage,
|
|
1713
1693
|
choices: transformFiles.map((file) => ({
|
|
1714
1694
|
name: file,
|
|
@@ -1721,7 +1701,7 @@ const determineTransformer = async ({ candidate, transformFiles }) => {
|
|
|
1721
1701
|
*/
|
|
1722
1702
|
const determinePaths = async ({ candidate, root, packages }) => {
|
|
1723
1703
|
const targetPaths = [];
|
|
1724
|
-
if (candidate && existsSync(join(root, candidate))) {
|
|
1704
|
+
if (candidate && (0, node_fs.existsSync)((0, node_path.join)(root, candidate))) {
|
|
1725
1705
|
logToInquirer("Path to run codemod on", candidate);
|
|
1726
1706
|
targetPaths.push(candidate);
|
|
1727
1707
|
}
|
|
@@ -1740,7 +1720,7 @@ const determineIsDryMode = async (args) => {
|
|
|
1740
1720
|
logToInquirer(message, "Yes");
|
|
1741
1721
|
return true;
|
|
1742
1722
|
}
|
|
1743
|
-
return confirm({
|
|
1723
|
+
return (0, _inquirer_prompts.confirm)({
|
|
1744
1724
|
message,
|
|
1745
1725
|
default: false
|
|
1746
1726
|
});
|
|
@@ -1754,7 +1734,7 @@ const determineIsPrint = async (args) => {
|
|
|
1754
1734
|
logToInquirer(message, "Yes");
|
|
1755
1735
|
return true;
|
|
1756
1736
|
}
|
|
1757
|
-
return confirm({
|
|
1737
|
+
return (0, _inquirer_prompts.confirm)({
|
|
1758
1738
|
message,
|
|
1759
1739
|
default: false
|
|
1760
1740
|
});
|
|
@@ -1772,7 +1752,7 @@ const determineIgnorePatterns = async (args) => {
|
|
|
1772
1752
|
if (ignorePattern) {
|
|
1773
1753
|
logToInquirer(message, ignorePattern);
|
|
1774
1754
|
userPatterns = ignorePattern;
|
|
1775
|
-
} else userPatterns = await input({
|
|
1755
|
+
} else userPatterns = await (0, _inquirer_prompts.input)({
|
|
1776
1756
|
message,
|
|
1777
1757
|
validate: () => true
|
|
1778
1758
|
});
|
|
@@ -1793,7 +1773,7 @@ const determineGitIgnore = async (args) => {
|
|
|
1793
1773
|
logToInquirer(message, "No");
|
|
1794
1774
|
return false;
|
|
1795
1775
|
}
|
|
1796
|
-
return confirm({
|
|
1776
|
+
return (0, _inquirer_prompts.confirm)({
|
|
1797
1777
|
message,
|
|
1798
1778
|
default: true
|
|
1799
1779
|
});
|
|
@@ -1821,12 +1801,12 @@ async function getOptions({ transformFiles, transformerType, packages, root, pre
|
|
|
1821
1801
|
//#region src/controller/helpers/loadTransformModules.ts
|
|
1822
1802
|
async function loadTransformModules(transformsDir) {
|
|
1823
1803
|
let transformModules = {};
|
|
1824
|
-
const transformers = await promises.readdir(transformsDir);
|
|
1804
|
+
const transformers = await node_fs.promises.readdir(transformsDir);
|
|
1825
1805
|
const transformFiles = await Promise.all(transformers.map(async (name) => {
|
|
1826
|
-
const transformModule = await import(
|
|
1806
|
+
const transformModule = await import(node_path.default.join(transformsDir, name, "transformer.js"));
|
|
1827
1807
|
transformModules = {
|
|
1828
1808
|
...transformModules,
|
|
1829
|
-
[name]: transformModule.default
|
|
1809
|
+
[name]: transformModule.default.default
|
|
1830
1810
|
};
|
|
1831
1811
|
return name;
|
|
1832
1812
|
}));
|
|
@@ -1837,30 +1817,30 @@ async function loadTransformModules(transformsDir) {
|
|
|
1837
1817
|
}
|
|
1838
1818
|
//#endregion
|
|
1839
1819
|
//#region src/controller/helpers/reportManualReview.ts
|
|
1840
|
-
const REPORT_PATH =
|
|
1820
|
+
const REPORT_PATH = node_path.default.resolve(process.cwd(), "codemod-report.txt");
|
|
1841
1821
|
const reportManualReview = async (filePath, message) => {
|
|
1842
1822
|
const lineNumber = /at line (\d+)/u.exec(message)?.[1];
|
|
1843
1823
|
const cleanMessage = message.replace(/ at line \d+/u, "");
|
|
1844
1824
|
const lineInfo = lineNumber ? `:${lineNumber}` : "";
|
|
1845
1825
|
try {
|
|
1846
|
-
await
|
|
1847
|
-
(await
|
|
1826
|
+
await node_fs_promises.default.access(REPORT_PATH);
|
|
1827
|
+
(await node_fs_promises.default.readFile(REPORT_PATH, "utf8")).trim();
|
|
1848
1828
|
} catch {}
|
|
1849
1829
|
const args = process.argv;
|
|
1850
1830
|
const transformIndex = args.findIndex((arg) => arg.endsWith("transformer.js"));
|
|
1851
1831
|
if (transformIndex >= 0) {
|
|
1852
1832
|
const transformPath = args[transformIndex];
|
|
1853
|
-
const transformDir =
|
|
1854
|
-
|
|
1833
|
+
const transformDir = node_path.default.dirname(transformPath);
|
|
1834
|
+
node_path.default.basename(transformDir);
|
|
1855
1835
|
}
|
|
1856
1836
|
const content = `[${filePath}${lineInfo}] ${cleanMessage}\n`;
|
|
1857
|
-
await
|
|
1837
|
+
await node_fs_promises.default.appendFile(REPORT_PATH, content, "utf8");
|
|
1858
1838
|
};
|
|
1859
1839
|
//#endregion
|
|
1860
1840
|
//#region src/controller/helpers/runTransformPrompts.ts
|
|
1861
1841
|
async function askPrompt(p) {
|
|
1862
1842
|
switch (p.type) {
|
|
1863
|
-
case "select": return select({
|
|
1843
|
+
case "select": return (0, _inquirer_prompts.select)({
|
|
1864
1844
|
message: p.message,
|
|
1865
1845
|
choices: (p.choices ?? []).map((c) => ({
|
|
1866
1846
|
name: c.name,
|
|
@@ -1868,11 +1848,11 @@ async function askPrompt(p) {
|
|
|
1868
1848
|
})),
|
|
1869
1849
|
default: p.default
|
|
1870
1850
|
});
|
|
1871
|
-
case "confirm": return confirm({
|
|
1851
|
+
case "confirm": return (0, _inquirer_prompts.confirm)({
|
|
1872
1852
|
message: p.message,
|
|
1873
1853
|
default: typeof p.default === "boolean" ? p.default : false
|
|
1874
1854
|
});
|
|
1875
|
-
default: return input({
|
|
1855
|
+
default: return (0, _inquirer_prompts.input)({
|
|
1876
1856
|
message: p.message,
|
|
1877
1857
|
default: p.default ?? ""
|
|
1878
1858
|
});
|
|
@@ -1897,10 +1877,75 @@ async function runTransformPrompts(codemodPath) {
|
|
|
1897
1877
|
//#region src/controller/helpers/validateClaudeConfig.ts
|
|
1898
1878
|
const CLAUDE_SETTINGS_FILE = ".claude/settings.json";
|
|
1899
1879
|
function validateClaudeConfig() {
|
|
1900
|
-
const claudeSettingsPath =
|
|
1901
|
-
if (!
|
|
1880
|
+
const claudeSettingsPath = node_path.default.resolve(process.env.HOME || "", CLAUDE_SETTINGS_FILE);
|
|
1881
|
+
if (!node_fs.default.existsSync(claudeSettingsPath)) throw new Error(`${require_common.CONSOLE_ICONS.error} Claude Code is not configured. Expected settings file at: ${claudeSettingsPath}. Please follow the setup instructions:\n https://transferwise.atlassian.net/wiki/spaces/GenAIP/pages/3709765113/Configuring+Claude+Code\n`);
|
|
1902
1882
|
}
|
|
1903
1883
|
//#endregion
|
|
1904
|
-
|
|
1884
|
+
Object.defineProperty(exports, "assessPrerequisites", {
|
|
1885
|
+
enumerable: true,
|
|
1886
|
+
get: function() {
|
|
1887
|
+
return assessPrerequisites;
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
Object.defineProperty(exports, "assessPrerequisitesBatch", {
|
|
1891
|
+
enumerable: true,
|
|
1892
|
+
get: function() {
|
|
1893
|
+
return assessPrerequisitesBatch;
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
Object.defineProperty(exports, "findPackages", {
|
|
1897
|
+
enumerable: true,
|
|
1898
|
+
get: function() {
|
|
1899
|
+
return findPackages;
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1902
|
+
Object.defineProperty(exports, "findProjectRoot", {
|
|
1903
|
+
enumerable: true,
|
|
1904
|
+
get: function() {
|
|
1905
|
+
return findProjectRoot;
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
Object.defineProperty(exports, "getCodemodConfig", {
|
|
1909
|
+
enumerable: true,
|
|
1910
|
+
get: function() {
|
|
1911
|
+
return getCodemodConfig;
|
|
1912
|
+
}
|
|
1913
|
+
});
|
|
1914
|
+
Object.defineProperty(exports, "getOptions", {
|
|
1915
|
+
enumerable: true,
|
|
1916
|
+
get: function() {
|
|
1917
|
+
return getOptions;
|
|
1918
|
+
}
|
|
1919
|
+
});
|
|
1920
|
+
Object.defineProperty(exports, "loadTransformModules", {
|
|
1921
|
+
enumerable: true,
|
|
1922
|
+
get: function() {
|
|
1923
|
+
return loadTransformModules;
|
|
1924
|
+
}
|
|
1925
|
+
});
|
|
1926
|
+
Object.defineProperty(exports, "logToInquirer", {
|
|
1927
|
+
enumerable: true,
|
|
1928
|
+
get: function() {
|
|
1929
|
+
return logToInquirer;
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1932
|
+
Object.defineProperty(exports, "reportManualReview", {
|
|
1933
|
+
enumerable: true,
|
|
1934
|
+
get: function() {
|
|
1935
|
+
return reportManualReview;
|
|
1936
|
+
}
|
|
1937
|
+
});
|
|
1938
|
+
Object.defineProperty(exports, "runTransformPrompts", {
|
|
1939
|
+
enumerable: true,
|
|
1940
|
+
get: function() {
|
|
1941
|
+
return runTransformPrompts;
|
|
1942
|
+
}
|
|
1943
|
+
});
|
|
1944
|
+
Object.defineProperty(exports, "validateClaudeConfig", {
|
|
1945
|
+
enumerable: true,
|
|
1946
|
+
get: function() {
|
|
1947
|
+
return validateClaudeConfig;
|
|
1948
|
+
}
|
|
1949
|
+
});
|
|
1905
1950
|
|
|
1906
|
-
//# sourceMappingURL=helpers-
|
|
1951
|
+
//# sourceMappingURL=helpers-Co55RkBl.js.map
|