From 4d21acd8257be35e4d91c10e18899b96340fc3e8 Mon Sep 17 00:00:00 2001 From: Mohab Sameh Date: Tue, 21 Nov 2023 14:28:21 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Update=20Codemods=20=E2=80=9Cmsw-upgrade-re?= =?UTF-8?q?cipe=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/automations/msw-upgrade-recipe.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/cms/automations/msw-upgrade-recipe.md b/cms/automations/msw-upgrade-recipe.md index 6bbaee9..a76a16f 100644 --- a/cms/automations/msw-upgrade-recipe.md +++ b/cms/automations/msw-upgrade-recipe.md @@ -3,23 +3,18 @@ created-on: 2023-11-16T14:11:04.212Z f_long-description: >- ## Description + This recipe is a set of codemods that will upgrade your project from using msw v1 to v2. - The recipe includes the following codemods: - - [imports](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/imports) - - [type-args](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/type-args) - - [request-changes](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/request-changes) - - [ctx-fetch](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/ctx-fetch) - - [req-passthrough](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/req-passthrough) - - [response-usages](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/response-usages) - - [callback-signature](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/callback-signature) - - [lifecycle-events-signature](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/lifecycle-events-signature) - - [print-handler](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/print-handler) + The recipe includes the following codemods: - [imports](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/imports) - [type-args](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/type-args) - [request-changes](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/request-changes) - [ctx-fetch](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/ctx-fetch) - [req-passthrough](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/req-passthrough) - [response-usages](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/response-usages) - [callback-signature](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/callback-signature) - [lifecycle-events-signature](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/lifecycle-events-signature) - [print-handler](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/print-handler) + ### FNs + This recipe does not change the signatures of MSW handlers, if they were called using a custom factory function, for example to provide more type-safety or else. For example, the following code will only be partially updated: + ```ts export function mockFactory( @@ -39,13 +34,16 @@ f_long-description: >- ``` + ### Links for more info - - [msw v1 to v2 migration guide -> upgrade recipe](https://mswjs.io/docs/migrations/1.x-to-2.x/) + + + * [msw v1 to v2 migration guide -> upgrade recipe](https://mswjs.io/docs/migrations/1.x-to-2.x/) f_github-link: https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/upgrade-recipe f_vs-code-link: vscode://intuita.intuita-vscode-extension/showCodemod?chd=GZo687pOCc0ICc9ptHSWPJTErcM f_cli-command: intuita msw/2/upgrade-recipe f_framework: cms/framework/msw.md -f_applicability-criteria: "MSW version >= 1.0.0" +f_applicability-criteria: MSW version >= 1.0.0 f_verified-codemod: true f_author: cms/authors/intuita.md layout: "[automations].html" @@ -56,7 +54,8 @@ published-on: 2023-11-17T15:18:58.613Z f_slug-name: msw-upgrade-recipe f_codemod-engine: cms/codemod-engines/ts-morph.md f_change-mode-2: Assistive -f_estimated-time-saving: Depending on the size of the project, this recipe can save up to 6 hours of dedicated work and more. +f_estimated-time-saving: Depending on the size of the project, this recipe can + save up to 6 hours of dedicated work and more. f_labels: - cms/labels/msw-v1-v2.md tags: automations From e1afa5d9fa0937b3f50106b62c1bfd0cf14f31af Mon Sep 17 00:00:00 2001 From: Mohab Sameh Date: Tue, 21 Nov 2023 14:29:39 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Update=20Codemods=20=E2=80=9Cmsw-upgrade-re?= =?UTF-8?q?cipe=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cms/automations/msw-upgrade-recipe.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/cms/automations/msw-upgrade-recipe.md b/cms/automations/msw-upgrade-recipe.md index a76a16f..145cb43 100644 --- a/cms/automations/msw-upgrade-recipe.md +++ b/cms/automations/msw-upgrade-recipe.md @@ -6,7 +6,26 @@ f_long-description: >- This recipe is a set of codemods that will upgrade your project from using msw v1 to v2. - The recipe includes the following codemods: - [imports](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/imports) - [type-args](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/type-args) - [request-changes](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/request-changes) - [ctx-fetch](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/ctx-fetch) - [req-passthrough](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/req-passthrough) - [response-usages](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/response-usages) - [callback-signature](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/callback-signature) - [lifecycle-events-signature](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/lifecycle-events-signature) - [print-handler](https://github.com/intuita-inc/codemod-registry/tree/main/msw/2/print-handler) + The recipe includes the following codemods: + + + * imports + + * type-args + + * request-changes + + * ctx-fetch + + * req-passthrough + + * response-usages + + * callback-signature + + * lifecycle-events-signature + + * print-handler ### FNs @@ -15,7 +34,7 @@ f_long-description: >- This recipe does not change the signatures of MSW handlers, if they were called using a custom factory function, for example to provide more type-safety or else. For example, the following code will only be partially updated: - ```ts + ```typescript export function mockFactory( url: string,