From fbab9863e6ed1844c3c3cfef11a6b7b1e9e63870 Mon Sep 17 00:00:00 2001 From: Laura Griffee Date: Mon, 1 Apr 2024 15:19:33 -0600 Subject: [PATCH 1/4] Update v14 font migration --- .../tests/transform.test.ts | 2 +- ...es-replace-custom-property-font.input.css} | 8 ------ ...es-replace-custom-property-font.output.css | 12 ++++++++ ...s-replace-custom-property-font.output.scss | 20 ------------- .../transform.ts | 28 ++++++------------- 5 files changed, 22 insertions(+), 48 deletions(-) rename polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/{v14-styles-replace-custom-property-font.input.scss => v14-styles-replace-custom-property-font.input.css} (54%) create mode 100644 polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.css delete mode 100644 polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.scss diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts index c1e1d66dd8d..4322f92506f 100644 --- a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts +++ b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts @@ -7,6 +7,6 @@ for (const fixture of fixtures) { check(__dirname, { fixture, transform, - extension: 'scss', + extension: 'css', }); } diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.scss b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.css similarity index 54% rename from polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.scss rename to polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.css index db0849ebb32..b7fe00d169f 100644 --- a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.scss +++ b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.css @@ -1,20 +1,12 @@ .font { - font-size: var(--p-font-size-750); font-size: var(--p-font-size-800); font-size: var(--p-font-size-900); font-size: var(--p-font-size-1000); - font-size: var(--p-text-heading-2xl-font-size); font-size: var(--p-text-heading-3xl-font-size); - letter-spacing: var(--p-font-letter-spacing-denser); letter-spacing: var(--p-font-letter-spacing-densest); - letter-spacing: var(--p-text-heading-2xl-font-letter-spacing); letter-spacing: var(--p-text-heading-3xl-font-letter-spacing); - line-height: var(--p-font-line-height-1000); line-height: var(--p-font-line-height-1200); - line-height: var(--p-text-heading-2xl-font-line-height); line-height: var(--p-text-heading-3xl-font-line-height); - font-family: var(--p-text-heading-2xl-font-family); font-family: var(--p-text-heading-3xl-font-family); - font-weight: var(--p-text-heading-2xl-font-weight); font-weight: var(--p-text-heading-3xl-font-weight); } diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.css b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.css new file mode 100644 index 00000000000..ea3ce491042 --- /dev/null +++ b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.css @@ -0,0 +1,12 @@ +.font { + font-size: var(--p-font-size-750); + font-size: var(--p-font-size-750); + font-size: var(--p-font-size-750); + font-size: var(--p-text-heading-2xl-font-size); + letter-spacing: var(--p-font-letter-spacing-denser); + letter-spacing: var(--p-text-heading-2xl-font-letter-spacing); + line-height: var(--p-font-line-height-1000); + line-height: var(--p-text-heading-2xl-font-line-height); + font-family: var(--p-text-heading-2xl-font-family); + font-weight: var(--p-text-heading-2xl-font-weight); +} diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.scss b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.scss deleted file mode 100644 index adba971ea78..00000000000 --- a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.scss +++ /dev/null @@ -1,20 +0,0 @@ -.font { - font-size: var(--p-font-size-600); - font-size: var(--p-font-size-600); - font-size: var(--p-font-size-600); - font-size: var(--p-font-size-600); - font-size: var(--p-text-heading-xl-font-size); - font-size: var(--p-text-heading-xl-font-size); - letter-spacing: var(--p-font-letter-spacing-dense); - letter-spacing: var(--p-font-letter-spacing-dense); - letter-spacing: var(--p-text-heading-xl-font-letter-spacing); - letter-spacing: var(--p-text-heading-xl-font-letter-spacing); - line-height: var(--p-font-line-height-800); - line-height: var(--p-font-line-height-800); - line-height: var(--p-text-heading-xl-font-line-height); - line-height: var(--p-text-heading-xl-font-line-height); - font-family: var(--p-text-heading-xl-font-family); - font-family: var(--p-text-heading-xl-font-family); - font-weight: var(--p-text-heading-xl-font-weight); - font-weight: var(--p-text-heading-xl-font-weight); -} diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts index 1e5eea07ee8..5aa17702b86 100644 --- a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts +++ b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts @@ -8,27 +8,17 @@ export default function transformer(fileInfo: FileInfo, _: API) { const replacementMaps = { '/.+/': { - '--p-font-size-750': '--p-font-size-600', - '--p-font-size-800': '--p-font-size-600', - '--p-font-size-900': '--p-font-size-600', - '--p-font-size-1000': '--p-font-size-600', - '--p-font-letter-spacing-denser': '--p-font-letter-spacing-dense', - '--p-font-letter-spacing-densest': '--p-font-letter-spacing-dense', - '--p-font-line-height-1000': '--p-font-line-height-800', + '--p-font-size-800': '--p-font-size-750', + '--p-font-size-900': '--p-font-size-750', + '--p-font-size-1000': '--p-font-size-750', + '--p-font-letter-spacing-densest': '--p-font-letter-spacing-denser', '--p-font-line-height-1200': '--p-font-line-height-800', - '--p-text-heading-3xl-font-family': '--p-text-heading-xl-font-family', - '--p-text-heading-3xl-font-size': '--p-text-heading-xl-font-size', - '--p-text-heading-3xl-font-weight': '--p-text-heading-xl-font-weight', + '--p-text-heading-3xl-font-family': '--p-text-heading-2xl-font-family', + '--p-text-heading-3xl-font-size': '--p-text-heading-2xl-font-size', + '--p-text-heading-3xl-font-weight': '--p-text-heading-2xl-font-weight', '--p-text-heading-3xl-font-letter-spacing': - '--p-text-heading-xl-font-letter-spacing', + '--p-text-heading-2xl-font-letter-spacing', '--p-text-heading-3xl-font-line-height': - '--p-text-heading-xl-font-line-height', - '--p-text-heading-2xl-font-family': '--p-text-heading-xl-font-family', - '--p-text-heading-2xl-font-size': '--p-text-heading-xl-font-size', - '--p-text-heading-2xl-font-weight': '--p-text-heading-xl-font-weight', - '--p-text-heading-2xl-font-letter-spacing': - '--p-text-heading-xl-font-letter-spacing', - '--p-text-heading-2xl-font-line-height': - '--p-text-heading-xl-font-line-height', + '--p-text-heading-2xl-font-line-height', }, }; From 63dde3610ed85063fc5184ec5e3114d8d3d96a33 Mon Sep 17 00:00:00 2001 From: Laura Griffee Date: Mon, 1 Apr 2024 15:21:24 -0600 Subject: [PATCH 2/4] Add changeset --- .changeset/twenty-chefs-float.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/twenty-chefs-float.md diff --git a/.changeset/twenty-chefs-float.md b/.changeset/twenty-chefs-float.md new file mode 100644 index 00000000000..e9ef25315fc --- /dev/null +++ b/.changeset/twenty-chefs-float.md @@ -0,0 +1,5 @@ +--- +'@shopify/polaris-migrator': patch +--- + +Updated v14 font migration based on deprecation updates From a8ce64d4a35ba8206537418884d4a9b26cf5d141 Mon Sep 17 00:00:00 2001 From: Laura Griffee Date: Mon, 1 Apr 2024 15:40:55 -0600 Subject: [PATCH 3/4] Fix failing test --- .../tests/transform.test.ts | 2 +- ...t.css => v14-styles-replace-custom-property-font.input.scss} | 0 ....css => v14-styles-replace-custom-property-font.output.scss} | 0 .../v14-styles-replace-custom-property-font/transform.ts | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/{v14-styles-replace-custom-property-font.input.css => v14-styles-replace-custom-property-font.input.scss} (100%) rename polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/{v14-styles-replace-custom-property-font.output.css => v14-styles-replace-custom-property-font.output.scss} (100%) diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts index 4322f92506f..c1e1d66dd8d 100644 --- a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts +++ b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/transform.test.ts @@ -7,6 +7,6 @@ for (const fixture of fixtures) { check(__dirname, { fixture, transform, - extension: 'css', + extension: 'scss', }); } diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.css b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.scss similarity index 100% rename from polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.css rename to polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.input.scss diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.css b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.scss similarity index 100% rename from polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.css rename to polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/tests/v14-styles-replace-custom-property-font.output.scss diff --git a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts index 5aa17702b86..03d28630ac9 100644 --- a/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts +++ b/polaris-migrator/src/migrations/v14-styles-replace-custom-property-font/transform.ts @@ -12,7 +12,7 @@ const replacementMaps = { '--p-font-size-900': '--p-font-size-750', '--p-font-size-1000': '--p-font-size-750', '--p-font-letter-spacing-densest': '--p-font-letter-spacing-denser', - '--p-font-line-height-1200': '--p-font-line-height-800', + '--p-font-line-height-1200': '--p-font-line-height-1000', '--p-text-heading-3xl-font-family': '--p-text-heading-2xl-font-family', '--p-text-heading-3xl-font-size': '--p-text-heading-2xl-font-size', '--p-text-heading-3xl-font-weight': '--p-text-heading-2xl-font-weight', From 82cf59ab4d4b5fd80ae725ca14ff8a5c5119dc47 Mon Sep 17 00:00:00 2001 From: Laura Griffee Date: Tue, 2 Apr 2024 15:29:16 -0600 Subject: [PATCH 4/4] Update .changeset/twenty-chefs-float.md --- .changeset/twenty-chefs-float.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/twenty-chefs-float.md b/.changeset/twenty-chefs-float.md index e9ef25315fc..ca8fe89af58 100644 --- a/.changeset/twenty-chefs-float.md +++ b/.changeset/twenty-chefs-float.md @@ -2,4 +2,4 @@ '@shopify/polaris-migrator': patch --- -Updated v14 font migration based on deprecation updates +Removed `Text` `heading2xl` and associated tokens from v14 font migration