diff --git a/packages/dnb-eufemia/assets/icons/dnb/fund_in.svg b/packages/dnb-eufemia/assets/icons/dnb/fund_in.svg
deleted file mode 100644
index a5fa2b95230..00000000000
--- a/packages/dnb-eufemia/assets/icons/dnb/fund_in.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/dnb-eufemia/assets/icons/dnb/fund_out.svg b/packages/dnb-eufemia/assets/icons/dnb/fund_out.svg
deleted file mode 100644
index 148821e90c4..00000000000
--- a/packages/dnb-eufemia/assets/icons/dnb/fund_out.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/packages/dnb-eufemia/assets/icons/dnb/products_account_percent_medium.svg b/packages/dnb-eufemia/assets/icons/dnb/products_account_percent_medium.svg
deleted file mode 100644
index c326eec72fc..00000000000
--- a/packages/dnb-eufemia/assets/icons/dnb/products_account_percent_medium.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.js b/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.js
index 2011556cc47..f8797267fb5 100644
--- a/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.js
+++ b/packages/dnb-eufemia/scripts/figma/tasks/assetsExtractors.js
@@ -23,10 +23,11 @@ import {
import properties from '../../../src/style/themes/theme-ui/properties'
import { create, extract } from 'tar'
-const ICON_SIZES = {
+export const ICON_SIZES = {
16: { suffix: '' },
24: { suffix: 'medium' },
}
+export const NAME_SEPARATOR = '_'
const iconPrimaryList = process.env.FIGMA_ICONS_PRIMARY_LIST || [
'chevron_left',
@@ -625,7 +626,9 @@ const makeMetaFile = async ({
// remove duplication
const cleanedName = Object.values(ICON_SIZES).reduce(
(iconName, { suffix }) =>
- suffix ? iconName.replace('_' + suffix, '') : iconName,
+ suffix
+ ? iconName.replace(NAME_SEPARATOR + suffix, '')
+ : iconName,
iconName
)
tags = tags.filter((item, index) => {
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx
index 39a9e732ee7..8bb884b4603 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/__tests__/convertSvgToJsx.test.tsx
@@ -24,7 +24,7 @@ beforeAll(async () => {
preventDelete: true,
srcPath: path.resolve(__dirname, './test-files/**/*.svg'),
destPath: path.resolve(__dirname, './test-files/dist'),
- customIconsLockFile: path.resolve(
+ customIconsLockFilePath: path.resolve(
__dirname,
'./test-files/dnb/icons-svg.lock'
),
diff --git a/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.js b/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.js
index 9c0568156ee..b5ff39f2805 100644
--- a/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.js
+++ b/packages/dnb-eufemia/scripts/prebuild/tasks/convertSvgToJsx.js
@@ -19,6 +19,8 @@ import { md5 } from '../../figma/helpers/docHelpers'
import {
IconsConfig,
readIconsLockFile,
+ ICON_SIZES,
+ NAME_SEPARATOR,
} from '../../figma/tasks/assetsExtractors'
import packpath from 'packpath'
@@ -29,7 +31,7 @@ export default async function convertSvgToJsx({
srcPath = './assets/icons/**/*.svg',
destPath = './src/icons',
preventDelete = false,
- customIconsLockFile = null,
+ customIconsLockFilePath = null,
} = {}) {
if (!preventDelete) {
await del(
@@ -70,12 +72,41 @@ export default async function convertSvgToJsx({
srcPath,
destPath,
assetsDir,
- customIconsLockFile,
+ customIconsLockFilePath,
})
log.succeed(
`> PrePublish: Converting "svg to jsx" for "${assetsDir}" is done (${icons.length} icons)`
)
+
+ await controllRoutine({ icons })
+ })
+}
+
+const controllRoutine = async ({ icons }) => {
+ const listOfIcons = Object.values(icons)
+
+ const sizes = Object.values(ICON_SIZES).filter(({ suffix }) => {
+ return Boolean(suffix)
+ })
+
+ sizes.forEach(({ suffix: size }) => {
+ listOfIcons.forEach(({ name: origName }) => {
+ const foundNames = listOfIcons.filter(({ name }) => {
+ if (origName.endsWith(`${NAME_SEPARATOR}${size}`)) {
+ return origName.replace(`${NAME_SEPARATOR}${size}`, '') === name
+ }
+ return `${origName}${NAME_SEPARATOR}${size}` === name
+ })
+
+ if (foundNames.length !== 1) {
+ log.fail(
+ `The icon "${origName}" was not found with another size${
+ origName.endsWith(size) ? '' : ` (${size})`
+ }! They should be looked up. The failure can be in several places.`
+ )
+ }
+ })
})
}
@@ -83,7 +114,7 @@ const transformSvg = async ({
srcPath,
destPath,
assetsDir,
- customIconsLockFile,
+ customIconsLockFilePath,
}) => {
try {
// create subfolder
@@ -97,7 +128,7 @@ const transformSvg = async ({
return await makeIconsEntryFiles({
destPath,
assetsDir,
- customIconsLockFile,
+ customIconsLockFilePath,
})
} catch (e) {
log.fail('Failed to run the convertSvgToJsx process')
@@ -184,7 +215,7 @@ const transformToJsx = (content, file) => {
const makeIconsEntryFiles = async ({
destPath,
assetsDir,
- customIconsLockFile = null,
+ customIconsLockFilePath = null,
}) => {
// get all the svg icons we find
const icons = (
@@ -215,18 +246,17 @@ const makeIconsEntryFiles = async ({
await generateFallbackIndexFiles({ icons, destPath, assetsDir })
}
- // get the svg lock file
- const { iconsLockFile } = IconsConfig({ assetsDir })
- const lockFileContent = await readIconsLockFile({
- file: customIconsLockFile || iconsLockFile,
- })
-
if (assetsDir === FALLBACK) {
await generateIndexFile({ icons, destPath, assetsDir: '' }) // generate fallback index file
}
await generateIndexFile({ icons, destPath, assetsDir })
- await generateGroupFiles({ icons, destPath, assetsDir, lockFileContent })
+ await generateGroupFiles({
+ icons,
+ destPath,
+ assetsDir,
+ customIconsLockFilePath,
+ })
return icons
}
@@ -275,8 +305,14 @@ const generateIndexFile = async ({ icons, destPath, assetsDir }) => {
const generateGroupFiles = async ({
destPath,
assetsDir,
- lockFileContent,
+ customIconsLockFilePath,
}) => {
+ // get the svg lock file
+ const { iconsLockFile } = IconsConfig({ assetsDir })
+ const lockFileContent = await readIconsLockFile({
+ file: customIconsLockFilePath || iconsLockFile,
+ })
+
// from the svg lock file we can generate groups out of the "bundleName"
const groups = Object.entries(lockFileContent).reduce(
(acc, [file, { bundleName }]) => {
diff --git a/packages/dnb-eufemia/src/icons/dnb/fund_in.tsx b/packages/dnb-eufemia/src/icons/dnb/fund_in.tsx
deleted file mode 100644
index 0a18ac9b5a5..00000000000
--- a/packages/dnb-eufemia/src/icons/dnb/fund_in.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-/** This file is auto generated by convertSvgToJsx.js */
-
-import React from 'react'
-const fund_in = (props) => (
-
-)
-export default fund_in
diff --git a/packages/dnb-eufemia/src/icons/dnb/fund_out.tsx b/packages/dnb-eufemia/src/icons/dnb/fund_out.tsx
deleted file mode 100644
index e01c6b4457e..00000000000
--- a/packages/dnb-eufemia/src/icons/dnb/fund_out.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-/** This file is auto generated by convertSvgToJsx.js */
-
-import React from 'react'
-const fund_out = (props) => (
-
-)
-export default fund_out
diff --git a/packages/dnb-eufemia/src/icons/dnb/index.ts b/packages/dnb-eufemia/src/icons/dnb/index.ts
index d6d58971356..01a2c064465 100644
--- a/packages/dnb-eufemia/src/icons/dnb/index.ts
+++ b/packages/dnb-eufemia/src/icons/dnb/index.ts
@@ -264,8 +264,6 @@ import fridge from './fridge'
import fridge_medium from './fridge_medium'
import fullscreen from './fullscreen'
import fullscreen_medium from './fullscreen_medium'
-import fund_in from './fund_in'
-import fund_out from './fund_out'
import funds from './funds'
import funds_in from './funds_in'
import funds_in_medium from './funds_in_medium'
@@ -426,7 +424,6 @@ import portfolio_analytics from './portfolio_analytics'
import portfolio_analytics_medium from './portfolio_analytics_medium'
import printer from './printer'
import printer_medium from './printer_medium'
-import products_account_percent_medium from './products_account_percent_medium'
import profile from './profile'
import profile_medium from './profile_medium'
import progress from './progress'
@@ -817,8 +814,6 @@ export {
fridge_medium,
fullscreen,
fullscreen_medium,
- fund_in,
- fund_out,
funds,
funds_in,
funds_in_medium,
@@ -979,7 +974,6 @@ export {
portfolio_analytics_medium,
printer,
printer_medium,
- products_account_percent_medium,
profile,
profile_medium,
progress,
diff --git a/packages/dnb-eufemia/src/icons/dnb/products_account_percent_medium.tsx b/packages/dnb-eufemia/src/icons/dnb/products_account_percent_medium.tsx
deleted file mode 100644
index 8cafecadd7f..00000000000
--- a/packages/dnb-eufemia/src/icons/dnb/products_account_percent_medium.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-/** This file is auto generated by convertSvgToJsx.js */
-
-import React from 'react'
-const products_account_percent_medium = (props) => (
-
-)
-export default products_account_percent_medium
diff --git a/packages/dnb-eufemia/src/icons/fund_in.ts b/packages/dnb-eufemia/src/icons/fund_in.ts
deleted file mode 100644
index 1b3ac959f2d..00000000000
--- a/packages/dnb-eufemia/src/icons/fund_in.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/** This file is auto generated by convertSvgToJsx.js */
-
-import icon from './dnb/fund_in'
-export default icon
diff --git a/packages/dnb-eufemia/src/icons/fund_out.ts b/packages/dnb-eufemia/src/icons/fund_out.ts
deleted file mode 100644
index dfcdc20dbd4..00000000000
--- a/packages/dnb-eufemia/src/icons/fund_out.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/** This file is auto generated by convertSvgToJsx.js */
-
-import icon from './dnb/fund_out'
-export default icon
diff --git a/packages/dnb-eufemia/src/icons/index.ts b/packages/dnb-eufemia/src/icons/index.ts
index 80566c9a12b..9bf8706f33f 100644
--- a/packages/dnb-eufemia/src/icons/index.ts
+++ b/packages/dnb-eufemia/src/icons/index.ts
@@ -264,8 +264,6 @@ import fridge from './dnb/fridge'
import fridge_medium from './dnb/fridge_medium'
import fullscreen from './dnb/fullscreen'
import fullscreen_medium from './dnb/fullscreen_medium'
-import fund_in from './dnb/fund_in'
-import fund_out from './dnb/fund_out'
import funds from './dnb/funds'
import funds_in from './dnb/funds_in'
import funds_in_medium from './dnb/funds_in_medium'
@@ -426,7 +424,6 @@ import portfolio_analytics from './dnb/portfolio_analytics'
import portfolio_analytics_medium from './dnb/portfolio_analytics_medium'
import printer from './dnb/printer'
import printer_medium from './dnb/printer_medium'
-import products_account_percent_medium from './dnb/products_account_percent_medium'
import profile from './dnb/profile'
import profile_medium from './dnb/profile_medium'
import progress from './dnb/progress'
@@ -817,8 +814,6 @@ export {
fridge_medium,
fullscreen,
fullscreen_medium,
- fund_in,
- fund_out,
funds,
funds_in,
funds_in_medium,
@@ -979,7 +974,6 @@ export {
portfolio_analytics_medium,
printer,
printer_medium,
- products_account_percent_medium,
profile,
profile_medium,
progress,
diff --git a/packages/dnb-eufemia/src/icons/products_account_percent_medium.ts b/packages/dnb-eufemia/src/icons/products_account_percent_medium.ts
deleted file mode 100644
index e3521b675f0..00000000000
--- a/packages/dnb-eufemia/src/icons/products_account_percent_medium.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-/** This file is auto generated by convertSvgToJsx.js */
-
-import icon from './dnb/products_account_percent_medium'
-export default icon