diff --git a/projects/icons-fontawesome/scripts/prepare-icons.ts b/projects/icons-fontawesome/scripts/prepare-icons.ts index 29cf9462b597..b4ca2ebdaceb 100644 --- a/projects/icons-fontawesome/scripts/prepare-icons.ts +++ b/projects/icons-fontawesome/scripts/prepare-icons.ts @@ -3,68 +3,58 @@ import fs from 'node:fs'; import path from 'node:path'; import {PAYMENTS_ICONS} from '../../../scripts/custom-icons'; +import {prepareSvg} from '../../../scripts/prepare-svg'; import {tuiIsCI} from '../../cdk/schematics'; const verbose = !tuiIsCI(); +const dest = + process.argv[2] || path.join(process.cwd(), 'projects', 'icons-fontawesome', 'src'); + +// 1. copy fontawesome icons +['brands', 'regular', 'solid'].forEach((type) => { + const src = path.join( + process.cwd(), + 'node_modules', + '@fortawesome', + 'fontawesome-free', + 'svgs', + type, + ); -(function main(): void { - const dest = - process.argv[2] || - path.join(process.cwd(), 'projects', 'icons-fontawesome', 'src'); - - // 1. copy fontawesome icons - ['brands', 'regular', 'solid'].forEach((type) => { - const src = path.join( - process.cwd(), - 'node_modules', - '@fortawesome', - 'fontawesome-free', - 'svgs', - type, - ); - - // noinspection DuplicatedCode - fs.readdirSync(src).forEach((filename: string) => { - const content = fs - .readFileSync(path.join(src, filename), 'utf-8') - .replace(/class="[a-zA-Z0-9:;.\s()\-,]*"/, '') - .replaceAll( - /<(circle|ellipse|line|polygon|polyline|path|rect)/g, - '<$1 vector-effect="non-scaling-stroke"', - ); - - const filePath = path.join(dest, 'fa', type, filename); - - fs.mkdirSync(path.dirname(filePath), {recursive: true}); - fs.writeFileSync(filePath, content); - - verbose && console.info('copied:', filePath); - }); - }); - - // 2. copy flags from design tokens // noinspection DuplicatedCode - const flagsDir = path.resolve('node_modules/@taiga-ui/design-tokens/icons/flags'); - - fs.readdirSync(flagsDir).forEach((filename: string) => { - const content = fs.readFileSync(path.join(flagsDir, filename), 'utf-8'); - const filePath = path.join(dest, 'flags', filename); + fs.readdirSync(src).forEach((filename: string) => { + const content = prepareSvg(fs.readFileSync(path.join(src, filename), 'utf-8')); + const filePath = path.join(dest, 'fa', type, filename); fs.mkdirSync(path.dirname(filePath), {recursive: true}); fs.writeFileSync(filePath, content); verbose && console.info('copied:', filePath); }); +}); - // 3. copy payment icons - PAYMENTS_ICONS.forEach((filename) => { - const filePath = path.join('projects/icons/src', `${filename}.svg`); +// 2. copy flags from design tokens +// noinspection DuplicatedCode +const flagsDir = path.resolve('node_modules/@taiga-ui/design-tokens/icons/flags'); - fs.writeFileSync( - path.join(dest, `${filename}.svg`), - fs.readFileSync(path.join(filePath), 'utf-8'), - ); +fs.readdirSync(flagsDir).forEach((filename: string) => { + const content = fs.readFileSync(path.join(flagsDir, filename), 'utf-8'); + const filePath = path.join(dest, 'flags', filename); - verbose && console.info('copied:', filePath); - }); -})(); + fs.mkdirSync(path.dirname(filePath), {recursive: true}); + fs.writeFileSync(filePath, content); + + verbose && console.info('copied:', filePath); +}); + +// 3. copy payment icons +PAYMENTS_ICONS.forEach((filename) => { + const filePath = path.join('projects/icons/src', `${filename}.svg`); + + fs.writeFileSync( + path.join(dest, `${filename}.svg`), + fs.readFileSync(path.join(filePath), 'utf-8'), + ); + + verbose && console.info('copied:', filePath); +}); diff --git a/projects/icons-fontawesome/src/fa/brands/42-group.svg b/projects/icons-fontawesome/src/fa/brands/42-group.svg index 4b0d54451c53..f3d68c6a114f 100644 --- a/projects/icons-fontawesome/src/fa/brands/42-group.svg +++ b/projects/icons-fontawesome/src/fa/brands/42-group.svg @@ -1,5 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/projects/icons-fontawesome/src/fa/brands/html5.svg b/projects/icons-fontawesome/src/fa/brands/html5.svg index 006be57d4742..75c7e2b21ae1 100644 --- a/projects/icons-fontawesome/src/fa/brands/html5.svg +++ b/projects/icons-fontawesome/src/fa/brands/html5.svg @@ -1,5 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/projects/icons-fontawesome/src/fa/solid/city.svg b/projects/icons-fontawesome/src/fa/solid/city.svg index 039ca9c112de..fb35180ccc10 100644 --- a/projects/icons-fontawesome/src/fa/solid/city.svg +++ b/projects/icons-fontawesome/src/fa/solid/city.svg @@ -1,5 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/projects/icons-fontawesome/src/fa/solid/square-h.svg b/projects/icons-fontawesome/src/fa/solid/square-h.svg index f7bf9eb0d889..8bdf7528eab9 100644 --- a/projects/icons-fontawesome/src/fa/solid/square-h.svg +++ b/projects/icons-fontawesome/src/fa/solid/square-h.svg @@ -1,5 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { + const src = path.join( + process.cwd(), + 'node_modules', + '@material-design-icons', + 'svg', + type, + ); + + fs.readdirSync(src).forEach((filename: string) => { + const content = prepareSvg(fs.readFileSync(path.join(src, filename), 'utf-8')); + const filePath = path.join(dest, 'material', type, filename); -(function main(): void { - const dest = - process.argv[2] || path.join(process.cwd(), 'projects', 'icons-material', 'src'); - - // 1. copy material icons - ['filled', 'outlined', 'round', 'sharp', 'two-tone'].forEach((type) => { - const src = path.join( - process.cwd(), - 'node_modules', - '@material-design-icons', - 'svg', - type, - ); - - fs.readdirSync(src).forEach((filename: string) => { - const content = fs - .readFileSync(path.join(src, filename), 'utf-8') - .replace(/class="[a-zA-Z0-9:;.\s()\-,]*"/, '') - .replaceAll( - /<(circle|ellipse|line|polygon|polyline|path|rect)/g, - '<$1 vector-effect="non-scaling-stroke"', - ); - - const filePath = path.join(dest, 'material', type, filename); - - fs.mkdirSync(path.dirname(filePath), {recursive: true}); - fs.writeFileSync(filePath, content); + fs.mkdirSync(path.dirname(filePath), {recursive: true}); + fs.writeFileSync(filePath, content); - verbose && console.info('copied:', filePath); - }); + verbose && console.info('copied:', filePath); }); +}); - // 2. copy flags from design tokens - const flagsDir = path.resolve('node_modules/@taiga-ui/design-tokens/icons/flags'); +// 2. copy flags from design tokens +const flagsDir = path.resolve('node_modules/@taiga-ui/design-tokens/icons/flags'); - fs.readdirSync(flagsDir).forEach((filename: string) => { - const content = fs.readFileSync(path.join(flagsDir, filename), 'utf-8'); - const filePath = path.join(dest, 'flags', filename); +fs.readdirSync(flagsDir).forEach((filename: string) => { + const content = fs.readFileSync(path.join(flagsDir, filename), 'utf-8'); + const filePath = path.join(dest, 'flags', filename); - fs.mkdirSync(path.dirname(filePath), {recursive: true}); - fs.writeFileSync(filePath, content); + fs.mkdirSync(path.dirname(filePath), {recursive: true}); + fs.writeFileSync(filePath, content); - verbose && console.info('copied:', filePath); - }); + verbose && console.info('copied:', filePath); +}); - // 3. copy payment icons - PAYMENTS_ICONS.forEach((filename) => { - const filePath = path.join('projects/icons/src', `${filename}.svg`); +// 3. copy payment icons +PAYMENTS_ICONS.forEach((filename) => { + const filePath = path.join('projects/icons/src', `${filename}.svg`); - fs.writeFileSync( - path.join(dest, `${filename}.svg`), - fs.readFileSync(path.join(filePath), 'utf-8'), - ); + fs.writeFileSync( + path.join(dest, `${filename}.svg`), + fs.readFileSync(path.join(filePath), 'utf-8'), + ); - verbose && console.info('copied:', filePath); - }); -})(); + verbose && console.info('copied:', filePath); +}); diff --git a/projects/icons/scripts/prepare-icons.ts b/projects/icons/scripts/prepare-icons.ts index 3b1e9cfeaa02..ed7460127192 100644 --- a/projects/icons/scripts/prepare-icons.ts +++ b/projects/icons/scripts/prepare-icons.ts @@ -2,47 +2,39 @@ import fs from 'node:fs'; import path from 'node:path'; +import {prepareSvg} from '../../../scripts/prepare-svg'; import {tuiIsCI} from '../../cdk/schematics'; const verbose = !tuiIsCI(); - -(function main(): void { - const src = path.join(process.cwd(), 'node_modules', 'lucide-static', 'icons'); - const dest = process.argv[2] || path.join(process.cwd(), 'projects', 'icons', 'src'); - - fs.readdirSync(src).forEach((filename: string) => { - const filledFilename = renameToFilled(filename); - const content = fs - .readFileSync(path.join(src, filename), 'utf-8') - .replace(/class="[a-zA-Z0-9:;.\s()\-,]*"/, '') - .replaceAll( - /<(circle|ellipse|line|polygon|polyline|path|rect)/g, - '<$1 vector-effect="non-scaling-stroke"', - ); - const filled = content.replaceAll('fill="none"', 'fill="currentColor"'); - const filePath = path.join(dest, filename); - const fileFilledPath = path.join(dest, filledFilename); - - fs.writeFileSync(filePath, content); - verbose && console.info('copied:', filePath); - - fs.writeFileSync(fileFilledPath, filled); - verbose && console.info('copied:', fileFilledPath); - }); - - // 2. copy flags from design tokens - // noinspection DuplicatedCode - const flagsDir = path.resolve('node_modules/@taiga-ui/design-tokens/icons/flags'); - - fs.readdirSync(flagsDir).forEach((filename: string) => { - const content = fs.readFileSync(path.join(flagsDir, filename), 'utf-8'); - const filePath = path.join(dest, 'flags', filename); - - fs.mkdirSync(path.dirname(filePath), {recursive: true}); - fs.writeFileSync(filePath, content); - verbose && console.info('copied:', filePath); - }); -})(); +const src = path.join(process.cwd(), 'node_modules', 'lucide-static', 'icons'); +const dest = process.argv[2] || path.join(process.cwd(), 'projects', 'icons', 'src'); + +fs.readdirSync(src).forEach((filename: string) => { + const filledFilename = renameToFilled(filename); + const content = prepareSvg(fs.readFileSync(path.join(src, filename), 'utf-8')); + const filled = content.replaceAll('fill="none"', 'fill="currentColor"'); + const filePath = path.join(dest, filename); + const fileFilledPath = path.join(dest, filledFilename); + + fs.writeFileSync(filePath, content); + verbose && console.info('copied:', filePath); + + fs.writeFileSync(fileFilledPath, filled); + verbose && console.info('copied:', fileFilledPath); +}); + +// 2. copy flags from design tokens +// noinspection DuplicatedCode +const flagsDir = path.resolve('node_modules/@taiga-ui/design-tokens/icons/flags'); + +fs.readdirSync(flagsDir).forEach((filename: string) => { + const content = fs.readFileSync(path.join(flagsDir, filename), 'utf-8'); + const filePath = path.join(dest, 'flags', filename); + + fs.mkdirSync(path.dirname(filePath), {recursive: true}); + fs.writeFileSync(filePath, content); + verbose && console.info('copied:', filePath); +}); function renameToFilled(filename: string): string { const [name, extension] = filename.split('.'); diff --git a/projects/icons/src/a-arrow-down-filled.svg b/projects/icons/src/a-arrow-down-filled.svg index a889650964b8..f85c021add46 100644 --- a/projects/icons/src/a-arrow-down-filled.svg +++ b/projects/icons/src/a-arrow-down-filled.svg @@ -1,4 +1,3 @@ - /g, ''); +}