Skip to content

Commit 1d1dd20

Browse files
committed
Move source-code fonts to new build workflow
Changes Include: - Removed the old scripts/yarn/** dir, as it is no longer needed. - Moved source-code-pro and source-sans to client/ - Built and bundled the fonts. - Updated templates to use the new built fonts and styles. - Added new built bundles license info in REUSE.toml. Note: - The old bundles did not get removed to keep this PR simple for review. TODO: - Remove old fonts bundles. - Update any dependents on them to use the new bundles. - if FONTS_CDN_URL is configured it should be seted up with static/js/vendor/fonts instead of the old font-source/ - Remove the old yarn-update workflow and its configs and workflows Related: WeblateOrg#12172
1 parent fec5175 commit 1d1dd20

File tree

94 files changed

+303
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+303
-64
lines changed

REUSE.toml

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ SPDX-License-Identifier = "OFL-1.1"
6767
path = "weblate/static/vendor/font-source/**"
6868
precedence = "aggregate"
6969

70+
[[annotations]]
71+
SPDX-FileCopyrightText = "Paul D. Hunt"
72+
SPDX-License-Identifier = "OFL-1.1"
73+
path = "weblate/static/js/vendor/fonts/**"
74+
precedence = "aggregate"
75+
7076
[[annotations]]
7177
SPDX-FileCopyrightText = "Lea Verou"
7278
SPDX-License-Identifier = "MIT"

client/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
"multi.js": "0.5.3",
2020
"prismjs": "1.29.0",
2121
"slugify": "1.6.6",
22+
"source-code-pro": "2.38.0",
23+
"source-sans": "3.46.0",
2224
"tributejs": "5.1.3"
2325
},
2426
"devDependencies": {

client/src/fonts.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright © Michal Čihař <michal@weblate.org>
2+
//
3+
// SPDX-License-Identifier: GPL-3.0-or-later
4+
5+
// Importing font styles, when built will include also
6+
// the font assets they depend on, automatically
7+
import "source-code-pro/source-code-pro.css";
8+
import "source-sans/source-sans-3.css";

client/webpack.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ module.exports = {
131131
mousetrap: "./src/mousetrap.js",
132132
prismjs: "./src/prismjs.js",
133133
altcha: "./src/altcha.js",
134+
"fonts/fonts": "./src/fonts.js",
134135
},
135136
mode: "production",
136137
optimization: {
@@ -152,6 +153,13 @@ module.exports = {
152153
test: /\.css$/,
153154
use: [MiniCssExtractPlugin.loader, "css-loader"],
154155
},
156+
{
157+
test: /\.(woff|woff2|eot|ttf|otf)$/i,
158+
type: "asset/resource",
159+
generator: {
160+
filename: "fonts/font-source/[hash][ext]",
161+
},
162+
},
155163
],
156164
},
157165
plugins: [

client/yarn.lock

+10
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,11 @@ slugify@1.6.6:
962962
resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.6.6.tgz#2d4ac0eacb47add6af9e04d3be79319cbcc7924b"
963963
integrity sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==
964964

965+
source-code-pro@2.38.0:
966+
version "2.38.0"
967+
resolved "https://registry.yarnpkg.com/source-code-pro/-/source-code-pro-2.38.0.tgz#85c57689f7386bb9d0515fb00ba4845bfb7b485b"
968+
integrity sha512-JMXu7l3XrLREG17eEwY66ANG9716WTu6OeNvZfRKQKANEvbSERDZjk5AYTHeV6owQNPQTeiiW3ri2Ou93XFGvg==
969+
965970
source-map-js@^1.2.1:
966971
version "1.2.1"
967972
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46"
@@ -980,6 +985,11 @@ source-map@^0.6.0:
980985
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
981986
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
982987

988+
source-sans@3.46.0:
989+
version "3.46.0"
990+
resolved "https://registry.yarnpkg.com/source-sans/-/source-sans-3.46.0.tgz#6af0a47ead682fa8971f0c83e9692e75ef3cbb86"
991+
integrity sha512-bVC2YX4VNiv5vMcy77dL0XKsNp794ThfynNsr+FqSAwk8TGG0pZsg7eUQi6yHwaRBMVmZ3Aaf4FY46dxIIGgsg==
992+
983993
spdx-exceptions@^2.1.0:
984994
version "2.5.0"
985995
resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz#5d607d27fc806f66d7b64a766650fa890f04ed66"

scripts/yarn-update

+1-30
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,7 @@
44
#
55
# SPDX-License-Identifier: GPL-3.0-or-later
66

7-
# Wrapper around yarn to update our javascript dependencies
8-
set -e
9-
10-
cd scripts/yarn/
11-
12-
yarn install --check-files
13-
14-
# Source Sans/Code Pro fonts
15-
sed '/font-family/ a font-display: swap;' < node_modules/source-sans/source-sans-3.css > ../../weblate/static/vendor/font-source/source-sans-3.css
16-
sed '/font-family/ a font-display: swap;' < node_modules/source-code-pro/source-code-pro.css > ../../weblate/static/vendor/font-source/source-code-pro.css
17-
find node_modules/source-sans/WOFF node_modules/source-sans/WOFF2 node_modules/source-sans/TTF node_modules/source-code-pro/ \
18-
-name 'SourceSans3-ExtraLight.*' \
19-
-o -name 'SourceSans3-Light.*' \
20-
-o -name 'SourceSans3-Semibold.*' \
21-
-o -name 'SourceSans3-Black.*' \
22-
-o -name 'SourceSans3-Bold.*' \
23-
-o -name 'SourceSans3-Regular.*' \
24-
-o -name 'SourceSans3-It.*' \
25-
-o -name 'SourceSans3-BoldIt.*' \
26-
-o -name 'SourceCodePro-Medium.*' \
27-
-o -name 'SourceCodePro-Regular.*' \
28-
-o -name 'SourceCodePro-Bold.*' \
29-
-o -name 'SourceCodePro-Semibold.*' | while read -r name; do
30-
target=$(echo "$name" | sed 's@node_modules/source-\(sans\|code-pro\)/@../../weblate/static/vendor/font-source/@')
31-
dir=$(dirname "$target")
32-
if [ ! -d "$dir" ]; then
33-
mkdir -p "$dir"
34-
fi
35-
cp "$name" "$target"
36-
done
7+
echo Deprecated
378

389
# Not updated:
3910
# Bootstrap, use online customizer

scripts/yarn/.gitignore

-1
This file was deleted.

scripts/yarn/package.json

-10
This file was deleted.

scripts/yarn/yarn.lock

-13
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)