From 3c8b0f97c690b902ba412eec9a0491f1d97f0861 Mon Sep 17 00:00:00 2001 From: Pavel Klibani Date: Tue, 5 Mar 2024 09:31:29 +0100 Subject: [PATCH] fixup! fixup! Feat(web-react): Add spirit-codemod package --- packages/codemods/.eslintignore | 1 + packages/codemods/README.md | 8 ++++---- packages/codemods/config/jest.config.js | 1 + packages/codemods/package.json | 2 +- packages/codemods/{src => }/scripts/copyTransforms.js | 0 5 files changed, 7 insertions(+), 5 deletions(-) rename packages/codemods/{src => }/scripts/copyTransforms.js (100%) 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