@openeuropa/bcl-theme-joinup 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bcl-builder.config.js +13 -2
- package/bin/copy-fonts.js +73 -0
- package/package.json +7 -8
package/bcl-builder.config.js
CHANGED
|
@@ -34,11 +34,17 @@ const resolvePackagePath = (packageName, ...segments) => {
|
|
|
34
34
|
|
|
35
35
|
const outputFolder = path.resolve(__dirname);
|
|
36
36
|
const repoRoot = path.resolve(__dirname, "../../../");
|
|
37
|
-
const nodeModules = path.resolve(__dirname, "../../../node_modules");
|
|
38
37
|
const toOutputRelativePath = (targetPath) =>
|
|
39
38
|
path.relative(outputFolder, targetPath);
|
|
40
39
|
const toOutputRelativePackagePath = (packagePath, ...segments) =>
|
|
41
40
|
toOutputRelativePath(path.resolve(packagePath, ...segments));
|
|
41
|
+
const toPackageImportPath = (packageName) => {
|
|
42
|
+
const packagePath = resolvePackagePath(packageName);
|
|
43
|
+
|
|
44
|
+
return packageName.startsWith("@")
|
|
45
|
+
? path.dirname(path.dirname(packagePath))
|
|
46
|
+
: path.dirname(packagePath);
|
|
47
|
+
};
|
|
42
48
|
const getCopyUpToGlobBase = (sourceGlob) =>
|
|
43
49
|
path
|
|
44
50
|
.normalize(sourceGlob.split("**")[0])
|
|
@@ -61,7 +67,12 @@ const bootstrapReplaceIconsPath = path.resolve(
|
|
|
61
67
|
);
|
|
62
68
|
|
|
63
69
|
// SCSS includePaths
|
|
64
|
-
const includePaths = [
|
|
70
|
+
const includePaths = [
|
|
71
|
+
...new Set([
|
|
72
|
+
toPackageImportPath("@openeuropa/bcl-bootstrap"),
|
|
73
|
+
toPackageImportPath("@openeuropa/bcl-theme-default"),
|
|
74
|
+
]),
|
|
75
|
+
];
|
|
65
76
|
const silenceDeprecations = [
|
|
66
77
|
"legacy-js-api",
|
|
67
78
|
"import",
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const outputDir = path.resolve(__dirname, "..", "fonts");
|
|
7
|
+
|
|
8
|
+
const resolvePackagePath = (packageName) => {
|
|
9
|
+
let packageRoot;
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
packageRoot = path.dirname(
|
|
13
|
+
require.resolve(`${packageName}/package.json`, { paths: [__dirname] }),
|
|
14
|
+
);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error.code !== "ERR_PACKAGE_PATH_NOT_EXPORTED") {
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let currentPath = fs.realpathSync(
|
|
21
|
+
require.resolve(packageName, { paths: [__dirname] }),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
while (!packageRoot) {
|
|
25
|
+
currentPath = path.dirname(currentPath);
|
|
26
|
+
|
|
27
|
+
if (fs.existsSync(path.resolve(currentPath, "package.json"))) {
|
|
28
|
+
packageRoot = currentPath;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return fs.realpathSync(packageRoot);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const robotoPath = resolvePackagePath("@fontsource/roboto");
|
|
37
|
+
const cssPattern = /^(?:lat|cyr|gree).+-(?:400|500|700).*\.css$/;
|
|
38
|
+
const fontPattern =
|
|
39
|
+
/^roboto-(?:latin.*|cyrillic|greek)-(?:400|500|700)-.+\.woff2?$/;
|
|
40
|
+
|
|
41
|
+
fs.mkdirSync(path.join(outputDir, "files"), { recursive: true });
|
|
42
|
+
|
|
43
|
+
let copiedFiles = 0;
|
|
44
|
+
|
|
45
|
+
for (const fileName of fs.readdirSync(robotoPath)) {
|
|
46
|
+
if (!cssPattern.test(fileName)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fs.copyFileSync(
|
|
51
|
+
path.join(robotoPath, fileName),
|
|
52
|
+
path.join(outputDir, fileName),
|
|
53
|
+
);
|
|
54
|
+
copiedFiles += 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for (const fileName of fs.readdirSync(path.join(robotoPath, "files"))) {
|
|
58
|
+
if (!fontPattern.test(fileName)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
fs.copyFileSync(
|
|
63
|
+
path.join(robotoPath, "files", fileName),
|
|
64
|
+
path.join(outputDir, "files", fileName),
|
|
65
|
+
);
|
|
66
|
+
copiedFiles += 1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (copiedFiles === 0) {
|
|
70
|
+
throw new Error("No Roboto font files were copied.");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.log(`Copied ${copiedFiles} Roboto font files.`);
|
package/package.json
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
"name": "@openeuropa/bcl-theme-joinup",
|
|
3
3
|
"author": "European Commission",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
|
-
"version": "1.13.
|
|
5
|
+
"version": "1.13.2",
|
|
6
6
|
"description": "OE - BCL theme joinup",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"align-templates": "lerna --scope \"@openeuropa/bcl-twig-templates\" run prepublish",
|
|
9
9
|
"build": "npm-run-all 'build:*'",
|
|
10
|
-
"build:fonts
|
|
11
|
-
"build:font-files": "copyfiles -u 6 ../../../node_modules/@fontsource/roboto/files/roboto-{latin*,cyrillic,greek}-{400,500,700}* fonts",
|
|
10
|
+
"build:fonts": "node bin/copy-fonts.js",
|
|
12
11
|
"build:styles": "cross-env bcl-builder styles",
|
|
13
12
|
"build:scripts": "cross-env bcl-builder scripts",
|
|
14
13
|
"prebuild:copy": "rimraf templates",
|
|
@@ -29,10 +28,10 @@
|
|
|
29
28
|
"@ecl/resources-eu-logo": "3.13.0",
|
|
30
29
|
"@ecl/resources-flag-icons": "3.13.0",
|
|
31
30
|
"@fontsource/roboto": "5.2.9",
|
|
32
|
-
"@openeuropa/bcl-bootstrap": "^1.13.
|
|
33
|
-
"@openeuropa/bcl-builder": "^1.13.
|
|
34
|
-
"@openeuropa/bcl-theme-default": "^1.13.
|
|
35
|
-
"@openeuropa/bcl-twig-templates": "^1.13.
|
|
31
|
+
"@openeuropa/bcl-bootstrap": "^1.13.2",
|
|
32
|
+
"@openeuropa/bcl-builder": "^1.13.2",
|
|
33
|
+
"@openeuropa/bcl-theme-default": "^1.13.2",
|
|
34
|
+
"@openeuropa/bcl-twig-templates": "^1.13.2",
|
|
36
35
|
"@rollup/plugin-replace": "6.0.3",
|
|
37
36
|
"copyfiles": "2.4.1",
|
|
38
37
|
"cross-env": "10.1.0",
|
|
@@ -58,5 +57,5 @@
|
|
|
58
57
|
"design-system",
|
|
59
58
|
"twig"
|
|
60
59
|
],
|
|
61
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "13e3e4489e4ab19744c8231f0f84bd9e5dfd92f4"
|
|
62
61
|
}
|