From 774ef0f98b5e2b74499a63aad879efbafd52c372 Mon Sep 17 00:00:00 2001 From: Bilal Shafi Date: Thu, 28 Mar 2024 19:39:07 +0500 Subject: [PATCH] [docs] Improve codemod related documentation (#12582) --- .../migration-data-grid-v6.md | 6 ++-- .../migration-pickers-v6.md | 8 +++-- packages/x-codemod/README.md | 34 +++++++++---------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md b/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md index 3ed538523b73..30679a6217f1 100644 --- a/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md +++ b/docs/data/migration/migration-data-grid-v6/migration-data-grid-v6.md @@ -57,12 +57,14 @@ You can run `v7.0.0/data-grid/preset-safe` targeting only Data Grid or `v7.0.0/p You can either run it on a specific file, folder, or your entire codebase when choosing the `` argument. + + ```bash // Data Grid specific -npx @mui/x-codemod v7.0.0/data-grid/preset-safe +npx @mui/x-codemod@latest v7.0.0/data-grid/preset-safe // Target other MUIĀ X components as well -npx @mui/x-codemod v7.0.0/preset-safe +npx @mui/x-codemod@latest v7.0.0/preset-safe ``` :::info diff --git a/docs/data/migration/migration-pickers-v6/migration-pickers-v6.md b/docs/data/migration/migration-pickers-v6/migration-pickers-v6.md index 456e79dc53d4..035c24bfb82f 100644 --- a/docs/data/migration/migration-pickers-v6/migration-pickers-v6.md +++ b/docs/data/migration/migration-pickers-v6/migration-pickers-v6.md @@ -52,12 +52,14 @@ The `preset-safe` codemod will automatically adjust the bulk of your code to acc You can either run it on a specific file, folder, or your entire codebase when choosing the `` argument. + + ```bash // Date and Time Pickers specific -npx @mui/x-codemod v7.0.0/pickers/preset-safe +npx @mui/x-codemod@latest v7.0.0/pickers/preset-safe // Target Data Grid as well -npx @mui/x-codemod v7.0.0/preset-safe +npx @mui/x-codemod@latest v7.0.0/preset-safe ``` :::info @@ -105,7 +107,7 @@ And are removed from the v7. If not already done, this modification can be handled by the codemod ```bash -npx @mui/x-codemod v7.0.0/pickers/ +npx @mui/x-codemod@latest v7.0.0/pickers/ ``` Take a look at [the RFC](https://github.com/mui/material-ui/issues/33416) for more information. diff --git a/packages/x-codemod/README.md b/packages/x-codemod/README.md index 3a9ac6e08276..5b9c53d476d4 100644 --- a/packages/x-codemod/README.md +++ b/packages/x-codemod/README.md @@ -13,7 +13,7 @@ This repository contains a collection of codemod scripts based for use with ```bash -npx @mui/x-codemod +npx @mui/x-codemod@latest Applies a `@mui/x-codemod` to the specified paths @@ -29,8 +29,8 @@ Options: --jscodeshift Pass options directly to jscodeshift [array] Examples: - npx @mui/x-codemod v6.0.0/preset-safe src - npx @mui/x-codemod v6.0.0/component-rename-prop src -- + npx @mui/x-codemod@latest v7.0.0/preset-safe src + npx @mui/x-codemod@latest v6.0.0/component-rename-prop src -- --component=DataGrid --from=prop --to=newProp ``` @@ -40,9 +40,9 @@ To pass more options directly to jscodeshift, use `--jscodeshift=...`. For examp ```bash // single option -npx @mui/x-codemod --jscodeshift=--run-in-band +npx @mui/x-codemod@latest --jscodeshift=--run-in-band // multiple options -npx @mui/x-codemod --jscodeshift=--cpus=1 --jscodeshift=--print --jscodeshift=--dry --jscodeshift=--verbose=2 +npx @mui/x-codemod@latest --jscodeshift=--cpus=1 --jscodeshift=--print --jscodeshift=--dry --jscodeshift=--verbose=2 ``` See all available options [here](https://github.com/facebook/jscodeshift#usage-cli). @@ -53,7 +53,7 @@ Options to [recast](https://github.com/benjamn/recast)'s printer can be provided through jscodeshift's `printOptions` command line argument ```bash -npx @mui/x-codemod --jscodeshift="--printOptions='{\"quote\":\"double\"}'" +npx @mui/x-codemod@latest --jscodeshift="--printOptions='{\"quote\":\"double\"}'" ``` ## v7.0.0 @@ -66,7 +66,7 @@ It runs codemods for both Data Grid and Date and Time Pickers packages. To run codemods for a specific package, refer to the respective section. ```bash -npx @mui/x-codemod v7.0.0/preset-safe +npx @mui/x-codemod@latest v7.0.0/preset-safe ``` The corresponding sub-sections are listed below @@ -82,7 +82,7 @@ The corresponding sub-sections are listed below The `preset-safe` codemods for pickers. ```bash -npx @mui/x-codemod v7.0.0/pickers/preset-safe +npx @mui/x-codemod@latest v7.0.0/pickers/preset-safe ``` The list includes these transformers @@ -108,7 +108,7 @@ This change only affects Date and Time Picker components. ``` ```bash -npx @mui/x-codemod v7.0.0/pickers/rename-components-to-slots +npx @mui/x-codemod@latest v7.0.0/pickers/rename-components-to-slots ``` #### `rename-default-calendar-month-to-reference-date` @@ -121,7 +121,7 @@ Replace the `defaultCalendarMonth` prop with the `referenceDate` prop. ``` ```bash -npx @mui/x-codemod v7.0.0/pickers/rename-default-calendar-month-to-reference-date +npx @mui/x-codemod@latest v7.0.0/pickers/rename-default-calendar-month-to-reference-date ``` #### `rename-day-picker-classes` @@ -134,7 +134,7 @@ Rename the `dayPickerClasses` variable to `dayCalendarClasses`. ``` ```bash -npx @mui/x-codemod v7.0.0/pickers/rename-day-picker-classes +npx @mui/x-codemod@latest v7.0.0/pickers/rename-day-picker-classes ``` #### `rename-slots-types` @@ -149,7 +149,7 @@ Replace types suffix `SlotsComponent` by `Slots` and `SlotsComponentsProps` by ` ``` ```bash -npx @mui/x-codemod v7.0.0/pickers/rename-slots-types +npx @mui/x-codemod@latest v7.0.0/pickers/rename-slots-types ``` ### Data Grid codemods @@ -159,7 +159,7 @@ npx @mui/x-codemod v7.0.0/pickers/rename-slots-types The `preset-safe` codemods for data grid. ```bash -npx @mui/x-codemod v7.0.0/data-grid/preset-safe +npx @mui/x-codemod@latest v7.0.0/data-grid/preset-safe ``` The list includes these transformers @@ -184,7 +184,7 @@ This change only affects Data Grid components. ``` ```bash -npx @mui/x-codemod v7.0.0/data-grid/rename-components-to-slots +npx @mui/x-codemod@latest v7.0.0/data-grid/rename-components-to-slots ``` #### `rename-cell-selection-props` @@ -203,7 +203,7 @@ Rename props related to `cellSelection` feature. ``` ```bash -npx @mui/x-codemod v7.0.0/data-grid/rename-cell-selection-props +npx @mui/x-codemod@latest v7.0.0/data-grid/rename-cell-selection-props ``` #### `remove-stabilized-v7-experimentalFeatures` @@ -222,7 +222,7 @@ Remove feature flags for stabilized `experimentalFeatures`. ``` ```bash -npx @mui/x-codemod@next v7.0.0/data-grid/remove-stabilized-experimentalFeatures +npx @mui/x-codemod@latest v7.0.0/data-grid/remove-stabilized-experimentalFeatures ``` ### Tree View codemods @@ -232,7 +232,7 @@ npx @mui/x-codemod@next v7.0.0/data-grid/remove-stabilized-experimentalFeatures The `preset-safe` codemods for tree view. ```bash -npx @mui/x-codemod v7.0.0/tree-view/preset-safe +npx @mui/x-codemod@latest v7.0.0/tree-view/preset-safe ``` The list includes these transformers