Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
aa66e1e
build(deps-dev): update storybook from 8.4.7 to 8.5.6
iOvergaard Feb 18, 2025
8a0620e
build(deps): update tiptap from 2.11.2 to 2.11.5
iOvergaard Feb 18, 2025
8d289bd
build(deps-dev): update eslint stuff to latest
iOvergaard Feb 18, 2025
8284043
build(deps): update element-internals-polyfill from 1.3.12 to 1.3.13
iOvergaard Feb 18, 2025
09eeeaf
build(deps): update marked from 15.0.6 to 15.0.7
iOvergaard Feb 18, 2025
977f7b8
build(deps-dev): update vite from 5.4.14 to 6.1.0
iOvergaard Feb 18, 2025
1efd603
build(deps-dev): update globals to 15.15.0 (eslint dependency)
iOvergaard Feb 18, 2025
8330be1
build(deps): update icon libraries to latest
iOvergaard Feb 18, 2025
c19d64a
build(deps-dev): update prettier from 3.4.2 to 3.5.1
iOvergaard Feb 18, 2025
d8aaee8
chore: generate consts
iOvergaard Feb 18, 2025
fa91a9b
build(deps-dev): update test-related libraries
iOvergaard Feb 18, 2025
ad6ca82
feat: copy over code from the tiny base64-js library because it is no…
iOvergaard Feb 18, 2025
435a542
build(deps-dev): remove dependency from base64-js
iOvergaard Feb 18, 2025
f43f0ec
build(deps-dev): upgrade rollup dependencies
iOvergaard Feb 18, 2025
f99f6b6
test: disable tests for tinyce
iOvergaard Feb 18, 2025
6700fa3
build(deps-dev): update @babel/core to 7.26.9
iOvergaard Feb 18, 2025
b654631
build(deps): update storybook to latest
iOvergaard Feb 18, 2025
33f88d0
build(deps-dev): update types
iOvergaard Feb 18, 2025
9bab388
build(deps-dev): update typedoc from 0.27.6 to 0.27.7
iOvergaard Feb 18, 2025
e5a40f4
build(deps-dev): update @rollup/plugin-commonjs to latest
iOvergaard Feb 18, 2025
3e7a5b3
build(deps): import tiny as default and re-export as module and defau…
iOvergaard Feb 19, 2025
d9dc5f1
build: remove dependency on commonjs to build externals
iOvergaard Feb 19, 2025
3d8d487
build(deps-dev): uninstall @rollup/plugin-commonjs as it is no longer…
iOvergaard Feb 19, 2025
db5c34a
test: reenable tinymce tests
iOvergaard Feb 19, 2025
603d913
fix: sets a default label
iOvergaard Feb 19, 2025
f67cf6f
test: reenable tinymce tests
iOvergaard Feb 19, 2025
fabb0c5
build: ignores autogenerated test file
iOvergaard Feb 19, 2025
42bda99
build: adds github error logging to icon generator
iOvergaard Feb 19, 2025
5244f08
build: log as error
iOvergaard Feb 19, 2025
26011b4
build: adds tests for generate:* scripts
iOvergaard Feb 19, 2025
6206020
build: optimises icons with svgo to remove useless things like comments
iOvergaard Feb 19, 2025
b262cac
Merge remote-tracking branch 'origin/v15/dev' into v15/feature/client…
iOvergaard Feb 19, 2025
dcc3d42
fix: storybook build error
iOvergaard Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .github/workflows/test-backoffice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
- name: Check for circular dependencies
run: node devops/circular/index.js src
- run: npm run lint:errors
- run: npm run generate:tsconfig
- run: npm run generate:icons
- run: npm run build:for:cms
- run: npm run check:paths
- run: npm run generate:jsonschema:dist
Expand Down
1 change: 1 addition & 0 deletions src/Umbraco.Web.UI.Client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dist-ssr

## testing
coverage/
utils/all-umb-consts/

# Editor directories and files
.vscode/*
Expand Down
29 changes: 26 additions & 3 deletions src/Umbraco.Web.UI.Client/devops/icons/index.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,6 +15,10 @@
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 });
Expand Down Expand Up @@ -55,62 +60,65 @@

icons.push(icon);
} catch (e) {
errors.push(`[Lucide] Could not load file: '${path}'`);
console.log(`[Lucide] Could not load file: '${path}'`);
}
}
});

// SimpleIcons:
fileJSON.simpleIcons.forEach((iconDef) => {
if (iconDef.file && iconDef.name) {
const path = simpleIconsSvgDirectory + '/' + iconDef.file;

try {
const rawData = readFileSync(path);
let svg = rawData.toString();
const iconFileName = iconDef.name;

// SimpleIcons need to use fill="currentColor"
const pattern = /fill=/g;
if (!pattern.test(svg)) {
svg = svg.replace(/<path/g, '<path fill="currentColor"');
}

const icon = {
name: iconDef.name,
legacy: iconDef.legacy,
fileName: iconFileName,
svg,
output: `${iconsOutputDirectory}/${iconFileName}.ts`,
};

icons.push(icon);
} catch (e) {
errors.push(`[SimpleIcons] Could not load file: '${path}'`);
console.log(`[SimpleIcons] Could not load file: '${path}'`);
}
}
});

// Umbraco:
fileJSON.umbraco.forEach((iconDef) => {
if (iconDef.file && iconDef.name) {
const path = umbracoSvgDirectory + '/' + iconDef.file;

try {
const rawData = readFileSync(path);
const svg = rawData.toString();
const iconFileName = iconDef.name;

const icon = {
name: iconDef.name,
legacy: iconDef.legacy,
fileName: iconFileName,
svg,
output: `${iconsOutputDirectory}/${iconFileName}.ts`,
};

icons.push(icon);
} catch (e) {
errors.push(`[Umbraco] Could not load file: '${path}'`);

Check warning on line 121 in src/Umbraco.Web.UI.Client/devops/icons/index.js

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (v15/dev)

❌ Getting worse: Complex Method

collectDictionaryIcons already has high cyclomatic complexity, and now it increases in Lines of Code from 74 to 77. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
console.log(`[Umbraco] Could not load file: '${path}'`);
}
}
Expand Down Expand Up @@ -157,7 +165,9 @@

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) {
Expand Down Expand Up @@ -199,10 +209,23 @@

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');
}
}
Loading
Loading