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

Move source-code fonts to new build workflow #13093

Merged
merged 15 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
2 changes: 1 addition & 1 deletion REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ precedence = "aggregate"
[[annotations]]
SPDX-FileCopyrightText = "Paul D. Hunt"
SPDX-License-Identifier = "OFL-1.1"
path = "weblate/static/vendor/font-source/**"
path = "weblate/static/js/vendor/fonts/**"
precedence = "aggregate"

[[annotations]]
Expand Down
2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"multi.js": "0.5.3",
"prismjs": "1.29.0",
"slugify": "1.6.6",
"source-code-pro": "2.38.0",
"source-sans": "3.46.0",
"tributejs": "5.1.3"
},
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions client/src/fonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright © Michal Čihař <[email protected]>
//
// SPDX-License-Identifier: GPL-3.0-or-later

// Importing font styles, when built will include also
// the font assets they depend on, automatically
import "source-code-pro/source-code-pro.css";
import "source-sans/source-sans-3.css";
8 changes: 8 additions & 0 deletions client/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ module.exports = {
mousetrap: "./src/mousetrap.js",
prismjs: "./src/prismjs.js",
altcha: "./src/altcha.js",
"fonts/fonts": "./src/fonts.js",
},
mode: "production",
optimization: {
Expand All @@ -152,6 +153,13 @@ module.exports = {
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
generator: {
filename: "fonts/font-source/[name][ext]",
},
},
nijel marked this conversation as resolved.
Show resolved Hide resolved
],
},
plugins: [
Expand Down
10 changes: 10 additions & 0 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/slugify/-/slugify-1.6.6.tgz#2d4ac0eacb47add6af9e04d3be79319cbcc7924b"
integrity sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==

[email protected]:
version "2.38.0"
resolved "https://registry.yarnpkg.com/source-code-pro/-/source-code-pro-2.38.0.tgz#85c57689f7386bb9d0515fb00ba4845bfb7b485b"
integrity sha512-JMXu7l3XrLREG17eEwY66ANG9716WTu6OeNvZfRKQKANEvbSERDZjk5AYTHeV6owQNPQTeiiW3ri2Ou93XFGvg==

source-map-js@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46"
Expand All @@ -967,6 +972,11 @@ source-map@^0.6.0:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==

[email protected]:
version "3.46.0"
resolved "https://registry.yarnpkg.com/source-sans/-/source-sans-3.46.0.tgz#6af0a47ead682fa8971f0c83e9692e75ef3cbb86"
integrity sha512-bVC2YX4VNiv5vMcy77dL0XKsNp794ThfynNsr+FqSAwk8TGG0pZsg7eUQi6yHwaRBMVmZ3Aaf4FY46dxIIGgsg==

spdx-exceptions@^2.1.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz#5d607d27fc806f66d7b64a766650fa890f04ed66"
Expand Down
13 changes: 8 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ def setup(app) -> None:
indextemplate="pair: %s; configuration value",
)

font_dirs: list[str] = []
font_dirs: list[str] = [
str(weblate_dir / font_dir)
for font_dir in (
"weblate/static/js/vendor/fonts/font-source/",
"weblate/static/vendor/font-kurinto/",
)
]
meel-hd marked this conversation as resolved.
Show resolved Hide resolved

for font_location in font_locations:
font_dir = weblate_dir / font_location
Expand Down Expand Up @@ -152,10 +158,7 @@ def setup(app) -> None:
},
}

html_css_files = [
"https://weblate.org/static/vendor/font-source/source-sans-3.css",
"https://weblate.org/static/vendor/font-source/source-code-pro.css",
]
html_css_files = ["https://s.weblate.org/cdn/js/vendor/fonts/fonts.css"]

# -- Options for HTMLHelp output ---------------------------------------------

Expand Down
40 changes: 0 additions & 40 deletions scripts/yarn-update
meel-hd marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

1 change: 0 additions & 1 deletion scripts/yarn/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/yarn/package.json

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/yarn/yarn.lock

This file was deleted.

4 changes: 3 additions & 1 deletion weblate/fonts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def configure_fontconfig() -> None:
FONTCONFIG_CONFIG.format(
data_dir("cache", "fonts"),
fonts_dir,
os.path.join(settings.STATIC_ROOT, "vendor", "font-source", "TTF"),
os.path.join(
settings.STATIC_ROOT, "js", "vendor", "fonts", "font-source"
),
os.path.join(settings.STATIC_ROOT, "vendor", "font-kurinto"),
)
)
Expand Down
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.
Loading
Loading