Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initialize icons package #933

Merged
merged 47 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1fd0055
feat(icons)!: initial commit
gfellerph Dec 1, 2022
ee85fdc
fix: ts-jest
gfellerph Jan 5, 2023
8e3de7d
fix: roll back to jest 25
gfellerph Jan 6, 2023
6624989
tests: add test case for fetchPage and mapResponse
gfellerph Jan 6, 2023
0e065fe
test: add tests and update file structure a little
gfellerph Jan 6, 2023
2d717e9
fix: update folder structure and refactor files
gfellerph Jan 6, 2023
d1ec965
feat: fix download workflow
gfellerph Jan 6, 2023
478f9df
chore: add changeset
gfellerph Jan 6, 2023
d97ee41
Merge branch 'main' into feat-initialize-icons-package
gfellerph Jan 6, 2023
85673b3
feat: write json report to output
gfellerph Jan 9, 2023
958238e
feat: add icons to version control
gfellerph Jan 9, 2023
9d68d62
feat: add error message to error report
gfellerph Jan 9, 2023
caf1fa9
refactor: clean up
gfellerph Jan 9, 2023
7017680
fix: load dotenv as first order of business and tests
gfellerph Jan 9, 2023
13d407e
chore: update report
gfellerph Jan 9, 2023
94292d1
fix: sonar issues and update icons
gfellerph Jan 9, 2023
28e8001
fix: sonar regression
gfellerph Jan 9, 2023
72f19cc
feat: add icon stories
gfellerph Jan 9, 2023
5aa98c8
Merge branch 'main' into feat-initialize-icons-package
gfellerph Jan 9, 2023
a379d15
feat!: remove old icon workflow
gfellerph Jan 9, 2023
2914b64
feat: load icons from node_modules
gfellerph Jan 9, 2023
a49d209
feat: added the post-icon component
gfellerph Jan 9, 2023
03f3858
feat: initialized icons storybook docs
gfellerph Jan 9, 2023
c4aa69b
feat: add a filter for icon ranges
gfellerph Jan 10, 2023
f9ff3c1
Merge branch 'feat-initialize-icons-package' of https://github.com/sw…
gfellerph Jan 10, 2023
44b8bf8
Merge branch 'main' into feat-initialize-icons-package
gfellerph Jan 20, 2023
181a93e
chore: temporarily delete icons for easier review
gfellerph Jan 20, 2023
9b94665
Revert "chore: temporarily delete icons for easier review"
gfellerph Jan 20, 2023
29e7ee4
chore: temporarily remove icons (again) and remove two unused tests
gfellerph Jan 20, 2023
8b14968
feat(documentation): add icon stories (#978)
oliverschuerch Feb 2, 2023
fa18071
chore(icons): create workflow to regularly update icon SVGs (#1040)
alizedebray Feb 6, 2023
a83b391
Merge branch 'main' into feat-initialize-icons-package
gfellerph Feb 6, 2023
92a812e
chore: update changesets
gfellerph Feb 6, 2023
ae0c66b
chore: update icons
gfellerph Feb 6, 2023
510149d
chore: remove generated md files from gitignore
gfellerph Feb 7, 2023
8b45255
chore: remove react-jsx-parser from devDependencies
gfellerph Feb 7, 2023
e86a74f
chore: remove unused code
gfellerph Feb 7, 2023
795411d
chore: update readme and contributing files
gfellerph Feb 7, 2023
12544bf
chore: set package to public
gfellerph Feb 7, 2023
5da4043
Revert "chore: update icons"
gfellerph Feb 7, 2023
55b1285
chore: update lockfile
gfellerph Feb 7, 2023
1d58780
Merge branch 'main' into feat-initialize-icons-package
gfellerph Feb 7, 2023
bb5be4c
Merge branch 'main' into feat-initialize-icons-package
gfellerph Feb 9, 2023
a88370f
chore: fix package versions
gfellerph Feb 9, 2023
daec1c7
chore: update package lock
gfellerph Feb 9, 2023
3d4eb2d
Merge branch 'main' into feat-initialize-icons-package
gfellerph Feb 9, 2023
378f830
chore: fix version conflict
gfellerph Feb 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/late-tigers-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-components': minor
---

Added an icon component that works together with @swisspost/design-system-icons for rendering any Post icon as an SVG.
5 changes: 5 additions & 0 deletions .changeset/nasty-impalas-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': minor
---

Added an icon search and documentation page for the post-icon web-component
5 changes: 5 additions & 0 deletions .changeset/thin-mayflies-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-icons': major
---

Added a package containing all Post icons. This package is intended to be used by a `<post-icon />` web-component responsible for loading and displaying the icon.
5 changes: 5 additions & 0 deletions .changeset/unlucky-pears-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-documentation': patch
---

Refactored storybooks transformSource to create better code preview output.
125 changes: 125 additions & 0 deletions .github/workflows/fetch-icons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
###
#
# Regularly create a pull request with up-to-date icons
#
# This workflow has access to secrets and
# therefore will not run from a fork.
#
###

name: Fetch Icons

on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: '0 0 * * 0' # the job will run every Sunday at 0:00

jobs:
fetch:
runs-on: ubuntu-latest
if: github.repository_owner == 'swisspost'

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup
uses: swisspost/design-system/.github/actions/setup-pnpm@main

- name: Get Date
id: current-date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Create Branch
id: current-branch
run: |
git checkout -b $BRANCH_NAME
echo "::set-output name=branch::$BRANCH_NAME"
env:
BRANCH_NAME: ${{ steps.current-date.outputs.date }}-update-icons

- name: Fetch Icons
run: pnpm --filter design-system-icons fetchSVGs

- name: Get Changes
id: changed-files
uses: tj-actions/changed-files@v35
with:
files: ./packages/icons/public/post-icons/**

- name: Exit if no changes
if: steps.changed-files.outputs.any_modified == 'false'
run: |
git checkout main
git branch --delete ${{ steps.current-branch.outputs.branch }}
exit 1

- name: Create Changeset
run: |
echo --- > $CHANGESET
echo '@swisspost/design-system-icons': patch >> $CHANGESET
echo --- >> $CHANGESET
echo >> $CHANGESET
echo Updated icon SVGs. >> $CHANGESET
echo >> $CHANGESET
env:
CHANGESET: ./.changeset/${{ steps.current-branch.outputs.branch }}.md

- name: Commit Changes
run: |
git config --global user.name github-actions[bot]
git config --global user.email [email protected]
git add .
git commit -am "chore(icons): :point_up: update icon SVGs"
git push -u origin ${{ steps.current-branch.outputs.branch }}

- name: Write PR Body
id: pr-body
run: |
# create the PR body file with a title and set its path as the job output
# writing the PR body as a Markdown file allows it to be multi-lined and properly formatted
# the file is then only used when creating the PR but is never committed
echo "# Design system icons are now up to date!" > $PR_BODY_FILE
echo "::set-output name=file::$PR_BODY_FILE"

# group all modified, renamed and copied files into a single list counting as updated files
UPDATED_ICONS=($MODIFIED_ICONS $RENAMED_ICONS $COPIED_ICONS)

# declare all PR body sections in an indexed array (-a) to control their order
# declare the list of files corresponding to each section in an associative array (-A)
declare -a sections; declare -A changes
sections+=( "Added icons" ); changes["Added icons"]=$ADDED_ICONS
sections+=( "Updated icons" ); changes["Updated icons"]=$UPDATED_ICONS
sections+=( "Deleted icons" ); changes["Deleted icons"]=$DELETED_ICONS

for section in "${sections[@]}"; do
if [[ ${changes[$section]} != '' ]]; then
# for each section with changes, add its title to the PR body file
echo "## $section" >> $PR_BODY_FILE
for file in ${changes[$section]}; do
# for each file in the section, get the icon name from its path
icon=$(echo $file | sed 's/^packages\/icons\/public\/svg\///' | sed 's/\.svg$//')
# then add the icon name to the PR body file as a list item
echo "- $icon" >> $PR_BODY_FILE
done
fi
done
env:
PR_BODY_FILE: pr-body.md
ADDED_ICONS: ${{ steps.changed-files.outputs.added_files }}
MODIFIED_ICONS: ${{ steps.changed-files.outputs.modified_files }}
RENAMED_ICONS: ${{ steps.changed-files.outputs.renamed_files }}
COPIED_ICONS: ${{ steps.changed-files.outputs.copied_files }}
DELETED_ICONS: ${{ steps.changed-files.outputs.deleted_files }}

- name: Create PR
run: gh pr create --fill --body-file ${{ steps.pr-body.outputs.file }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ styles/stylelint-report.txt

# Stencil
**/stencil-generated/
/packages/components/src/components/**/readme.md
5 changes: 0 additions & 5 deletions Tools/IconReader/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions Tools/IconReader/README.md

This file was deleted.

70 changes: 0 additions & 70 deletions Tools/IconReader/iconGenerator.ps1

This file was deleted.

18 changes: 0 additions & 18 deletions Tools/README.md

This file was deleted.

6 changes: 3 additions & 3 deletions packages/changelog-github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"build": "tsc"
},
"dependencies": {
"@changesets/get-github-info": "^0.5.1",
"@changesets/types": "^5.2.0",
"dotenv": "^16.0.0"
"@changesets/get-github-info": "0.5.1",
"@changesets/types": "5.2.0",
"dotenv": "16.0.0"
},
"devDependencies": {
"@changesets/parse": "*",
Expand Down
18 changes: 9 additions & 9 deletions packages/components-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
"tsc": "tsc -p ."
},
"dependencies": {
"@swisspost/design-system-components": "workspace:^1.0.3"
"@swisspost/design-system-components": "workspace:1.1.0"
},
"devDependencies": {
"@types/node": "18.13.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@typescript-eslint/eslint-plugin": "^5.46.1",
"@typescript-eslint/parser": "^5.46.1",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^24.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-n": "^15.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.31.11",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"eslint": "8.0.1",
"eslint-config-standard-with-typescript": "24.0.0",
"eslint-plugin-import": "2.25.2",
"eslint-plugin-n": "15.0.0",
"eslint-plugin-promise": "6.0.0",
"eslint-plugin-react": "7.31.11",
"react": "18.2.0",
"react-dom": "18.2.0",
"rimraf": "4.1.2",
Expand Down
Loading