Skip to content

Commit

Permalink
feat(styles-migration): create migrations with the new cheerio util (#…
Browse files Browse the repository at this point in the history
…687)

This PR adds new schematic utilities, to write easy jQuery-like migrations for almost all necessary DOM migrations.
And replaces all former existing with new migrations based on the new utilities.

Under the hood we use angular schematics built-in template visitor and cheerio to access the html in a jQuery-like context. Updates are formatted with prettier and commited directly on the tree files.

We added an example migration to show how to write new migrations.

To learn how to execute the schematic migrations, visit https://design-system.post.ch.
  • Loading branch information
oliverschuerch authored Nov 10, 2022
1 parent 2b57af8 commit e81d02e
Show file tree
Hide file tree
Showing 89 changed files with 1,902 additions and 1,050 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-mails-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bootstrap close-button component.
5 changes: 5 additions & 0 deletions .changeset/chatty-ads-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bg-opacity classes.
5 changes: 5 additions & 0 deletions .changeset/curly-emus-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation for post topic-teaser component.
5 changes: 5 additions & 0 deletions .changeset/famous-onions-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for button component btn-icon class.
5 changes: 5 additions & 0 deletions .changeset/fifty-crabs-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for general rtl properties.
5 changes: 5 additions & 0 deletions .changeset/forty-chefs-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Update migration documentation for bootstrap button component btn-icon class.
5 changes: 5 additions & 0 deletions .changeset/gold-pumas-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation for bootstrap blockquote component.
5 changes: 5 additions & 0 deletions .changeset/happy-geese-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bootstrap button component.
5 changes: 5 additions & 0 deletions .changeset/happy-paws-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bootstrap form-switch component.
5 changes: 5 additions & 0 deletions .changeset/honest-shirts-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for text-auto class.
5 changes: 5 additions & 0 deletions .changeset/large-candles-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation for bootstrap blockquote component.
5 changes: 5 additions & 0 deletions .changeset/light-tomatoes-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Added migration documentation jquery accordion component.
5 changes: 5 additions & 0 deletions .changeset/long-zoos-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated the migration documentation for close-button.
5 changes: 5 additions & 0 deletions .changeset/modern-candles-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation for post custom-select component.
5 changes: 5 additions & 0 deletions .changeset/modern-knives-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for required form-label class.
5 changes: 5 additions & 0 deletions .changeset/nervous-dodos-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Removed alert-fixed-bottom class requirement from bootstrap alert component.
5 changes: 5 additions & 0 deletions .changeset/nervous-houses-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bootstrap blockquote component with footer.
5 changes: 5 additions & 0 deletions .changeset/nice-steaks-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation for bootstrap form-select component.
5 changes: 5 additions & 0 deletions .changeset/orange-zebras-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for form-checkbox component.
5 changes: 5 additions & 0 deletions .changeset/perfect-spoons-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for post custom-select component.
5 changes: 5 additions & 0 deletions .changeset/plenty-jobs-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation rtl helper classes.
5 changes: 5 additions & 0 deletions .changeset/pretty-actors-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation for bootstrap form-switch component.
5 changes: 5 additions & 0 deletions .changeset/purple-bees-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for forms elements.
5 changes: 5 additions & 0 deletions .changeset/purple-dryers-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added floating-labels migration for bootstrap form-control, form-select and textarea components.
5 changes: 5 additions & 0 deletions .changeset/quiet-buttons-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Moved form-label class requirement form controls to forms migration documentation.
5 changes: 5 additions & 0 deletions .changeset/rare-mirrors-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bootstrap badge component.
5 changes: 5 additions & 0 deletions .changeset/rare-students-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Fixed and updated general classes bg-opacity migration documentation.
5 changes: 5 additions & 0 deletions .changeset/silly-donkeys-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation for ngbootstrap buttons component.
5 changes: 5 additions & 0 deletions .changeset/spicy-boats-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Upated migration documentation for bootstrap `form-control`, `form-select` and `textarea` components.
5 changes: 5 additions & 0 deletions .changeset/swift-moles-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for sr-only and sr-only-focusable classes.
5 changes: 5 additions & 0 deletions .changeset/swift-tigers-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bootstrap blockquote component.
5 changes: 5 additions & 0 deletions .changeset/tender-candles-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for post subnavigation component.
5 changes: 5 additions & 0 deletions .changeset/tough-paws-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Updated migration documentation post accordion component.
5 changes: 5 additions & 0 deletions .changeset/twenty-roses-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for bootstrap form-radio component.
5 changes: 5 additions & 0 deletions .changeset/wet-poems-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-demo': patch
---

