diff --git a/packages/codemods/.eslintignore b/packages/codemods/.eslintignore index 238689f518..f8bf6e6817 100644 --- a/packages/codemods/.eslintignore +++ b/packages/codemods/.eslintignore @@ -19,4 +19,5 @@ build # Folder __testfixtures__ is used by jscodeshift and cannot be renamed # There are just test fixtures, no need to lint them +# https://github.com/facebook/jscodeshift?tab=readme-ov-file#unit-testing **/__testfixtures__/** \ No newline at end of file diff --git a/packages/codemods/README.md b/packages/codemods/README.md index 49b6745159..5db64ededa 100644 --- a/packages/codemods/README.md +++ b/packages/codemods/README.md @@ -1,8 +1,8 @@ # @lmc-eu/spirit-codemods -> Codemods for migrating to the newer version of the Spirit Design library. +> Codemods for migration to the newer version of the Spirit Design library. -`spirit-codemods` is a **CLI tool** designed to assist you in migrating to the latest version of our Spirit Design library. This tool efficiently handles the removal of breaking changes and deprecations with simple commands. +`spirit-codemods` is a **CLI tool** designed to assist you in migrating to the latest version of our Spirit Design System library. This tool efficiently handles the removal of breaking changes and deprecations with simple commands. For React transformations, it utilizes the [jscodeshift][jscodeshift] library. @@ -22,14 +22,14 @@ There are **two mandatory arguments**: `-p`/`--path` and `-c`/`--codemod`. The former specifies the directory path where you want to execute transforms, while the latter specifies the desired codemod to run. ```shell -npx npx @lmc-eu/spirit-codemods -p ./ -c v2/web-react/codemod-name +npx @lmc-eu/spirit-codemods -p ./ -c v2/web-react/codemod-name ``` Other optional arguments include: - `-v`/`--version` - Displays current version - `-h`/`--help` - Displays this message -- `-e`/`--extensions` - Extensions to look for when transforming files, default: `ts,tsx,js,jsx` +- `-e`/`--extensions` - Extensions of the transformed files, default: `ts,tsx,js,jsx` - `--parser` - Parser to use (babel, ts, tsx, flow), default: `tsx` - `--ignore-pattern` - Ignore files or directories, default: `**/node_modules/**` diff --git a/packages/codemods/config/jest.config.js b/packages/codemods/config/jest.config.js index 5d5b146d64..8db81784df 100644 --- a/packages/codemods/config/jest.config.js +++ b/packages/codemods/config/jest.config.js @@ -20,6 +20,7 @@ const config = { // An array of regexp pattern strings that are matched against all test paths before executing the test // https://jestjs.io/docs/configuration#testpathignorepatterns-arraystring testPathIgnorePatterns: ['/dist/', '/node_modules/', '.*__tests__/.*DataProvider.ts'], + // The directory where Jest should output its coverage files. // https://jestjs.io/docs/configuration#coveragedirectory-string coverageDirectory: './.coverage', diff --git a/packages/codemods/package.json b/packages/codemods/package.json index b61fb07d72..2c5eaaf912 100644 --- a/packages/codemods/package.json +++ b/packages/codemods/package.json @@ -32,7 +32,7 @@ "scripts": { "prebuild": "shx rm -rf dist && shx mkdir -p dist", "build": "tsup --config ./config/tsup.config.ts", - "postbuild": "shx cp -r package.json README.md src/bin dist/ && node src/scripts/copyTransforms.js", + "postbuild": "shx cp -r package.json README.md src/bin dist/ && node scripts/copyTransforms.js", "start": "tsup src/index.ts --watch", "types": "tsc", "lint": "eslint ./", diff --git a/packages/codemods/src/scripts/copyTransforms.js b/packages/codemods/scripts/copyTransforms.js similarity index 100% rename from packages/codemods/src/scripts/copyTransforms.js rename to packages/codemods/scripts/copyTransforms.js