Skip to content

Commit

Permalink
chore: generate an array of icons used on demo-page (#5651)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin authored Oct 19, 2023
1 parent d27927b commit 5d44c31
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/auto-update-icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
npx nx build icons
npx ts-node ./scripts/generate-used-icons.ts
npx eslint ./projects/cdk/constants/used-icons.ts --fix
npx eslint ./projects/demo/used-icons.ts --fix
npx prettier ./projects/cdk/constants/used-icons.ts --write
npx prettier ./projects/demo/used-icons.ts --write
- uses: taiga-family/ci/actions/auto/[email protected]
with:
message: icons have changed
Expand Down
141 changes: 141 additions & 0 deletions projects/demo/used-icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/**
* @description:
* AUTOGENERATED
*
* Array of icons used in taiga-ui components
*/
export const TUI_USED_ICONS = [
`tuiIconCheck`,
`tuiIconAlertCircleLarge`,
`tuiIconButton`,
`tuiIconVolumeXLarge`,
`tuiIconMicOffLarge`,
`tuiIconPhoneForwardedLarge`,
`tuiIconClose`,
`tuiIconSearchLarge`,
`tuiIconCalendarLarge`,
`tuiIconVisaMono`,
`tuiIconMastercardMono`,
`tuiIconMailLarge`,
`tuiIconPieChartLarge`,
`tuiIconPrinterLarge`,
`tuiIconLoginLarge`,
`tuiIconStarLarge`,
`tuiIconBellLarge`,
`tuiIconFlagLarge`,
`tuiIconImageLarge`,
`tuiIconThumbsUpLarge`,
`tuiIconThumbsDownLarge`,
`tuiIconAlignJustifyLarge`,
`tuiIconUserLarge`,
`tuiIconSettingsLarge`,
`tuiIconMenuLarge`,
`tuiIconUser`,
`tuiIconHelpCircle`,
`tuiIconCheckCircleLarge`,
`tuiIconSettings`,
`tuiIconMoreHorizontal`,
`tuiIconArrowRight`,
`tuiIconEyeOff`,
`tuiIconHeartLarge`,
`tuiIconSearch`,
`tuiIconChevronLeftLarge`,
`tuiIconChevronRightLarge`,
`tuiIconCreditCardLarge`,
`tuiIconMoreVertical`,
`tuiIconChevronDownLarge`,
`tuiIconVisa`,
`tuiIconMaestro`,
`tuiIconMir`,
`tuiIconPlus`,
`tuiIconChevronDown`,
`tuiIconTrash`,
`tuiIconMessageSquareLarge`,
`tuiIconHelpCircleLarge`,
`tuiIconChevronRight`,
`tuiIconSortDown`,
`tuiIconArrowUpRightLarge`,
`tuiIconChevronUp`,
`tuiIconFileLarge`,
`tuiIconDropletLarge`,
`tuiIconUploadCloudLarge`,
`tuiIconClockLarge`,
`tuiIconEdit2Large`,
`tuiIconLockLarge`,
`tuiIconUnlockLarge`,
`tuiIconEye`,
`tuiIconVolumeX`,
`tuiIconVolume`,
`tuiIconCheckCircle`,
`tuiIconXCircle`,
`tuiIconMapPinLarge`,
`tuiIconMapPin`,
`tuiIconDownload`,
`tuiIconEyeOffLarge`,
`tuiIconEyeLarge`,
`tuiIconEdit2`,
`tuiIconVideoLarge`,
`tuiIconArrowUp`,
`tuiIconHeart`,
`tuiIconStar`,
`tuiIconPlusCircleLarge`,
`tuiIconMastercard`,
`tuiIconMusicLarge`,
`tuiIconMinus`,
`tuiIconPhoneLarge`,
`tuiIconMoreHorizontalLarge`,
`tuiIconCodeLarge`,
`tuiIconTerminalLarge`,
`tuiIconHrLarge`,
`tuiIconHomeLarge`,
`tuiIconCreditCard`,
`tuiIconPhone`,
`tuiIconAlertCircle`,
`tuiIconDragLarge`,
`tuiIconChevronLeft`,
`tuiIconCameraLarge`,
`tuiIconFolderLarge`,
`tuiIconCopy`,
`tuiIconFolder`,
`tuiIconPlayLarge`,
`tuiIconPauseLarge`,
`tuiIconBox`,
`tuiIconLock`,
`tuiIconUsers`,
`tuiIconCloseLarge`,
`tuiIconFrownLarge`,
`tuiIconMehLarge`,
`tuiIconSmileLarge`,
`tuiIconThumbsUp`,
`tuiIconThumbsDown`,
`tuiIconDeleteLarge`,
`tuiIconElectron`,
`tuiIconElectronMono`,
`tuiIconCirrus`,
`tuiIconMaestroMono`,
`tuiIconMirMono`,
`tuiIconUnionPay`,
`tuiIconJCB`,
`tuiIconPayPal`,
`tuiIconAmex`,
`tuiIconDinersClub`,
`tuiIconDiscover`,
`tuiIconHumo`,
`tuiIconRuPay`,
`tuiIconUzcard`,
`tuiIconVerve`,
`tuiIconApplePay`,
`tuiIconGooglePay`,
`tuiIconSamsungPay`,
`tuiIconWorldPay`,
`tuiIconAliPay`,
`tuiIconAmazonPay`,
`tuiIconAndroidPay`,
`tuiIconRedo`,
`tuiIconRefresh`,
`tuiIconRefreshLarge`,
`tuiIconSortUp`,
`tuiIconUndo`,
`tuiIconPaperclipLarge`,
`tuiIconTrashLarge`,
];
33 changes: 27 additions & 6 deletions scripts/generate-used-icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import {readdirSync, readFileSync, statSync, writeFileSync} from 'fs';
import {basename, join} from 'path';

(function main(): void {
generateProjectsUsedIcons();
generateDemoUsedIcons();
})();

function generateProjectsUsedIcons(): void {
const rootDirectory = process.env.ROOT_FOLDER || `./projects`;
const excludedFolders = [
`demo`,
Expand All @@ -18,15 +23,31 @@ import {basename, join} from 'path';
const excludedNames = [`tuiIconButton`];

generateUsedIcons(rootDirectory, {excludedFolders, excludedNames, excludedFiles});
})();
}

function generateDemoUsedIcons(): void {
const rootDirectory = process.env.ROOT_DEMO_FOLDER || `./projects/demo`;
const excludedFiles = [`used-icons.ts`];

generateUsedIcons(rootDirectory, {
excludedFiles,
writeTo: `./projects/demo/used-icons.ts`,
});
}

function generateUsedIcons(
rootDirectory: string,
{
excludedFolders,
excludedNames,
excludedFiles,
}: {excludedFiles: string[]; excludedFolders: string[]; excludedNames: string[]},
excludedFolders = [],
excludedNames = [],
excludedFiles = [],
writeTo = `./projects/cdk/constants/used-icons.ts`,
}: {
excludedFiles?: string[];
excludedFolders?: string[];
excludedNames?: string[];
writeTo?: string;
},
): void {
const tuiIconNames = findTuiIconNames(rootDirectory, {
excludedFolders,
Expand All @@ -35,7 +56,7 @@ function generateUsedIcons(
});

writeFileSync(
`./projects/cdk/constants/used-icons.ts`,
writeTo,
`/**
* @description:
* AUTOGENERATED
Expand Down

0 comments on commit 5d44c31

Please sign in to comment.