Skip to content

Commit

Permalink
Merge main into next
Browse files Browse the repository at this point in the history
  • Loading branch information
sophschneider committed Sep 29, 2023
2 parents fe98e4b + b86cc31 commit d0a2898
Show file tree
Hide file tree
Showing 26 changed files with 489 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-bikes-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris-migrator': minor
---

Created migration to replace deprecated `font` custom properties in polaris-react v12.0.0
5 changes: 0 additions & 5 deletions .changeset/seven-apricots-provide.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/shiny-feet-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris-migrator': minor
---

Created migration to replace deprecated `border` custom properties in polaris-react v12.0.0
5 changes: 5 additions & 0 deletions .changeset/short-llamas-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris-migrator': minor
---

Created migration to replace deprecated `space` custom properties in polaris-react v12.0.0
5 changes: 0 additions & 5 deletions .changeset/smart-drinks-cheat.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {check} from '../../../utilities/check';

const transform = 'v12-styles-replace-custom-property-border';
const fixtures = ['v12-styles-replace-custom-property-border'];

for (const fixture of fixtures) {
check(__dirname, {
fixture,
transform,
extension: 'scss',
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.border {
border-radius: var(--p-border-radius-0-experimental);
border-radius: var(--p-border-radius-05);
border-radius: var(--p-border-radius-1);
border-radius: var(--p-border-radius-1_5-experimental);
border-radius: var(--p-border-radius-2);
border-radius: var(--p-border-radius-3);
border-radius: var(--p-border-radius-4);
border-radius: var(--p-border-radius-5);
border-radius: var(--p-border-radius-6);
border-width: var(--p-border-width-1);
border-width: var(--p-border-width-1-experimental);
border-width: var(--p-border-width-2);
border-width: var(--p-border-width-2-experimental);
border-width: var(--p-border-width-3);
border-width: var(--p-border-width-4);
border-width: var(--p-border-width-5);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.border {
border-radius: var(--p-border-radius-0);
border-radius: var(--p-border-radius-050);
border-radius: var(--p-border-radius-100);
border-radius: var(--p-border-radius-150);
border-radius: var(--p-border-radius-200);
border-radius: var(--p-border-radius-300);
border-radius: var(--p-border-radius-400);
border-radius: var(--p-border-radius-500);
border-radius: var(--p-border-radius-750);
border-width: var(--p-border-width-025);
border-width: var(--p-border-width-0165);
border-width: var(--p-border-width-050);
border-width: var(--p-border-width-025);
border-width: var(--p-border-width-050);
border-width: var(--p-border-width-100);
border-width: var(--p-border-width-100);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type {FileInfo, API} from 'jscodeshift';

import stylesReplaceCustomProperty from '../styles-replace-custom-property/transform';

export default function transformer(fileInfo: FileInfo, _: API) {
return stylesReplaceCustomProperty(fileInfo, _, {replacementMaps});
}

const replacementMaps = {
'/.+/': {
'--p-border-radius-0-experimental': '--p-border-radius-0',
'--p-border-radius-05': '--p-border-radius-050',
'--p-border-radius-1': '--p-border-radius-100',
'--p-border-radius-1_5-experimental': '--p-border-radius-150',
'--p-border-radius-2': '--p-border-radius-200',
'--p-border-radius-3': '--p-border-radius-300',
'--p-border-radius-4': '--p-border-radius-400',
'--p-border-radius-5': '--p-border-radius-500',
'--p-border-radius-6': '--p-border-radius-750',
'--p-border-width-1': '--p-border-width-025',
'--p-border-width-1-experimental': '--p-border-width-0165',
'--p-border-width-2': '--p-border-width-050',
'--p-border-width-2-experimental': '--p-border-width-025',
'--p-border-width-3': '--p-border-width-050',
'--p-border-width-4': '--p-border-width-100',
'--p-border-width-5': '--p-border-width-100',
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.font {
font-size: var(--p-font-size-70-experimental);
// Migrated in step4
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-80-experimental);
font-size: var(--p-font-size-100);
// Migrated in step4
font-size: var(--p-font-size-200);
// Migrated in step3
font-size: var(--p-font-size-300);
// Migrated in step3
font-size: var(--p-font-size-400);
// Migrated in step2
font-size: var(--p-font-size-500);
// Migrated in step2
font-size: var(--p-font-size-600);
font-size: var(--p-font-size-700);
line-height: var(--p-font-line-height-075-experimental);
line-height: var(--p-font-line-height-1);
line-height: var(--p-font-line-height-2);
line-height: var(--p-font-line-height-3);
line-height: var(--p-font-line-height-4);
line-height: var(--p-font-line-height-5);
line-height: var(--p-font-line-height-6);
line-height: var(--p-font-line-height-7);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.font {
font-size: var(--p-font-size-275);
// Migrated in step4
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-325);
font-size: var(--p-font-size-350);
// Migrated in step4
font-size: var(--p-font-size-200);
// Migrated in step3
font-size: var(--p-font-size-300);
// Migrated in step3
font-size: var(--p-font-size-400);
// Migrated in step2
font-size: var(--p-font-size-500);
// Migrated in step2
font-size: var(--p-font-size-600);
font-size: var(--p-font-size-1000);
line-height: var(--p-font-line-height-300);
line-height: var(--p-font-line-height-400);
line-height: var(--p-font-line-height-500);
line-height: var(--p-font-line-height-600);
line-height: var(--p-font-line-height-700);
line-height: var(--p-font-line-height-800);
line-height: var(--p-font-line-height-1000);
line-height: var(--p-font-line-height-1200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.font {
font-size: var(--p-font-size-275);
// Migrated in step4
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-325);
font-size: var(--p-font-size-350);
// Migrated in step4
font-size: var(--p-font-size-200);
// Migrated in step3
font-size: var(--p-font-size-300);
// Migrated in step3
font-size: var(--p-font-size-400);
// Migrated in step2
font-size: var(--p-font-size-500);
// Migrated in step2
font-size: var(--p-font-size-600);
font-size: var(--p-font-size-1000);
line-height: var(--p-font-line-height-300);
line-height: var(--p-font-line-height-400);
line-height: var(--p-font-line-height-500);
line-height: var(--p-font-line-height-600);
line-height: var(--p-font-line-height-700);
line-height: var(--p-font-line-height-800);
line-height: var(--p-font-line-height-1000);
line-height: var(--p-font-line-height-1200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.font {
font-size: var(--p-font-size-275);
// Migrated in step4
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-325);
font-size: var(--p-font-size-350);
// Migrated in step4
font-size: var(--p-font-size-200);
// Migrated in step3
font-size: var(--p-font-size-300);
// Migrated in step3
font-size: var(--p-font-size-400);
// Migrated in step2
font-size: var(--p-font-size-750);
// Migrated in step2
font-size: var(--p-font-size-900);
font-size: var(--p-font-size-1000);
line-height: var(--p-font-line-height-300);
line-height: var(--p-font-line-height-400);
line-height: var(--p-font-line-height-500);
line-height: var(--p-font-line-height-600);
line-height: var(--p-font-line-height-700);
line-height: var(--p-font-line-height-800);
line-height: var(--p-font-line-height-1000);
line-height: var(--p-font-line-height-1200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.font {
font-size: var(--p-font-size-275);
// Migrated in step4
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-325);
font-size: var(--p-font-size-350);
// Migrated in step4
font-size: var(--p-font-size-200);
// Migrated in step3
font-size: var(--p-font-size-300);
// Migrated in step3
font-size: var(--p-font-size-400);
font-size: var(--p-font-size-750);
font-size: var(--p-font-size-900);
font-size: var(--p-font-size-1000);
line-height: var(--p-font-line-height-300);
line-height: var(--p-font-line-height-400);
line-height: var(--p-font-line-height-500);
line-height: var(--p-font-line-height-600);
line-height: var(--p-font-line-height-700);
line-height: var(--p-font-line-height-800);
line-height: var(--p-font-line-height-1000);
line-height: var(--p-font-line-height-1200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.font {
font-size: var(--p-font-size-275);
// Migrated in step4
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-325);
font-size: var(--p-font-size-350);
// Migrated in step4
font-size: var(--p-font-size-200);
// Migrated in step3
font-size: var(--p-font-size-500);
// Migrated in step3
font-size: var(--p-font-size-600);
font-size: var(--p-font-size-750);
font-size: var(--p-font-size-900);
font-size: var(--p-font-size-1000);
line-height: var(--p-font-line-height-300);
line-height: var(--p-font-line-height-400);
line-height: var(--p-font-line-height-500);
line-height: var(--p-font-line-height-600);
line-height: var(--p-font-line-height-700);
line-height: var(--p-font-line-height-800);
line-height: var(--p-font-line-height-1000);
line-height: var(--p-font-line-height-1200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.font {
font-size: var(--p-font-size-275);
// Migrated in step4
font-size: var(--p-font-size-75);
font-size: var(--p-font-size-325);
font-size: var(--p-font-size-350);
// Migrated in step4
font-size: var(--p-font-size-200);
font-size: var(--p-font-size-500);
font-size: var(--p-font-size-600);
font-size: var(--p-font-size-750);
font-size: var(--p-font-size-900);
font-size: var(--p-font-size-1000);
line-height: var(--p-font-line-height-300);
line-height: var(--p-font-line-height-400);
line-height: var(--p-font-line-height-500);
line-height: var(--p-font-line-height-600);
line-height: var(--p-font-line-height-700);
line-height: var(--p-font-line-height-800);
line-height: var(--p-font-line-height-1000);
line-height: var(--p-font-line-height-1200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.font {
font-size: var(--p-font-size-275);
// Migrated in step4
font-size: var(--p-font-size-300);
font-size: var(--p-font-size-325);
font-size: var(--p-font-size-350);
// Migrated in step4
font-size: var(--p-font-size-400);
font-size: var(--p-font-size-500);
font-size: var(--p-font-size-600);
font-size: var(--p-font-size-750);
font-size: var(--p-font-size-900);
font-size: var(--p-font-size-1000);
line-height: var(--p-font-line-height-300);
line-height: var(--p-font-line-height-400);
line-height: var(--p-font-line-height-500);
line-height: var(--p-font-line-height-600);
line-height: var(--p-font-line-height-700);
line-height: var(--p-font-line-height-800);
line-height: var(--p-font-line-height-1000);
line-height: var(--p-font-line-height-1200);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {check} from '../../../utilities/check';

const transform = 'v12-styles-replace-custom-property-font';
const fixtures = [
{
name: 'step1',
options: {
step: 1,
},
},
{
name: 'step2',
options: {
step: 2,
},
},
{
name: 'step3',
options: {
step: 3,
},
},
{
name: 'step4',
options: {
step: 4,
},
},
];

for (const fixture of fixtures) {
check(__dirname, {
fixture: fixture.name,
transform,
options: fixture.options,
extension: 'scss',
});
}
Loading

0 comments on commit d0a2898

Please sign in to comment.