Added migration documentation for general classes sr-only and sr-only-focusable.
5 changes: 5 additions & 0 deletions .changeset/wild-beds-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for post topic-teaser component.
5 changes: 5 additions & 0 deletions .changeset/witty-laws-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': minor
---

Added automatic migration for ngbootstrap buttons component.
4 changes: 2 additions & 2 deletions packages/demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
Bootstrap
</button>
<div aria-labelledby="id01" ngbDropdownMenu>
<a ngbDropdownItem [ngClass]="{ active: router.url.indexOf('/bootstrap-samples/accordion') > -1 }"
[routerLink]="'bootstrap-samples/accordion'">Accordion</a>
<a ngbDropdownItem [ngClass]="{active: router.url.indexOf('/bootstrap-samples/alert') > -1}"
[routerLink]="'bootstrap-samples/alert'">Alert / Notification</a>
<a ngbDropdownItem [ngClass]="{active: router.url.indexOf('/bootstrap-samples/badge') > -1}"
Expand Down Expand Up @@ -95,8 +97,6 @@
Post
</button>
<div aria-labelledby="id01" ngbDropdownMenu>
<a ngbDropdownItem [ngClass]="{active: router.url.indexOf('/post-samples/accordion') > -1}"
[routerLink]="'post-samples/accordion'">Accordion</a>
<a ngbDropdownItem [ngClass]="{active: router.url.indexOf('/post-samples/custom-select') > -1}"
[routerLink]="'post-samples/custom-select'">Custom select</a>
<a ngbDropdownItem [ngClass]="{active: router.url.indexOf('/post-samples/datatable') > -1}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,13 @@ <h3>Using JavaScript</h3>
into your component.
</p>
</div>
<div class="alert alert-info my-large">
<p>
The detail summary styles have been removed due to <a href="https://adrianroselli.com/2019/04/details-summary-are-not-insert-control-here.html">accessibility issues with the &lt;summary&gt; element</a>.
<br />
We recommend to use one of the accordion components instead.
</p>
</div>

<app-accordion-demo></app-accordion-demo>
<code
class="block mt-5"
[highlight]="codeController"
[languages]="['typescript', 'javascript']"
class="block my-big p-3"
highlight="import 'bootstrap/js/dist/collapse';"
[languages]="['javascript']"
></code>

<app-accordion-demo></app-accordion-demo>
<code
class="block mt-big"
[highlight]="codeTemplate"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
<button type="button" class="btn btn-secondary btn-icon btn-sm">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
<button type="button" class="btn btn-secondary btn-icon btn-rg">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
<button type="button" class="btn btn-secondary btn-icon btn-md">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
<button type="button" class="btn btn-secondary btn-icon btn-lg">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
<button type="button" class="btn btn-primary btn-icon btn-sm">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
<button type="button" class="btn btn-primary btn-icon btn-rg">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
<button type="button" class="btn btn-primary btn-icon btn-md">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
<button type="button" class="btn btn-primary btn-icon btn-lg">
<i aria-hidden="true" class="pi pi-3193"></i>
<span>Label for screenreaders</span>
<span class="visually-hidden">Label for screenreaders</span>
</button>
Loading

0 comments on commit e81d02e

Please sign in to comment.