@wise/wds-codemods 1.2.1 → 1.3.0-experimental-d90ea76
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/README.md +2 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -1
- package/package.json +20 -17
package/README.md
CHANGED
|
@@ -105,6 +105,8 @@ All codemods support these command-line options:
|
|
|
105
105
|
| `--print` | Print transformed source to console |
|
|
106
106
|
| `--ignore-pattern=GLOB` | Ignore files matching [glob pattern(s)](https://code.visualstudio.com/docs/editor/glob-patterns) (comma-separated) |
|
|
107
107
|
| `--monorepo` | Enable monorepo package checking across workspace folders |
|
|
108
|
+
| `--no-tracking` | Disable Mixpanel usage tracking for the run |
|
|
109
|
+
| `--debug` | Log tracked events to console (works independently of `--no-tracking`) |
|
|
108
110
|
|
|
109
111
|
Only jscodeshift engine supports the following options (.gitignore is always respected with AI Engine):
|
|
110
112
|
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,44 @@ import path from "node:path";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { select } from "@inquirer/prompts";
|
|
9
9
|
import Spinnies from "spinnies";
|
|
10
|
+
import Mixpanel from "mixpanel";
|
|
11
|
+
//#region src/helpers/tracking/index.ts
|
|
12
|
+
const MIXPANEL_TOKEN = "8ba4a7a5182f05e0a79ded57d5d2f051";
|
|
13
|
+
let client = null;
|
|
14
|
+
const getClient = () => {
|
|
15
|
+
client ??= Mixpanel.init(MIXPANEL_TOKEN, { geolocate: false });
|
|
16
|
+
return client;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Maps internal camelCase properties to Wise Mixpanel naming conventions:
|
|
20
|
+
* - Spaces between words, each word capitalized
|
|
21
|
+
* - Booleans prefixed with "Is"
|
|
22
|
+
* - Counts use "Number Of"
|
|
23
|
+
* - Duration in seconds (not ms)
|
|
24
|
+
*/
|
|
25
|
+
const toMixpanelProperties = (properties) => ({
|
|
26
|
+
Transform: properties.transform,
|
|
27
|
+
Stage: properties.stage,
|
|
28
|
+
Engine: properties.engine,
|
|
29
|
+
Repository: properties.repository,
|
|
30
|
+
Error: properties.error,
|
|
31
|
+
Duration: properties.durationMs / 1e3
|
|
32
|
+
});
|
|
33
|
+
const TRACKING_EVENT = "WDS - Codemod";
|
|
34
|
+
/**
|
|
35
|
+
* Fire-and-forget event tracking. Never throws — failures are silently ignored
|
|
36
|
+
* so tracking never interferes with the CLI experience.
|
|
37
|
+
*/
|
|
38
|
+
const track = (event, properties, debug = false) => {
|
|
39
|
+
try {
|
|
40
|
+
const mapped = toMixpanelProperties(properties);
|
|
41
|
+
if (debug) console.debug(`${CONSOLE_ICONS.info} [Mixpanel] ${event}`, JSON.stringify(mapped, null, 2));
|
|
42
|
+
const mp = getClient();
|
|
43
|
+
if (!mp) return;
|
|
44
|
+
mp.track(event, { ...mapped });
|
|
45
|
+
} catch {}
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
10
48
|
//#region src/controller/helpers/claudePrereqs.ts
|
|
11
49
|
function handleClaudePrereqs({ options, codemodPath, spinners }) {
|
|
12
50
|
spinners.add("prerequisite-check", { text: "Checking prerequisites..." });
|
|
@@ -33,6 +71,7 @@ function handleClaudePrereqs({ options, codemodPath, spinners }) {
|
|
|
33
71
|
});
|
|
34
72
|
spinners.stopAll("fail");
|
|
35
73
|
spinners.checkIfActiveSpinners();
|
|
74
|
+
throw new Error("No valid target paths remaining after prerequisite checks");
|
|
36
75
|
}
|
|
37
76
|
}
|
|
38
77
|
//#endregion
|
|
@@ -66,8 +105,15 @@ async function runCodemod(transformsDir) {
|
|
|
66
105
|
const args = process.argv.slice(2);
|
|
67
106
|
const candidate = args[0];
|
|
68
107
|
isDebug = args.includes("--debug");
|
|
108
|
+
const startTime = Date.now();
|
|
109
|
+
let repository = "unknown";
|
|
110
|
+
let trackingProps = {
|
|
111
|
+
transform: candidate,
|
|
112
|
+
repository
|
|
113
|
+
};
|
|
69
114
|
try {
|
|
70
115
|
const root = findProjectRoot();
|
|
116
|
+
repository = path.basename(root);
|
|
71
117
|
const packagesPromise = findPackages();
|
|
72
118
|
const resolvedTransformsDir = transformsDir ?? path.resolve(currentDirPath, "../dist/transforms");
|
|
73
119
|
if (isDebug) console.debug(`${CONSOLE_ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`);
|
|
@@ -105,6 +151,11 @@ async function runCodemod(transformsDir) {
|
|
|
105
151
|
preselectedTransformFile: transformFile,
|
|
106
152
|
transformerType: codemodConfig?.type
|
|
107
153
|
});
|
|
154
|
+
trackingProps = {
|
|
155
|
+
transform: transformFile,
|
|
156
|
+
engine: codemodConfig?.type,
|
|
157
|
+
repository
|
|
158
|
+
};
|
|
108
159
|
if (codemodConfig?.type === "claude") {
|
|
109
160
|
handleClaudePrereqs({
|
|
110
161
|
options,
|
|
@@ -116,6 +167,7 @@ async function runCodemod(transformsDir) {
|
|
|
116
167
|
} else {
|
|
117
168
|
spinners.stopAll("succeed");
|
|
118
169
|
spinners.checkIfActiveSpinners();
|
|
170
|
+
let runAny = false;
|
|
119
171
|
await Promise.all(options.targetPaths.map(async (targetPath) => {
|
|
120
172
|
console.info(`${CONSOLE_ICONS.focus} \x1b[1mProcessing:\x1b[0m \x1b[32m${targetPath}\x1b[0m`);
|
|
121
173
|
if (!assessPrerequisites(targetPath, codemodPath)) return;
|
|
@@ -131,13 +183,26 @@ async function runCodemod(transformsDir) {
|
|
|
131
183
|
...answerArgs
|
|
132
184
|
].filter(Boolean).join(" ")}`;
|
|
133
185
|
if (isDebug) console.debug(`${CONSOLE_ICONS.info} Running: ${command}`);
|
|
186
|
+
runAny = true;
|
|
134
187
|
return execSync(command, { stdio: "inherit" });
|
|
135
188
|
}));
|
|
189
|
+
if (!runAny) throw new Error("No valid target paths remaining after prerequisite checks");
|
|
136
190
|
}
|
|
137
191
|
if (codemodConfig?.type === "jscodeshift") await summariseReportFile(reportPath);
|
|
192
|
+
track(TRACKING_EVENT, {
|
|
193
|
+
...trackingProps,
|
|
194
|
+
stage: "Success",
|
|
195
|
+
durationMs: Date.now() - startTime
|
|
196
|
+
}, isDebug);
|
|
138
197
|
} catch (error) {
|
|
139
198
|
if (error instanceof Error) console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);
|
|
140
199
|
else console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, String(error));
|
|
200
|
+
track(TRACKING_EVENT, {
|
|
201
|
+
...trackingProps,
|
|
202
|
+
stage: "Failed",
|
|
203
|
+
error: error instanceof Error ? error.message : String(error),
|
|
204
|
+
durationMs: Date.now() - startTime
|
|
205
|
+
}, isDebug);
|
|
141
206
|
if (process.env.NODE_ENV !== "test") process.exit(1);
|
|
142
207
|
}
|
|
143
208
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["list"],"sources":["../src/controller/helpers/claudePrereqs.ts","../src/controller/index.ts","../src/index.ts"],"sourcesContent":["import type Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../../constants/common';\nimport type { CodemodOptions } from '../types';\nimport { assessPrerequisitesBatch } from './dependencyChecks';\n\ninterface ClaudePrereqHandlerOptions {\n options: CodemodOptions;\n spinners: Spinnies;\n codemodPath: string;\n}\n\nexport function handleClaudePrereqs({\n options,\n codemodPath,\n spinners,\n}: ClaudePrereqHandlerOptions) {\n spinners.add('prerequisite-check', { text: 'Checking prerequisites...' });\n // Fail-fast: check prerequisites for all target paths up-front\n const { allPassed, packageRootToTargets, failedPackageRoots } = assessPrerequisitesBatch(\n options.targetPaths,\n codemodPath,\n spinners,\n );\n if (!allPassed) {\n spinners.add('prerequisite-partial-failure', {\n text: 'One or more packages failed prerequisite checks - these targets will be skipped:',\n status: 'fail',\n });\n\n for (const failedRoot of failedPackageRoots) {\n const targets = packageRootToTargets.get(failedRoot) ?? [];\n // Filter out targets that belong to failed package roots\n // eslint-disable-next-line no-param-reassign\n options.targetPaths = options.targetPaths.filter(\n (targetPath) => !targets.includes(targetPath),\n );\n spinners.add(`prerequisite-fail-${failedRoot}`, {\n text: `- \\x1b[2m\\x1b[31m${failedRoot}\\x1b[0m${targets.length > 0 && targets[0] !== failedRoot ? ` (targets: ${targets.join(', ')})` : ''}\\x1b[0m`,\n indent: 2,\n status: 'non-spinnable',\n });\n }\n }\n\n if (!options.targetPaths.length) {\n spinners.add('no-valid-targets', {\n text: `${CONSOLE_ICONS.error} No valid target paths remaining after prerequisite checks - exiting.`,\n status: 'fail',\n });\n spinners.stopAll('fail');\n spinners.checkIfActiveSpinners();\n }\n}\n","#!/usr/bin/env node\n\nimport { execSync } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { select as list } from '@inquirer/prompts';\nimport Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../constants/common';\nimport {\n assessPrerequisites,\n findPackages,\n findProjectRoot,\n getCodemodConfig,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n validateClaudeConfig,\n} from './helpers';\nimport { handleClaudePrereqs } from './helpers/claudePrereqs';\n\nlet isDebug = false;\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentDirPath = path.dirname(currentFilePath);\n\nconst resetReportFile = async (reportPath: string) => {\n try {\n await fs.access(reportPath);\n await fs.rm(reportPath);\n console.debug(\n `${CONSOLE_ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : '.'}`,\n );\n } catch {\n console.debug(\n `${CONSOLE_ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n};\n\nconst summariseReportFile = async (reportPath: string) => {\n try {\n const reportContent = await fs.readFile(reportPath, 'utf8');\n const lines = reportContent.split('\\n').filter(Boolean);\n if (lines.length) {\n console.debug(\n `\\n${CONSOLE_ICONS.warning} ${lines.length} manual review${lines.length > 1 ? 's are' : ' is'} required. See ${reportPath} for details.`,\n );\n } else {\n console.debug(\n `${CONSOLE_ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n } catch {\n console.debug(`${CONSOLE_ICONS.info} No report file generated - no manual reviews needed`);\n }\n};\n\nconst log = (label: string, value?: string): void => {\n if (typeof logToInquirer === 'function') {\n logToInquirer(label, value || '');\n } else {\n console.info(label, value || '');\n }\n};\n\nasync function runCodemod(transformsDir?: string) {\n const args = process.argv.slice(2);\n const candidate = args[0];\n isDebug = args.includes('--debug');\n\n try {\n const root = findProjectRoot();\n const packagesPromise = findPackages();\n const resolvedTransformsDir =\n transformsDir ?? path.resolve(currentDirPath, '../dist/transforms');\n\n if (isDebug) {\n console.debug(\n `${CONSOLE_ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`,\n );\n }\n\n const { transformFiles: resolvedTransformNames } =\n await loadTransformModules(resolvedTransformsDir);\n if (resolvedTransformNames.length === 0) {\n throw new Error(\n `${CONSOLE_ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : '.'}`,\n );\n }\n\n let transformFile: string;\n\n if (candidate && resolvedTransformNames.includes(candidate)) {\n log('Select codemod to run:', candidate);\n transformFile = candidate;\n } else {\n transformFile = await list({\n message: 'Select codemod to run:',\n choices: resolvedTransformNames.map((name: string) => ({ name, value: name })),\n });\n log('Selected codemod:', transformFile);\n }\n\n const codemodPath = path.resolve(resolvedTransformsDir, transformFile, 'transformer.js');\n const codemodConfig = getCodemodConfig(codemodPath);\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Resolved codemod path: ${codemodPath}`);\n }\n\n if (codemodConfig?.type === 'claude') {\n validateClaudeConfig();\n }\n\n const spinners = new Spinnies();\n spinners.add('loading-codemod', { text: `Loading codemod (${transformFile})...` });\n const packages = await packagesPromise;\n const reportPath = path.resolve(root, 'codemod-report.txt');\n spinners.succeed('loading-codemod', {\n text: `Successfully loaded codemod: \\x1b[2m${transformFile}\\x1b[0m`,\n });\n\n if (codemodConfig?.type === 'jscodeshift') {\n await resetReportFile(reportPath);\n }\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n const options = await getOptions({\n packages,\n root,\n transformFiles: resolvedTransformNames,\n preselectedTransformFile: transformFile,\n transformerType: codemodConfig?.type,\n });\n\n // Handle Claude transforms differently, as they work on multiple targets at once\n if (codemodConfig?.type === 'claude') {\n handleClaudePrereqs({ options, codemodPath, spinners });\n\n // Dynamically import the transformer module\n const transformerModule = (await import(codemodPath)) as {\n default: (targetPaths: string[], isDebug?: boolean) => Promise<void>;\n };\n const transformer = transformerModule.default;\n await transformer(options.targetPaths, isDebug);\n } else {\n // Button codemod doesn't use spinnies\n spinners.stopAll('succeed');\n spinners.checkIfActiveSpinners();\n\n await Promise.all(\n options.targetPaths.map(async (targetPath) => {\n console.info(\n `${CONSOLE_ICONS.focus} \\x1b[1mProcessing:\\x1b[0m \\x1b[32m${targetPath}\\x1b[0m`,\n );\n\n // Check prerequisites for this target before running\n const ok = assessPrerequisites(targetPath, codemodPath);\n if (!ok) {\n return;\n }\n\n const answerArgs = Object.entries(promptAnswers).map(\n ([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`,\n );\n\n const argsList = [\n '-t',\n codemodPath,\n targetPath,\n options.isDry ? '--dry' : '',\n options.isPrint ? '--print' : '',\n options.ignorePatterns\n ? options.ignorePatterns\n .split(',')\n .map((pattern) => `--ignore-pattern=${pattern.trim()}`)\n .join(' ')\n : '',\n options.useGitIgnore ? '--gitignore' : '',\n ...answerArgs,\n ].filter(Boolean);\n const command = `npx jscodeshift ${argsList.join(' ')}`;\n\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Running: ${command}`);\n }\n\n return execSync(command, { stdio: 'inherit' });\n }),\n );\n }\n\n if (codemodConfig?.type === 'jscodeshift') {\n await summariseReportFile(reportPath);\n }\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);\n } else {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, String(error));\n }\n if (process.env.NODE_ENV !== 'test') {\n process.exit(1);\n }\n }\n}\n\nexport { runCodemod };\n","#!/usr/bin/env node\nimport { runCodemod } from './controller';\n\nvoid runCodemod();\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,oBAAoB,EAClC,SACA,aACA,YAC6B;AAC7B,UAAS,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;CAEzE,MAAM,EAAE,WAAW,sBAAsB,uBAAuB,yBAC9D,QAAQ,aACR,aACA,SACD;AACD,KAAI,CAAC,WAAW;AACd,WAAS,IAAI,gCAAgC;GAC3C,MAAM;GACN,QAAQ;GACT,CAAC;AAEF,OAAK,MAAM,cAAc,oBAAoB;GAC3C,MAAM,UAAU,qBAAqB,IAAI,WAAW,IAAI,EAAE;AAG1D,WAAQ,cAAc,QAAQ,YAAY,QACvC,eAAe,CAAC,QAAQ,SAAS,WAAW,CAC9C;AACD,YAAS,IAAI,qBAAqB,cAAc;IAC9C,MAAM,oBAAoB,WAAW,SAAS,QAAQ,SAAS,KAAK,QAAQ,OAAO,aAAa,cAAc,QAAQ,KAAK,KAAK,CAAC,KAAK,GAAG;IACzI,QAAQ;IACR,QAAQ;IACT,CAAC;;;AAIN,KAAI,CAAC,QAAQ,YAAY,QAAQ;AAC/B,WAAS,IAAI,oBAAoB;GAC/B,MAAM,GAAG,cAAc,MAAM;GAC7B,QAAQ;GACT,CAAC;AACF,WAAS,QAAQ,OAAO;AACxB,WAAS,uBAAuB;;;;;AC3BpC,IAAI,UAAU;AACd,MAAM,kBAAkB,cAAc,OAAO,KAAK,IAAI;AACtD,MAAM,iBAAiB,KAAK,QAAQ,gBAAgB;AAEpD,MAAM,kBAAkB,OAAO,eAAuB;AACpD,KAAI;AACF,QAAM,GAAG,OAAO,WAAW;AAC3B,QAAM,GAAG,GAAG,WAAW;AACvB,UAAQ,MACN,GAAG,cAAc,KAAK,+BAA+B,UAAU,KAAK,eAAe,MACpF;SACK;AACN,UAAQ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AQ,UAAU,YAAY;KAC9B,QAAQ,iBACJ,QAAQ,eACL,MAAM,IAAI,CACV,KAAK,YAAY,oBAAoB,QAAQ,MAAM,GAAG,CACtD,KAAK,IAAI,GACZ;KACJ,QAAQ,eAAe,gBAAgB;KACvC,GAAG;KACJ,CAAC,OAAO,QAAQ,CAC2B,KAAK,IAAI;AAErD,QAAI,QACF,SAAQ,MAAM,GAAG,cAAc,KAAK,YAAY,UAAU;AAG5D,WAAO,SAAS,SAAS,EAAE,OAAO,WAAW,CAAC;KAC9C,CACH;;AAGH,MAAI,eAAe,SAAS,cAC1B,OAAM,oBAAoB,WAAW;UAEhC,OAAgB;AACvB,MAAI,iBAAiB,MACnB,SAAQ,MAAM,GAAG,cAAc,MAAM,iBAAiB,UAAU,YAAY,MAAM,QAAQ;MAE1F,SAAQ,MAAM,GAAG,cAAc,MAAM,iBAAiB,UAAU,YAAY,OAAO,MAAM,CAAC;AAE5F,MAAI,QAAQ,IAAI,aAAa,OAC3B,SAAQ,KAAK,EAAE;;;;;ACzMhB,YAAY"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["list"],"sources":["../src/helpers/tracking/index.ts","../src/controller/helpers/claudePrereqs.ts","../src/controller/index.ts","../src/index.ts"],"sourcesContent":["import Mixpanel from 'mixpanel';\n\nimport { CONSOLE_ICONS } from '../../constants/common';\n\nconst MIXPANEL_TOKEN = process.env.MIXPANEL_TOKEN ?? '';\n\nlet client: Mixpanel.Mixpanel | null = null;\n\nconst getClient = (): Mixpanel.Mixpanel | null => {\n if (!MIXPANEL_TOKEN) return null;\n client ??= Mixpanel.init(MIXPANEL_TOKEN, {\n geolocate: false,\n });\n return client;\n};\n\nexport interface TrackingProperties {\n transform: string;\n stage: 'Success' | 'Failed';\n engine?: 'jscodeshift' | 'claude';\n repository: string;\n error?: string;\n durationMs: number;\n}\n\n/**\n * Maps internal camelCase properties to Wise Mixpanel naming conventions:\n * - Spaces between words, each word capitalized\n * - Booleans prefixed with \"Is\"\n * - Counts use \"Number Of\"\n * - Duration in seconds (not ms)\n */\nconst toMixpanelProperties = (\n properties: TrackingProperties,\n): Record<string, string | number | boolean | undefined> => ({\n Transform: properties.transform,\n Stage: properties.stage,\n Engine: properties.engine,\n Repository: properties.repository,\n Error: properties.error,\n Duration: properties.durationMs / 1000,\n});\n\nexport const TRACKING_EVENT = 'WDS - Codemod' as const;\n\n/**\n * Fire-and-forget event tracking. Never throws — failures are silently ignored\n * so tracking never interferes with the CLI experience.\n */\nexport const track = (event: string, properties: TrackingProperties, debug = false): void => {\n try {\n const mapped = toMixpanelProperties(properties);\n\n if (debug) {\n console.debug(`${CONSOLE_ICONS.info} [Mixpanel] ${event}`, JSON.stringify(mapped, null, 2));\n }\n\n const mp = getClient();\n if (!mp) return;\n\n mp.track(event, {\n ...mapped,\n });\n } catch {\n // Intentionally swallowed — tracking must never break the CLI\n }\n};\n","import type Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../../constants/common';\nimport type { CodemodOptions } from '../types';\nimport { assessPrerequisitesBatch } from './dependencyChecks';\n\ninterface ClaudePrereqHandlerOptions {\n options: CodemodOptions;\n spinners: Spinnies;\n codemodPath: string;\n}\n\nexport function handleClaudePrereqs({\n options,\n codemodPath,\n spinners,\n}: ClaudePrereqHandlerOptions) {\n spinners.add('prerequisite-check', { text: 'Checking prerequisites...' });\n // Fail-fast: check prerequisites for all target paths up-front\n const { allPassed, packageRootToTargets, failedPackageRoots } = assessPrerequisitesBatch(\n options.targetPaths,\n codemodPath,\n spinners,\n );\n if (!allPassed) {\n spinners.add('prerequisite-partial-failure', {\n text: 'One or more packages failed prerequisite checks - these targets will be skipped:',\n status: 'fail',\n });\n\n for (const failedRoot of failedPackageRoots) {\n const targets = packageRootToTargets.get(failedRoot) ?? [];\n // Filter out targets that belong to failed package roots\n // eslint-disable-next-line no-param-reassign\n options.targetPaths = options.targetPaths.filter(\n (targetPath) => !targets.includes(targetPath),\n );\n spinners.add(`prerequisite-fail-${failedRoot}`, {\n text: `- \\x1b[2m\\x1b[31m${failedRoot}\\x1b[0m${targets.length > 0 && targets[0] !== failedRoot ? ` (targets: ${targets.join(', ')})` : ''}\\x1b[0m`,\n indent: 2,\n status: 'non-spinnable',\n });\n }\n }\n\n if (!options.targetPaths.length) {\n spinners.add('no-valid-targets', {\n text: `${CONSOLE_ICONS.error} No valid target paths remaining after prerequisite checks - exiting.`,\n status: 'fail',\n });\n spinners.stopAll('fail');\n spinners.checkIfActiveSpinners();\n throw new Error('No valid target paths remaining after prerequisite checks');\n }\n}\n","#!/usr/bin/env node\n\nimport { execSync } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport { select as list } from '@inquirer/prompts';\nimport Spinnies from 'spinnies';\n\nimport { CONSOLE_ICONS } from '../constants/common';\nimport { track, TRACKING_EVENT, type TrackingProperties } from '../helpers/tracking';\nimport {\n assessPrerequisites,\n findPackages,\n findProjectRoot,\n getCodemodConfig,\n getOptions,\n loadTransformModules,\n logToInquirer,\n runTransformPrompts,\n validateClaudeConfig,\n} from './helpers';\nimport { handleClaudePrereqs } from './helpers/claudePrereqs';\n\nlet isDebug = false;\nconst currentFilePath = fileURLToPath(import.meta.url);\nconst currentDirPath = path.dirname(currentFilePath);\n\nconst resetReportFile = async (reportPath: string) => {\n try {\n await fs.access(reportPath);\n await fs.rm(reportPath);\n console.debug(\n `${CONSOLE_ICONS.info} Removed existing report file${isDebug ? `: ${reportPath}` : '.'}`,\n );\n } catch {\n console.debug(\n `${CONSOLE_ICONS.info} No existing report file to remove${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n};\n\nconst summariseReportFile = async (reportPath: string) => {\n try {\n const reportContent = await fs.readFile(reportPath, 'utf8');\n const lines = reportContent.split('\\n').filter(Boolean);\n if (lines.length) {\n console.debug(\n `\\n${CONSOLE_ICONS.warning} ${lines.length} manual review${lines.length > 1 ? 's are' : ' is'} required. See ${reportPath} for details.`,\n );\n } else {\n console.debug(\n `${CONSOLE_ICONS.info} Report file exists but is empty${isDebug ? `: ${reportPath}` : '.'}`,\n );\n }\n } catch {\n console.debug(`${CONSOLE_ICONS.info} No report file generated - no manual reviews needed`);\n }\n};\n\nconst log = (label: string, value?: string): void => {\n if (typeof logToInquirer === 'function') {\n logToInquirer(label, value || '');\n } else {\n console.info(label, value || '');\n }\n};\n\nasync function runCodemod(transformsDir?: string) {\n const args = process.argv.slice(2);\n const candidate = args[0];\n isDebug = args.includes('--debug');\n const startTime = Date.now();\n let repository = 'unknown';\n let trackingProps: Omit<TrackingProperties, 'stage' | 'durationMs'> = {\n transform: candidate,\n repository,\n };\n\n try {\n const root = findProjectRoot();\n repository = path.basename(root);\n const packagesPromise = findPackages();\n const resolvedTransformsDir =\n transformsDir ?? path.resolve(currentDirPath, '../dist/transforms');\n\n if (isDebug) {\n console.debug(\n `${CONSOLE_ICONS.info} Resolved transforms directory: ${resolvedTransformsDir}`,\n );\n }\n\n const { transformFiles: resolvedTransformNames } =\n await loadTransformModules(resolvedTransformsDir);\n if (resolvedTransformNames.length === 0) {\n throw new Error(\n `${CONSOLE_ICONS.error} No transform scripts found${isDebug ? ` in: ${resolvedTransformsDir}` : '.'}`,\n );\n }\n\n let transformFile: string;\n\n if (candidate && resolvedTransformNames.includes(candidate)) {\n log('Select codemod to run:', candidate);\n transformFile = candidate;\n } else {\n transformFile = await list({\n message: 'Select codemod to run:',\n choices: resolvedTransformNames.map((name: string) => ({ name, value: name })),\n });\n log('Selected codemod:', transformFile);\n }\n\n const codemodPath = path.resolve(resolvedTransformsDir, transformFile, 'transformer.js');\n const codemodConfig = getCodemodConfig(codemodPath);\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Resolved codemod path: ${codemodPath}`);\n }\n\n if (codemodConfig?.type === 'claude') {\n validateClaudeConfig();\n }\n\n const spinners = new Spinnies();\n spinners.add('loading-codemod', { text: `Loading codemod (${transformFile})...` });\n const packages = await packagesPromise;\n const reportPath = path.resolve(root, 'codemod-report.txt');\n spinners.succeed('loading-codemod', {\n text: `Successfully loaded codemod: \\x1b[2m${transformFile}\\x1b[0m`,\n });\n\n if (codemodConfig?.type === 'jscodeshift') {\n await resetReportFile(reportPath);\n }\n\n const promptAnswers = await runTransformPrompts(codemodPath);\n const options = await getOptions({\n packages,\n root,\n transformFiles: resolvedTransformNames,\n preselectedTransformFile: transformFile,\n transformerType: codemodConfig?.type,\n });\n\n trackingProps = {\n transform: transformFile,\n engine: codemodConfig?.type,\n repository,\n };\n\n // Handle Claude transforms differently, as they work on multiple targets at once\n if (codemodConfig?.type === 'claude') {\n handleClaudePrereqs({ options, codemodPath, spinners });\n\n // Dynamically import the transformer module\n const transformerModule = (await import(codemodPath)) as {\n default: (targetPaths: string[], isDebug?: boolean) => Promise<void>;\n };\n const transformer = transformerModule.default;\n await transformer(options.targetPaths, isDebug);\n } else {\n // Button codemod doesn't use spinnies\n spinners.stopAll('succeed');\n spinners.checkIfActiveSpinners();\n\n let runAny = false;\n await Promise.all(\n options.targetPaths.map(async (targetPath) => {\n console.info(\n `${CONSOLE_ICONS.focus} \\x1b[1mProcessing:\\x1b[0m \\x1b[32m${targetPath}\\x1b[0m`,\n );\n\n // Check prerequisites for this target before running\n const ok = assessPrerequisites(targetPath, codemodPath);\n if (!ok) {\n return;\n }\n\n const answerArgs = Object.entries(promptAnswers).map(\n ([promptName, answerValue]) => `--${promptName}=${String(answerValue)}`,\n );\n\n const argsList = [\n '-t',\n codemodPath,\n targetPath,\n options.isDry ? '--dry' : '',\n options.isPrint ? '--print' : '',\n options.ignorePatterns\n ? options.ignorePatterns\n .split(',')\n .map((pattern) => `--ignore-pattern=${pattern.trim()}`)\n .join(' ')\n : '',\n options.useGitIgnore ? '--gitignore' : '',\n ...answerArgs,\n ].filter(Boolean);\n const command = `npx jscodeshift ${argsList.join(' ')}`;\n\n if (isDebug) {\n console.debug(`${CONSOLE_ICONS.info} Running: ${command}`);\n }\n runAny = true;\n return execSync(command, { stdio: 'inherit' });\n }),\n );\n if (!runAny) {\n throw new Error('No valid target paths remaining after prerequisite checks');\n }\n }\n\n if (codemodConfig?.type === 'jscodeshift') {\n await summariseReportFile(reportPath);\n }\n\n track(\n TRACKING_EVENT,\n {\n ...trackingProps,\n stage: 'Success',\n durationMs: Date.now() - startTime,\n },\n isDebug,\n );\n } catch (error: unknown) {\n if (error instanceof Error) {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, error.message);\n } else {\n console.error(`${CONSOLE_ICONS.error} Error running ${candidate} codemod:`, String(error));\n }\n track(\n TRACKING_EVENT,\n {\n ...trackingProps,\n stage: 'Failed',\n error: error instanceof Error ? error.message : String(error),\n durationMs: Date.now() - startTime,\n },\n isDebug,\n );\n\n if (process.env.NODE_ENV !== 'test') {\n process.exit(1);\n }\n }\n}\n\nexport { runCodemod };\n","#!/usr/bin/env node\nimport { runCodemod } from './controller';\n\nvoid runCodemod();\n"],"mappings":";;;;;;;;;;;AAIA,MAAM,iBAAA;AAEN,IAAI,SAAmC;AAEvC,MAAM,kBAA4C;AAEhD,YAAW,SAAS,KAAK,gBAAgB,EACvC,WAAW,OACZ,CAAC;AACF,QAAO;;;;;;;;;AAmBT,MAAM,wBACJ,gBAC2D;CAC3D,WAAW,WAAW;CACtB,OAAO,WAAW;CAClB,QAAQ,WAAW;CACnB,YAAY,WAAW;CACvB,OAAO,WAAW;CAClB,UAAU,WAAW,aAAa;CACnC;AAED,MAAa,iBAAiB;;;;;AAM9B,MAAa,SAAS,OAAe,YAAgC,QAAQ,UAAgB;AAC3F,KAAI;EACF,MAAM,SAAS,qBAAqB,WAAW;AAE/C,MAAI,MACF,SAAQ,MAAM,GAAG,cAAc,KAAK,cAAc,SAAS,KAAK,UAAU,QAAQ,MAAM,EAAE,CAAC;EAG7F,MAAM,KAAK,WAAW;AACtB,MAAI,CAAC,GAAI;AAET,KAAG,MAAM,OAAO,EACd,GAAG,QACJ,CAAC;SACI;;;;ACnDV,SAAgB,oBAAoB,EAClC,SACA,aACA,Y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,QAAQ,UAAU;KAC1B,QAAQ,UAAU,YAAY;KAC9B,QAAQ,iBACJ,QAAQ,eACL,MAAM,IAAI,CACV,KAAK,YAAY,oBAAoB,QAAQ,MAAM,GAAG,CACtD,KAAK,IAAI,GACZ;KACJ,QAAQ,eAAe,gBAAgB;KACvC,GAAG;KACJ,CAAC,OAAO,QAAQ,CAC2B,KAAK,IAAI;AAErD,QAAI,QACF,SAAQ,MAAM,GAAG,cAAc,KAAK,YAAY,UAAU;AAE5D,aAAS;AACT,WAAO,SAAS,SAAS,EAAE,OAAO,WAAW,CAAC;KAC9C,CACH;AACD,OAAI,CAAC,OACH,OAAM,IAAI,MAAM,4DAA4D;;AAIhF,MAAI,eAAe,SAAS,cAC1B,OAAM,oBAAoB,WAAW;AAGvC,QACE,gBACA;GACE,GAAG;GACH,OAAO;GACP,YAAY,KAAK,KAAK,GAAG;GAC1B,EACD,QACD;UACM,OAAgB;AACvB,MAAI,iBAAiB,MACnB,SAAQ,MAAM,GAAG,cAAc,MAAM,iBAAiB,UAAU,YAAY,MAAM,QAAQ;MAE1F,SAAQ,MAAM,GAAG,cAAc,MAAM,iBAAiB,UAAU,YAAY,OAAO,MAAM,CAAC;AAE5F,QACE,gBACA;GACE,GAAG;GACH,OAAO;GACP,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC7D,YAAY,KAAK,KAAK,GAAG;GAC1B,EACD,QACD;AAED,MAAI,QAAQ,IAAI,aAAa,OAC3B,SAAQ,KAAK,EAAE;;;;;AChPhB,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/wds-codemods",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-experimental-d90ea76",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "Wise Payments Ltd.",
|
|
6
6
|
"repository": {
|
|
@@ -19,6 +19,21 @@
|
|
|
19
19
|
"README.md",
|
|
20
20
|
"package.json"
|
|
21
21
|
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsdown",
|
|
24
|
+
"changeset": "changeset",
|
|
25
|
+
"lint": "pnpm run lint:js+ts && pnpm run lint:format",
|
|
26
|
+
"lint:js+ts": "eslint '**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}' --concurrency=auto",
|
|
27
|
+
"lint:format": "prettier \"**/*\" --check --ignore-unknown",
|
|
28
|
+
"lint:types": "tsc --noEmit",
|
|
29
|
+
"lint:fix": "pnpm run lint:fix:js+ts && pnpm run lint:fix:format",
|
|
30
|
+
"lint:fix:js+ts": "pnpm run lint:js+ts --fix",
|
|
31
|
+
"lint:fix:format": "prettier \"**/*\" --write --ignore-unknown",
|
|
32
|
+
"prepare": "husky",
|
|
33
|
+
"release": "changeset publish",
|
|
34
|
+
"test": "vitest run",
|
|
35
|
+
"test:watch": "vitest"
|
|
36
|
+
},
|
|
22
37
|
"dependencies": {
|
|
23
38
|
"@anthropic-ai/claude-agent-sdk": "^0.2.91",
|
|
24
39
|
"@inquirer/prompts": "^8.4.1",
|
|
@@ -26,10 +41,11 @@
|
|
|
26
41
|
"@types/spinnies": "^0.5.3",
|
|
27
42
|
"jscodeshift": "^17.3",
|
|
28
43
|
"listr2": "^10.2.1",
|
|
44
|
+
"mixpanel": "^0.20.0",
|
|
29
45
|
"spinnies": "^0.5.1"
|
|
30
46
|
},
|
|
31
47
|
"devDependencies": {
|
|
32
|
-
"@anthropic-ai/sdk": "^0.
|
|
48
|
+
"@anthropic-ai/sdk": "^0.90.0",
|
|
33
49
|
"@changesets/changelog-github": "^0.6.0",
|
|
34
50
|
"@changesets/cli": "^2.30.0",
|
|
35
51
|
"@commitlint/cli": "^20.5.0",
|
|
@@ -53,21 +69,8 @@
|
|
|
53
69
|
"access": "public",
|
|
54
70
|
"registry": "https://registry.npmjs.org/"
|
|
55
71
|
},
|
|
72
|
+
"packageManager": "pnpm@10.33.0",
|
|
56
73
|
"engines": {
|
|
57
74
|
"node": "^24"
|
|
58
|
-
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"build": "tsdown",
|
|
61
|
-
"changeset": "changeset",
|
|
62
|
-
"lint": "pnpm run lint:js+ts && pnpm run lint:format",
|
|
63
|
-
"lint:js+ts": "eslint '**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}' --concurrency=auto",
|
|
64
|
-
"lint:format": "prettier \"**/*\" --check --ignore-unknown",
|
|
65
|
-
"lint:types": "tsc --noEmit",
|
|
66
|
-
"lint:fix": "pnpm run lint:fix:js+ts && pnpm run lint:fix:format",
|
|
67
|
-
"lint:fix:js+ts": "pnpm run lint:js+ts --fix",
|
|
68
|
-
"lint:fix:format": "prettier \"**/*\" --write --ignore-unknown",
|
|
69
|
-
"release": "changeset publish",
|
|
70
|
-
"test": "vitest run",
|
|
71
|
-
"test:watch": "vitest"
|
|
72
75
|
}
|
|
73
|
-
}
|
|
76
|
+
}
|