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

chore: remove old fonts type like woff and add cache on icon font #2153

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ jobs:
- run:
name: prepare font hash
command: |
echo "export ICON_FONT_HASH=$(sha1sum packages/IconFont/fonts/welcome-icon-font.woff | awk '{ print $1 }')" >> $BASH_ENV
echo "export ICON_FONT_HASH=$(sha1sum packages/IconFont/fonts/welcome-icon-font.woff2 | awk '{ print $1 }')" >> $BASH_ENV
source $BASH_ENV
yarn build:core
- aws-s3/sync:
from: packages/IconFont/fonts
to: s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/
to: s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'
arguments: |
--metadata GitCommit=$CIRCLE_SHA1 --delete
- aws-s3/sync:
from: packages/IconFont/fonts
to: s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/
to: s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'
arguments: |
--metadata GitCommit=$CIRCLE_SHA1 --delete
Expand Down
2 changes: 1 addition & 1 deletion scripts/core.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

FONTS_DIR=packages/IconFont/fonts
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff"
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff2"

if [[ -f "$FONT_FILE" ]]; then
ICON_FONT_HASH=$(sha1sum $FONT_FILE | awk '{ print $1 }')
Expand Down
4 changes: 1 addition & 3 deletions scripts/webfont-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ const writeIconFont = files => {
dest: `${ICON_FONT_PATH}/fonts`,
fontName: FONT_NAME,
codepoints: newUnicodeMap,
types: ['woff', 'woff2', 'ttf', 'svg'],
// Pass timestamp so that hash doesn't change between (non-changing) builds
formatOptions: { ttf: { ts: 0 } },
types: ['woff2'],
templateOptions: {
classPrefix: 'wui-icon-',
baseSelector: 'i',
Expand Down
6 changes: 3 additions & 3 deletions scripts/webfont-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/bin/bash

FONTS_DIR=packages/IconFont/fonts
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff"
FONT_FILE="$FONTS_DIR/welcome-icon-font.woff2"

if [[ -f "$FONT_FILE" ]]; then
ICON_FONT_HASH=$(sha1sum $FONT_FILE | awk '{ print $1 }')

echo "Copying fonts to s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/"

aws s3 sync $FONTS_DIR s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/
aws s3 sync $FONTS_DIR s3://welcome-ui/public/fonts/icon-font/$ICON_FONT_HASH/ --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'

echo "Copying fonts to s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/"

aws s3 sync $FONTS_DIR s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/
aws s3 sync $FONTS_DIR s3://wttj-production/fonts/icon-font/$ICON_FONT_HASH/ --cache-control 'public, max-age=31536000' --exclude '*' --include 'welcome-icon-font.woff2'
else
echo "Font doesn't exist. Please run 'yarn webfont:build'"
exit 1
Expand Down