-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Chore: Move old icons into legacy folder, make new folder for custom. #20990
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /* eslint-disable local-rules/enforce-umbraco-external-imports */ | ||
| import { readFileSync, writeFile, mkdir, rmSync } from 'fs'; | ||
| import * as pathModule from 'path'; | ||
| import * as globModule from 'tiny-glob'; | ||
|
|
@@ -15,6 +15,7 @@ | |
|
|
||
| const lucideSvgDirectory = 'node_modules/lucide-static/icons'; | ||
| const simpleIconsSvgDirectory = 'node_modules/simple-icons/icons'; | ||
| const customSvgDirectory = `${moduleDirectory}/svgs/custom`; | ||
|
|
||
| const IS_GITHUB_ACTIONS = process.env.GITHUB_ACTIONS === 'true'; | ||
|
|
||
|
|
@@ -124,11 +125,39 @@ | |
| } | ||
| }); | ||
|
|
||
| // Custom: | ||
| if (fileJSON['custom']) { | ||
| fileJSON['custom'].forEach((iconDef) => { | ||
| if (iconDef.file && iconDef.name) { | ||
| const path = customSvgDirectory + '/' + 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 { | ||
| errors.push(`[Custom] Could not load file: '${path}'`); | ||
| console.log(`[Custom] Could not load file: '${path}'`); | ||
|
Comment on lines
+148
to
+150
|
||
| } | ||
| } | ||
| }); | ||
| } | ||
|
|
||
|
Check warning on line 155 in src/Umbraco.Web.UI.Client/devops/icons/index.js
|
||
| return icons; | ||
| }; | ||
|
|
||
| const collectDiskIcons = async (icons) => { | ||
| const iconPaths = await glob(`${umbracoSvgDirectory}/icon-*.svg`); | ||
| const iconPaths = await glob(`${umbracoSvgDirectory}/legacy/icon-*.svg`); | ||
|
|
||
| iconPaths.forEach((path) => { | ||
| const rawData = readFileSync(path); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use path joining utility instead of string concatenation. Consider using Node.js
path.join()for more robust cross-platform path handling.