forked from Shopify/polaris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
489 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...migrator/src/migrations/v12-styles-replace-custom-property-border/tests/transform.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}); | ||
} |
18 changes: 18 additions & 0 deletions
18
...replace-custom-property-border/tests/v12-styles-replace-custom-property-border.input.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
18 changes: 18 additions & 0 deletions
18
...eplace-custom-property-border/tests/v12-styles-replace-custom-property-border.output.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
28 changes: 28 additions & 0 deletions
28
polaris-migrator/src/migrations/v12-styles-replace-custom-property-border/transform.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}; |
26 changes: 26 additions & 0 deletions
26
...is-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step1.input.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
26 changes: 26 additions & 0 deletions
26
...s-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step1.output.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
26 changes: 26 additions & 0 deletions
26
...is-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step2.input.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
26 changes: 26 additions & 0 deletions
26
...s-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step2.output.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
24 changes: 24 additions & 0 deletions
24
...is-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step3.input.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
24 changes: 24 additions & 0 deletions
24
...s-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step3.output.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
22 changes: 22 additions & 0 deletions
22
...is-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step4.input.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
22 changes: 22 additions & 0 deletions
22
...s-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/step4.output.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
38 changes: 38 additions & 0 deletions
38
...s-migrator/src/migrations/v12-styles-replace-custom-property-font/tests/transform.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}); | ||
} |
Oops, something went wrong.