V15: Update Backoffice NPM dependencies (#18376)

* build(deps-dev): update storybook from 8.4.7 to 8.5.6

* build(deps): update tiptap from 2.11.2 to 2.11.5

* build(deps-dev): update eslint stuff to latest

* build(deps): update element-internals-polyfill from 1.3.12 to 1.3.13

* build(deps): update marked from 15.0.6 to 15.0.7

* build(deps-dev): update vite from 5.4.14 to 6.1.0

* build(deps-dev): update globals to 15.15.0 (eslint dependency)

* build(deps): update icon libraries to latest

* build(deps-dev): update prettier from 3.4.2 to 3.5.1

* chore: generate consts

* build(deps-dev): update test-related libraries

* feat: copy over code from the tiny base64-js library because it is not exported as esm and has not been updated in 4 years

* build(deps-dev): remove dependency from base64-js

* build(deps-dev): upgrade rollup dependencies

* test: disable tests for tinyce

* build(deps-dev): update @babel/core to 7.26.9

* build(deps): update storybook to latest

* build(deps-dev): update types

* build(deps-dev): update typedoc from 0.27.6 to 0.27.7

* build(deps-dev): update @rollup/plugin-commonjs to latest

* build(deps): import tiny as default and re-export as module and default to make everyone happy (and avoid commonjs pitfalls)

* build: remove dependency on commonjs to build externals

* build(deps-dev): uninstall @rollup/plugin-commonjs as it is no longer needed

* test: reenable tinymce tests

* fix: sets a default label

this mistake was highlighted by the test runner

* test: reenable tinymce tests

* build: ignores autogenerated test file

* build: adds github error logging to icon generator

* build: log as error

* build: adds tests for generate:* scripts

* build: optimises icons with svgo to remove useless things like comments

this also ensures that icons are unchanged when we upgrade icon library packages as they would normally include things like versions as comments in the files
This commit is contained in:
Jacob Overgaard
2025-02-20 11:29:54 +01:00
committed by GitHub
parent 5401a85828
commit 7a7602f1bb
682 changed files with 2976 additions and 11649 deletions

View File

@@ -1,6 +1,7 @@
import { readFileSync, writeFile, mkdir, rmSync } from 'fs';
import * as globModule from 'tiny-glob';
import * as pathModule from 'path';
import { optimize } from 'svgo';
const path = pathModule.default;
const getDirName = path.dirname;
@@ -14,6 +15,10 @@ const iconMapJson = `${moduleDirectory}/icon-dictionary.json`;
const lucideSvgDirectory = 'node_modules/lucide-static/icons';
const simpleIconsSvgDirectory = 'node_modules/simple-icons/icons';
const IS_GITHUB_ACTIONS = process.env.GITHUB_ACTIONS === 'true';
const errors = [];
const run = async () => {
// Empty output directory:
rmSync(iconsOutputDirectory, { recursive: true });
@@ -55,6 +60,7 @@ const collectDictionaryIcons = async () => {
icons.push(icon);
} catch (e) {
errors.push(`[Lucide] Could not load file: '${path}'`);
console.log(`[Lucide] Could not load file: '${path}'`);
}
}
@@ -86,6 +92,7 @@ const collectDictionaryIcons = async () => {
icons.push(icon);
} catch (e) {
errors.push(`[SimpleIcons] Could not load file: '${path}'`);
console.log(`[SimpleIcons] Could not load file: '${path}'`);
}
}
@@ -111,6 +118,7 @@ const collectDictionaryIcons = async () => {
icons.push(icon);
} catch (e) {
errors.push(`[Umbraco] Could not load file: '${path}'`);
console.log(`[Umbraco] Could not load file: '${path}'`);
}
}
@@ -157,7 +165,9 @@ const collectDiskIcons = async (icons) => {
const writeIconsToDisk = (icons) => {
icons.forEach((icon) => {
const content = 'export default `' + icon.svg + '`;';
const optimizedResult = optimize(icon.svg);
const content = 'export default `' + optimizedResult.data + '`;';
writeFileWithDir(icon.output, content, (err) => {
if (err) {
@@ -199,10 +209,23 @@ const generateJS = (icons) => {
const writeFileWithDir = (path, contents, cb) => {
mkdir(getDirName(path), { recursive: true }, function (err) {
if (err) return cb(err);
if (err) {
errors.push(err);
return cb(err);
}
writeFile(path, contents, cb);
});
};
run();
await run();
if (errors.length > 0) {
if (IS_GITHUB_ACTIONS) {
const msg = errors.join('\n');
console.log(`::error title=Failed to generate all icons::${msg}`);
process.exit(1);
} else {
console.error('Failed to generate all icons, please see the error log');
}
}