material-icon-theme 4.26.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/material-icons.json +5704 -0
- package/icons/file.svg +1 -0
- package/icons/folder-open.svg +1 -0
- package/icons/folder-root-open.svg +1 -0
- package/icons/folder-root.svg +1 -0
- package/icons/folder.svg +1 -0
- package/icons/ifanr-cloud.svg +10 -0
- package/icons/mermaid.svg +4 -0
- package/icons/qwik.svg +2 -0
- package/package.json +7 -1
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -51
- package/.github/FUNDING.yml +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
- package/.github/ISSUE_TEMPLATE/icon_request.md +0 -27
- package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -7
- package/.github/workflows/build.yml +0 -45
- package/.github/workflows/color-check.yml +0 -22
- package/.github/workflows/release.yml +0 -73
- package/.prettierrc +0 -7
- package/.vscode/extensions.json +0 -3
- package/.vscode/launch.json +0 -43
- package/.vscode/settings.json +0 -14
- package/.vscode/tasks.json +0 -32
- package/.vscodeignore +0 -22
- package/CHANGELOG.md +0 -1343
- package/CONTRIBUTING.md +0 -232
- package/build/web-extension.webpack.config.js +0 -62
- package/build/webpack.config.js +0 -39
- package/changelog.config.json +0 -4
- package/images/commandPalette.png +0 -0
- package/images/contributors.png +0 -0
- package/images/fileIcons.png +0 -0
- package/images/folderIcons.png +0 -0
- package/images/how-tos/folder-icon-parts.png +0 -0
- package/images/how-tos/pick-folder-colors.png +0 -0
- package/images/how-tos/pick-folder-colors.svg +0 -301
- package/images/how-tos/svg-folder-icon-with-correct-colors.png +0 -0
- package/images/how-tos/svg-folder-icon-with-wrong-colors.png +0 -0
- package/images/how-tos/svg-with-light-color.png +0 -0
- package/images/how-tos/svg-with-spacing.png +0 -0
- package/images/how-tos/svg-with-too-dark-color.png +0 -0
- package/images/how-tos/svg-with-wrong-color.png +0 -0
- package/images/how-tos/svg-without-spacing.png +0 -0
- package/images/set-folder-color.gif +0 -0
- package/images/set-folder-theme.gif +0 -0
- package/logo.png +0 -0
- package/logo.svg +0 -21
- package/material-colors.yml +0 -257
- package/package.nls.de.json +0 -34
- package/package.nls.es.json +0 -29
- package/package.nls.fr.json +0 -29
- package/package.nls.ja.json +0 -32
- package/package.nls.json +0 -34
- package/package.nls.nl.json +0 -32
- package/package.nls.pl.json +0 -32
- package/package.nls.pt-BR.json +0 -29
- package/package.nls.pt-PT.json +0 -29
- package/package.nls.ru.json +0 -29
- package/package.nls.zh-CN.json +0 -29
- package/package.nls.zh-TW.json +0 -29
- package/src/commands/activate.ts +0 -28
- package/src/commands/explorerArrows.ts +0 -55
- package/src/commands/fileColor.ts +0 -96
- package/src/commands/folderColor.ts +0 -96
- package/src/commands/folders.ts +0 -55
- package/src/commands/grayscale.ts +0 -55
- package/src/commands/iconPacks.ts +0 -64
- package/src/commands/index.ts +0 -32
- package/src/commands/opacity.ts +0 -46
- package/src/commands/restoreConfig.ts +0 -15
- package/src/commands/saturation.ts +0 -46
- package/src/extension.ts +0 -37
- package/src/helpers/changeDetection.ts +0 -109
- package/src/helpers/customIcons.ts +0 -8
- package/src/helpers/fileConfig.ts +0 -38
- package/src/helpers/index.ts +0 -88
- package/src/helpers/objects.ts +0 -58
- package/src/helpers/types.ts +0 -7
- package/src/i18n/index.ts +0 -78
- package/src/i18n/lang-de.ts +0 -45
- package/src/i18n/lang-en.ts +0 -45
- package/src/i18n/lang-es.ts +0 -45
- package/src/i18n/lang-fr.ts +0 -45
- package/src/i18n/lang-ja.ts +0 -45
- package/src/i18n/lang-nl.ts +0 -45
- package/src/i18n/lang-pl.ts +0 -45
- package/src/i18n/lang-pt-br.ts +0 -45
- package/src/i18n/lang-pt-pt.ts +0 -45
- package/src/i18n/lang-ru.ts +0 -45
- package/src/i18n/lang-uk.ts +0 -45
- package/src/i18n/lang-zh-cn.ts +0 -45
- package/src/i18n/lang-zh-tw.ts +0 -45
- package/src/icons/fileIcons.ts +0 -2294
- package/src/icons/folderIcons.ts +0 -835
- package/src/icons/generator/constants.ts +0 -29
- package/src/icons/generator/fileGenerator.ts +0 -233
- package/src/icons/generator/folderGenerator.ts +0 -340
- package/src/icons/generator/iconOpacity.ts +0 -111
- package/src/icons/generator/iconSaturation.ts +0 -140
- package/src/icons/generator/index.ts +0 -7
- package/src/icons/generator/jsonGenerator.ts +0 -207
- package/src/icons/generator/languageGenerator.ts +0 -127
- package/src/icons/index.ts +0 -4
- package/src/icons/languageIcons.ts +0 -144
- package/src/models/i18n/index.ts +0 -1
- package/src/models/i18n/translation.ts +0 -43
- package/src/models/iconConfiguration.ts +0 -37
- package/src/models/icons/defaultIcon.ts +0 -16
- package/src/models/icons/files/fileIcon.ts +0 -49
- package/src/models/icons/files/fileTypes.ts +0 -14
- package/src/models/icons/files/index.ts +0 -2
- package/src/models/icons/folders/folderIcon.ts +0 -34
- package/src/models/icons/folders/folderTheme.ts +0 -23
- package/src/models/icons/folders/index.ts +0 -2
- package/src/models/icons/iconJsonOptions.ts +0 -22
- package/src/models/icons/iconPack.ts +0 -12
- package/src/models/icons/index.ts +0 -6
- package/src/models/icons/languages/index.ts +0 -1
- package/src/models/icons/languages/languageIdentifier.ts +0 -26
- package/src/models/index.ts +0 -3
- package/src/models/scripts/contributors/contributor.ts +0 -22
- package/src/models/scripts/contributors/contributorsConfig.ts +0 -10
- package/src/scripts/contributors/contributors.css +0 -24
- package/src/scripts/contributors/index.ts +0 -138
- package/src/scripts/helpers/painter.ts +0 -5
- package/src/scripts/helpers/screenshots.ts +0 -32
- package/src/scripts/helpers/similarity.ts +0 -47
- package/src/scripts/helpers/titleCase.ts +0 -7
- package/src/scripts/icons/checks/checkIconAvailability.ts +0 -215
- package/src/scripts/icons/checks/checkIconConflicts.ts +0 -152
- package/src/scripts/icons/checks/checkIconUsage.ts +0 -137
- package/src/scripts/icons/checks/index.ts +0 -7
- package/src/scripts/icons/generateJson.ts +0 -11
- package/src/scripts/preview/index.ts +0 -40
- package/src/scripts/preview/preview.ts +0 -163
- package/src/scripts/preview/style.css +0 -48
- package/src/test/runTest.ts +0 -26
- package/src/test/spec/i18n/i18n.spec.ts +0 -54
- package/src/test/spec/icons/fileIcons.spec.ts +0 -250
- package/src/test/spec/icons/folderIcons.spec.ts +0 -418
- package/src/test/spec/icons/languageIcons.spec.ts +0 -184
- package/src/test/spec/index.ts +0 -36
- package/src/web/extension.ts +0 -10
- package/svgo.config.js +0 -12
- package/tsconfig.json +0 -23
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { readdir } from 'fs';
|
|
2
|
-
import { join, parse } from 'path';
|
|
3
|
-
import {
|
|
4
|
-
DefaultIcon,
|
|
5
|
-
FileIcon,
|
|
6
|
-
FolderIcon,
|
|
7
|
-
FolderTheme,
|
|
8
|
-
} from '../../../models/index';
|
|
9
|
-
import { green, red } from '../../helpers/painter';
|
|
10
|
-
import { similarity } from '../../helpers/similarity';
|
|
11
|
-
import {
|
|
12
|
-
fileIcons,
|
|
13
|
-
folderIcons,
|
|
14
|
-
highContrastColorFileEnding,
|
|
15
|
-
languageIcons,
|
|
16
|
-
lightColorFileEnding,
|
|
17
|
-
openedFolder,
|
|
18
|
-
} from './../../../icons';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Defines the folder where all icon files are located.
|
|
22
|
-
*/
|
|
23
|
-
const folderPath = join('icons');
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Defines an array with all icons that can be found in the file system.
|
|
27
|
-
*/
|
|
28
|
-
const availableIcons: Record<string, string> = {};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Save the misconfigured icons.
|
|
32
|
-
*/
|
|
33
|
-
const wrongIconNames: Record<string, string[]> = {
|
|
34
|
-
fileIcons: [],
|
|
35
|
-
folderIcons: [],
|
|
36
|
-
languageIcons: [],
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Get all icon file names from the file system.
|
|
41
|
-
*/
|
|
42
|
-
const fsReadAllIconFiles = (
|
|
43
|
-
err: NodeJS.ErrnoException | null,
|
|
44
|
-
files: string[]
|
|
45
|
-
) => {
|
|
46
|
-
if (err) {
|
|
47
|
-
throw Error(err.message);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
files.forEach((file) => {
|
|
51
|
-
const fileName = file;
|
|
52
|
-
const iconName = parse(file).name;
|
|
53
|
-
availableIcons[iconName] = fileName;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// check icon configurations
|
|
57
|
-
checkFileIcons();
|
|
58
|
-
checkFolderIcons();
|
|
59
|
-
checkLanguageIcons();
|
|
60
|
-
|
|
61
|
-
// show error messages
|
|
62
|
-
handleErrors();
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// read from the file system
|
|
66
|
-
export const check = () => readdir(folderPath, fsReadAllIconFiles);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if the file icons from the configuration are available on the file system.
|
|
70
|
-
*/
|
|
71
|
-
const checkFileIcons = () => {
|
|
72
|
-
[...fileIcons.icons, fileIcons.defaultIcon].forEach((icon) => {
|
|
73
|
-
isIconAvailable(icon, IconType.fileIcons, IconColor.default);
|
|
74
|
-
isIconAvailable(icon, IconType.fileIcons, IconColor.light);
|
|
75
|
-
isIconAvailable(icon, IconType.fileIcons, IconColor.highContrast);
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const isIconAvailable = (
|
|
80
|
-
icon: FileIcon | FolderIcon | DefaultIcon,
|
|
81
|
-
iconType: IconType,
|
|
82
|
-
iconColor: IconColor,
|
|
83
|
-
hasOpenedFolder?: boolean
|
|
84
|
-
) => {
|
|
85
|
-
let iconName = `${icon.name}${hasOpenedFolder ? openedFolder : ''}`;
|
|
86
|
-
if (icon.light && iconColor === IconColor.light) {
|
|
87
|
-
iconName += lightColorFileEnding;
|
|
88
|
-
}
|
|
89
|
-
if (icon.highContrast && iconColor === IconColor.highContrast) {
|
|
90
|
-
iconName += highContrastColorFileEnding;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (
|
|
94
|
-
!availableIcons[iconName] &&
|
|
95
|
-
wrongIconNames[iconType].indexOf(iconName) === -1
|
|
96
|
-
) {
|
|
97
|
-
wrongIconNames[iconType].push(iconName);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Check if the folder icons from the configuration are available on the file system.
|
|
103
|
-
*/
|
|
104
|
-
const checkFolderIcons = () => {
|
|
105
|
-
folderIcons
|
|
106
|
-
.map((theme) => (theme.name === 'none' ? [] : getAllFolderIcons(theme)))
|
|
107
|
-
.reduce((a, b) => a.concat(b))
|
|
108
|
-
.forEach((icon) => {
|
|
109
|
-
if (icon) {
|
|
110
|
-
isIconAvailable(icon, IconType.folderIcons, IconColor.default);
|
|
111
|
-
isIconAvailable(icon, IconType.folderIcons, IconColor.default, true);
|
|
112
|
-
isIconAvailable(icon, IconType.folderIcons, IconColor.light);
|
|
113
|
-
isIconAvailable(icon, IconType.folderIcons, IconColor.light, true);
|
|
114
|
-
isIconAvailable(icon, IconType.folderIcons, IconColor.highContrast);
|
|
115
|
-
isIconAvailable(
|
|
116
|
-
icon,
|
|
117
|
-
IconType.folderIcons,
|
|
118
|
-
IconColor.highContrast,
|
|
119
|
-
true
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const getAllFolderIcons = (theme: FolderTheme) => {
|
|
126
|
-
const icons = theme.icons ? theme.icons : [];
|
|
127
|
-
return [theme.defaultIcon, theme.rootFolder, ...icons].filter(
|
|
128
|
-
(icon) => icon !== undefined
|
|
129
|
-
); // filter undefined root folder icons
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Check if the language icons from the configuration are available on the file system.
|
|
134
|
-
*/
|
|
135
|
-
const checkLanguageIcons = () => {
|
|
136
|
-
languageIcons.forEach((lang) => {
|
|
137
|
-
const icon = lang.icon;
|
|
138
|
-
isIconAvailable(icon, IconType.languageIcons, IconColor.default);
|
|
139
|
-
isIconAvailable(icon, IconType.languageIcons, IconColor.light);
|
|
140
|
-
isIconAvailable(icon, IconType.languageIcons, IconColor.highContrast);
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Show error messages in the terminal.
|
|
146
|
-
*/
|
|
147
|
-
const handleErrors = () => {
|
|
148
|
-
const amountOfErrors =
|
|
149
|
-
wrongIconNames.fileIcons.length +
|
|
150
|
-
wrongIconNames.folderIcons.length +
|
|
151
|
-
wrongIconNames.languageIcons.length;
|
|
152
|
-
if (amountOfErrors > 0) {
|
|
153
|
-
console.log(
|
|
154
|
-
'> Material Icon Theme:',
|
|
155
|
-
red(`Found ${amountOfErrors} error(s) in the icon configuration!`)
|
|
156
|
-
);
|
|
157
|
-
} else {
|
|
158
|
-
console.log(
|
|
159
|
-
'> Material Icon Theme:',
|
|
160
|
-
green('Passed icon availability checks!')
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
logIconInformation(wrongIconNames.fileIcons, 'File icons');
|
|
164
|
-
logIconInformation(wrongIconNames.folderIcons, 'Folder icons');
|
|
165
|
-
logIconInformation(wrongIconNames.languageIcons, 'Language icons');
|
|
166
|
-
|
|
167
|
-
if (amountOfErrors > 0) {
|
|
168
|
-
throw new Error(
|
|
169
|
-
'Found some wrong file definitions in the icon configuration.'
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const logIconInformation = (wrongIcons: string[], title: string) => {
|
|
175
|
-
if (wrongIcons.length === 0) return;
|
|
176
|
-
console.log(`\n${title}:\n--------------------------------`);
|
|
177
|
-
wrongIcons.forEach((icon) => {
|
|
178
|
-
const suggestion = Object.keys(availableIcons).find((i) => {
|
|
179
|
-
return similarity(icon, i) > 0.75;
|
|
180
|
-
});
|
|
181
|
-
const suggestionString = suggestion
|
|
182
|
-
? ` (Did you mean ${green(suggestion)}?)`
|
|
183
|
-
: '';
|
|
184
|
-
const isWrongLightVersion = icon.endsWith(lightColorFileEnding);
|
|
185
|
-
const isWrongLightVersionString = isWrongLightVersion
|
|
186
|
-
? ` (There is no light icon for ${green(
|
|
187
|
-
icon.slice(0, -6)
|
|
188
|
-
)}! Set the light option to false!)`
|
|
189
|
-
: '';
|
|
190
|
-
const isWrongHighContrastVersion = icon.endsWith(
|
|
191
|
-
highContrastColorFileEnding
|
|
192
|
-
);
|
|
193
|
-
const isWrongHighContrastVersionString = isWrongHighContrastVersion
|
|
194
|
-
? ` (There is no high contrast icon for ${green(
|
|
195
|
-
icon.slice(0, -13)
|
|
196
|
-
)}! Set the highContrast option to false!)`
|
|
197
|
-
: '';
|
|
198
|
-
console.log(
|
|
199
|
-
red(`Icon not found: ${icon}.svg`) +
|
|
200
|
-
`${suggestionString}${isWrongLightVersionString}${isWrongHighContrastVersionString}`
|
|
201
|
-
);
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
enum IconType {
|
|
206
|
-
fileIcons = 'fileIcons',
|
|
207
|
-
folderIcons = 'folderIcons',
|
|
208
|
-
languageIcons = 'languageIcons',
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
enum IconColor {
|
|
212
|
-
default = 'default',
|
|
213
|
-
light = 'light',
|
|
214
|
-
highContrast = 'highContrast',
|
|
215
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { green, red } from '../../helpers/painter';
|
|
2
|
-
import { fileIcons, folderIcons, languageIcons } from './../../../icons';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Store all icons that are wrong configured
|
|
6
|
-
*/
|
|
7
|
-
const allConflicts: {
|
|
8
|
-
fileIcons: {
|
|
9
|
-
fileExtensions: Record<string, string[]>;
|
|
10
|
-
fileNames: Record<string, string[]>;
|
|
11
|
-
};
|
|
12
|
-
folderIcons: Record<string, string[]>;
|
|
13
|
-
languageIcons: Record<string, string[]>;
|
|
14
|
-
} = {
|
|
15
|
-
fileIcons: {
|
|
16
|
-
fileExtensions: {},
|
|
17
|
-
fileNames: {},
|
|
18
|
-
},
|
|
19
|
-
folderIcons: {},
|
|
20
|
-
languageIcons: {},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const check = () => {
|
|
24
|
-
checkFolderIcons();
|
|
25
|
-
checkFileIcons();
|
|
26
|
-
checkLanguageIcons();
|
|
27
|
-
|
|
28
|
-
handleErrors();
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const checkFileIcons = () => {
|
|
32
|
-
checkForConflictsInFileIcons('fileExtensions');
|
|
33
|
-
checkForConflictsInFileIcons('fileNames');
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const checkForConflictsInFileIcons = (
|
|
37
|
-
fileIconDefinitionType: 'fileExtensions' | 'fileNames'
|
|
38
|
-
) => {
|
|
39
|
-
const icons: Record<string, string> = {};
|
|
40
|
-
fileIcons.icons.forEach((icon) => {
|
|
41
|
-
if (!icon[fileIconDefinitionType]) return;
|
|
42
|
-
(icon[fileIconDefinitionType] ?? [])
|
|
43
|
-
.map((d) => d.toLowerCase())
|
|
44
|
-
.forEach((definition) => {
|
|
45
|
-
if (
|
|
46
|
-
!icons[definition] ||
|
|
47
|
-
(icon.enabledFor && icon.enabledFor.length > 0)
|
|
48
|
-
) {
|
|
49
|
-
icons[definition] = icon.name;
|
|
50
|
-
} else {
|
|
51
|
-
if (!allConflicts.fileIcons[fileIconDefinitionType][definition]) {
|
|
52
|
-
allConflicts.fileIcons[fileIconDefinitionType][definition] = [
|
|
53
|
-
icons[definition],
|
|
54
|
-
icon.name,
|
|
55
|
-
];
|
|
56
|
-
} else {
|
|
57
|
-
allConflicts.fileIcons[fileIconDefinitionType][definition].push(
|
|
58
|
-
icon.name
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const checkFolderIcons = () => {
|
|
67
|
-
folderIcons.forEach((theme) => {
|
|
68
|
-
if (!theme.icons) return;
|
|
69
|
-
const icons: Record<string, string> = {};
|
|
70
|
-
theme.icons.forEach((icon) => {
|
|
71
|
-
icon.folderNames
|
|
72
|
-
.map((f) => f.toLowerCase())
|
|
73
|
-
.forEach((folderName) => {
|
|
74
|
-
if (
|
|
75
|
-
!icons[folderName] ||
|
|
76
|
-
(icon.enabledFor && icon.enabledFor.length > 0)
|
|
77
|
-
) {
|
|
78
|
-
icons[folderName] = icon.name;
|
|
79
|
-
} else {
|
|
80
|
-
if (!allConflicts.folderIcons[folderName]) {
|
|
81
|
-
allConflicts.folderIcons[folderName] = [
|
|
82
|
-
icons[folderName],
|
|
83
|
-
icon.name,
|
|
84
|
-
];
|
|
85
|
-
} else {
|
|
86
|
-
allConflicts.folderIcons[folderName].push(icon.name);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const checkLanguageIcons = () => {
|
|
95
|
-
const icons: Record<string, string> = {};
|
|
96
|
-
languageIcons.forEach((langIcon) => {
|
|
97
|
-
langIcon.ids
|
|
98
|
-
.map((id) => id.toLowerCase())
|
|
99
|
-
.forEach((id) => {
|
|
100
|
-
if (!icons[id]) {
|
|
101
|
-
icons[id] = langIcon.icon.name;
|
|
102
|
-
} else {
|
|
103
|
-
if (!allConflicts.languageIcons[id]) {
|
|
104
|
-
allConflicts.languageIcons[id] = [icons[id], langIcon.icon.name];
|
|
105
|
-
} else {
|
|
106
|
-
allConflicts.languageIcons[id].push(langIcon.icon.name);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const handleErrors = () => {
|
|
114
|
-
if (
|
|
115
|
-
[
|
|
116
|
-
...Object.keys(allConflicts.fileIcons.fileExtensions),
|
|
117
|
-
...Object.keys(allConflicts.fileIcons.fileNames),
|
|
118
|
-
...Object.keys(allConflicts.folderIcons),
|
|
119
|
-
...Object.keys(allConflicts.languageIcons),
|
|
120
|
-
].length > 0
|
|
121
|
-
) {
|
|
122
|
-
console.log('> Material Icon Theme:', red('Icon conflicts:'));
|
|
123
|
-
console.log(red('--------------------------------------'));
|
|
124
|
-
|
|
125
|
-
printErrorMessage(allConflicts.fileIcons.fileExtensions, 'fileExtension');
|
|
126
|
-
printErrorMessage(allConflicts.fileIcons.fileNames, 'fileName');
|
|
127
|
-
printErrorMessage(allConflicts.folderIcons, 'folderName');
|
|
128
|
-
printErrorMessage(allConflicts.languageIcons, 'languageId');
|
|
129
|
-
|
|
130
|
-
console.log('\n' + red('Please check the wrong icon configurations!\n'));
|
|
131
|
-
process.exit(1);
|
|
132
|
-
} else {
|
|
133
|
-
console.log(
|
|
134
|
-
'> Material Icon Theme:',
|
|
135
|
-
green('Passed icon conflict checks!')
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
const printErrorMessage = (icons: any, definitionType: string) => {
|
|
141
|
-
const keys = Object.keys(icons);
|
|
142
|
-
keys.forEach((key) => {
|
|
143
|
-
const conflictIcons = icons[key];
|
|
144
|
-
console.log(
|
|
145
|
-
red(
|
|
146
|
-
`For ${definitionType} "${key}" are ${
|
|
147
|
-
conflictIcons.length
|
|
148
|
-
} icons defined: [${conflictIcons.join(', ')}]`
|
|
149
|
-
)
|
|
150
|
-
);
|
|
151
|
-
});
|
|
152
|
-
};
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { readdir } from 'fs';
|
|
2
|
-
import { join, parse } from 'path';
|
|
3
|
-
import { DefaultIcon, FolderIcon, FolderTheme } from '../../../models/index';
|
|
4
|
-
import { green, red } from '../../helpers/painter';
|
|
5
|
-
import {
|
|
6
|
-
fileIcons,
|
|
7
|
-
folderIcons,
|
|
8
|
-
highContrastColorFileEnding,
|
|
9
|
-
languageIcons,
|
|
10
|
-
lightColorFileEnding,
|
|
11
|
-
openedFolder,
|
|
12
|
-
} from './../../../icons';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Defines the folder where all icon files are located.
|
|
16
|
-
*/
|
|
17
|
-
const folderPath = join('icons');
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Defines an array with all icons that can be found in the file system.
|
|
21
|
-
*/
|
|
22
|
-
const availableIcons: { [s: string]: string } = {};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get all icon file names from the file system.
|
|
26
|
-
*/
|
|
27
|
-
const fsReadAllIconFiles = (
|
|
28
|
-
error: NodeJS.ErrnoException | null,
|
|
29
|
-
files: string[]
|
|
30
|
-
) => {
|
|
31
|
-
if (error) {
|
|
32
|
-
throw Error(error.message);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
files.forEach((file) => {
|
|
36
|
-
const fileName = file;
|
|
37
|
-
const iconName = parse(file).name;
|
|
38
|
-
availableIcons[iconName] = fileName;
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
checkUsageOfAllIcons();
|
|
42
|
-
handleErrors();
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const checkUsageOfAllIcons = () => {
|
|
46
|
-
const usedFileIcons: string[] = getAllUsedFileIcons();
|
|
47
|
-
const usedFolderIcons: string[] = getAllUsedFolderIcons();
|
|
48
|
-
const usedLanguageIcons: string[] = getAllUsedLanguageIcons();
|
|
49
|
-
|
|
50
|
-
[...usedFileIcons, ...usedFolderIcons, ...usedLanguageIcons].forEach(
|
|
51
|
-
(icon) => {
|
|
52
|
-
delete availableIcons[icon];
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const handleErrors = () => {
|
|
58
|
-
const amountOfUnusedIcons = Object.keys(availableIcons).length;
|
|
59
|
-
if (amountOfUnusedIcons === 0) {
|
|
60
|
-
console.log('> Material Icon Theme:', green('Passed icon usage checks!'));
|
|
61
|
-
} else {
|
|
62
|
-
console.log(
|
|
63
|
-
'> Material Icon Theme: ' + red(`${amountOfUnusedIcons} unused icon(s):`)
|
|
64
|
-
);
|
|
65
|
-
Object.keys(availableIcons).forEach((icon) => {
|
|
66
|
-
console.log(red(`- ${availableIcons[icon]}`));
|
|
67
|
-
});
|
|
68
|
-
throw new Error('Found unused icon files!');
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// read from the file system
|
|
73
|
-
export const check = () => readdir(folderPath, fsReadAllIconFiles);
|
|
74
|
-
|
|
75
|
-
const getAllUsedFileIcons = (): string[] => {
|
|
76
|
-
return [
|
|
77
|
-
fileIcons.defaultIcon.name,
|
|
78
|
-
fileIcons.defaultIcon.light
|
|
79
|
-
? fileIcons.defaultIcon.name + lightColorFileEnding
|
|
80
|
-
: '',
|
|
81
|
-
fileIcons.defaultIcon.highContrast
|
|
82
|
-
? fileIcons.defaultIcon.name + highContrastColorFileEnding
|
|
83
|
-
: '',
|
|
84
|
-
...fileIcons.icons.map((icon) => icon.name),
|
|
85
|
-
...fileIcons.icons
|
|
86
|
-
.filter((icon) => icon.light)
|
|
87
|
-
.map((icon) => icon.name + lightColorFileEnding),
|
|
88
|
-
...fileIcons.icons
|
|
89
|
-
.filter((icon) => icon.highContrast)
|
|
90
|
-
.map((icon) => icon.name + highContrastColorFileEnding),
|
|
91
|
-
].filter((f) => f !== '');
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const getAllUsedFolderIcons = (): string[] => {
|
|
95
|
-
const icons = folderIcons
|
|
96
|
-
.map((theme) => (theme.name === 'none' ? [] : getAllFolderIcons(theme)))
|
|
97
|
-
.reduce((a, b) => a.concat(b));
|
|
98
|
-
return icons
|
|
99
|
-
.map((icon) => {
|
|
100
|
-
return [
|
|
101
|
-
icon.name,
|
|
102
|
-
icon.name + openedFolder,
|
|
103
|
-
icon.light ? icon.name + lightColorFileEnding : '',
|
|
104
|
-
icon.light ? icon.name + openedFolder + lightColorFileEnding : '',
|
|
105
|
-
icon.highContrast ? icon.name + highContrastColorFileEnding : '',
|
|
106
|
-
icon.highContrast
|
|
107
|
-
? icon.name + openedFolder + highContrastColorFileEnding
|
|
108
|
-
: '',
|
|
109
|
-
];
|
|
110
|
-
})
|
|
111
|
-
.filter((icon) => icon !== undefined)
|
|
112
|
-
.reduce((a, b) => a.concat(b));
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const getAllFolderIcons = (
|
|
116
|
-
theme: FolderTheme
|
|
117
|
-
): (FolderIcon | DefaultIcon)[] => {
|
|
118
|
-
const icons = theme.icons || [];
|
|
119
|
-
const allFolderIcons = [theme.defaultIcon, ...icons];
|
|
120
|
-
if (theme.rootFolder) {
|
|
121
|
-
allFolderIcons.push(theme.rootFolder);
|
|
122
|
-
}
|
|
123
|
-
return allFolderIcons;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const getAllUsedLanguageIcons = (): string[] => {
|
|
127
|
-
const icons = [
|
|
128
|
-
...languageIcons.map((lang) => lang.icon.name),
|
|
129
|
-
...languageIcons
|
|
130
|
-
.filter((lang) => lang.icon.light)
|
|
131
|
-
.map((lang) => lang.icon.name + lightColorFileEnding),
|
|
132
|
-
...languageIcons
|
|
133
|
-
.filter((lang) => lang.icon.highContrast)
|
|
134
|
-
.map((lang) => lang.icon.name + highContrastColorFileEnding),
|
|
135
|
-
];
|
|
136
|
-
return icons;
|
|
137
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { check as checkAvailability } from './checkIconAvailability';
|
|
2
|
-
import { check as checkIconConflicts } from './checkIconConflicts';
|
|
3
|
-
import { check as checkIconUsage } from './checkIconUsage';
|
|
4
|
-
|
|
5
|
-
checkAvailability();
|
|
6
|
-
checkIconUsage();
|
|
7
|
-
checkIconConflicts();
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { fileIcons } from './../../icons/fileIcons';
|
|
2
|
-
import { folderIcons } from './../../icons/folderIcons';
|
|
3
|
-
import { languageIcons } from './../../icons/languageIcons';
|
|
4
|
-
import { generatePreview } from './preview';
|
|
5
|
-
|
|
6
|
-
const filterDuplicates = (icons: string[]) => {
|
|
7
|
-
return [...new Set(icons)];
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const basicFileIcons = filterDuplicates(
|
|
11
|
-
fileIcons.icons
|
|
12
|
-
.map((i) => i.name)
|
|
13
|
-
// merge language icons
|
|
14
|
-
.concat(languageIcons.map((i) => i.icon.name))
|
|
15
|
-
).map((i) => ({ iconName: i, label: i }));
|
|
16
|
-
|
|
17
|
-
const folderThemes = filterDuplicates(
|
|
18
|
-
folderIcons
|
|
19
|
-
.map((theme) => {
|
|
20
|
-
const folders = [];
|
|
21
|
-
if (theme.icons && theme.icons.length > 0) {
|
|
22
|
-
folders.push(...theme.icons.map((i) => i.name));
|
|
23
|
-
}
|
|
24
|
-
return [...folders];
|
|
25
|
-
})
|
|
26
|
-
.reduce((a, b) => a.concat(b))
|
|
27
|
-
).map((i) => ({ iconName: i, label: i.replace('folder-', '') }));
|
|
28
|
-
|
|
29
|
-
generatePreview('fileIcons', basicFileIcons, 5, [
|
|
30
|
-
'virtual',
|
|
31
|
-
'powerpoint',
|
|
32
|
-
'word',
|
|
33
|
-
'credits',
|
|
34
|
-
]);
|
|
35
|
-
generatePreview('folderIcons', folderThemes, 5, [
|
|
36
|
-
'folder-aurelia',
|
|
37
|
-
'folder-phpmailer',
|
|
38
|
-
'folder-syntax',
|
|
39
|
-
'folder-ansible',
|
|
40
|
-
]);
|