material-icon-theme 4.22.0 → 4.23.1
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/.eslintrc.json +51 -51
- package/.github/workflows/build.yml +45 -45
- package/.github/workflows/color-check.yml +22 -22
- package/.github/workflows/release.yml +73 -73
- package/.vscodeignore +21 -21
- package/CHANGELOG.md +1292 -1267
- package/README.md +199 -199
- package/icons/craco.svg +45 -0
- package/icons/folder-changesets-open.svg +5 -0
- package/icons/folder-changesets.svg +2 -0
- package/icons/folder-decorators-open.svg +2 -2
- package/icons/folder-decorators.svg +5 -5
- package/icons/folder-supabase-open.svg +5 -5
- package/icons/folder-supabase.svg +2 -2
- package/icons/sonarcloud.svg +4 -4
- package/icons/stylable.svg +10 -10
- package/icons/supabase.svg +4 -4
- package/icons/vitest.svg +6 -0
- package/images/contributors.png +0 -0
- package/images/fileIcons.png +0 -0
- package/images/folderIcons.png +0 -0
- package/package.json +252 -252
- package/package.nls.de.json +32 -32
- package/package.nls.es.json +29 -29
- package/package.nls.fr.json +29 -29
- package/package.nls.ja.json +32 -32
- package/package.nls.json +32 -32
- package/package.nls.nl.json +32 -32
- package/package.nls.pl.json +32 -32
- package/package.nls.pt-BR.json +29 -29
- package/package.nls.pt-PT.json +29 -29
- package/package.nls.ru.json +29 -29
- package/package.nls.zh-CN.json +29 -29
- package/package.nls.zh-TW.json +29 -29
- package/src/commands/activate.ts +28 -28
- package/src/commands/explorerArrows.ts +55 -55
- package/src/commands/folderColor.ts +96 -96
- package/src/commands/folders.ts +55 -55
- package/src/commands/grayscale.ts +55 -55
- package/src/commands/iconPacks.ts +64 -64
- package/src/commands/index.ts +30 -30
- package/src/commands/opacity.ts +46 -46
- package/src/commands/saturation.ts +46 -46
- package/src/extension.ts +37 -37
- package/src/helpers/customIcons.ts +8 -8
- package/src/helpers/index.ts +88 -88
- package/src/i18n/index.ts +78 -78
- package/src/i18n/lang-de.ts +43 -43
- package/src/i18n/lang-en.ts +43 -43
- package/src/i18n/lang-es.ts +43 -43
- package/src/i18n/lang-fr.ts +43 -43
- package/src/i18n/lang-ja.ts +43 -43
- package/src/i18n/lang-nl.ts +43 -43
- package/src/i18n/lang-pl.ts +43 -43
- package/src/i18n/lang-pt-br.ts +43 -43
- package/src/i18n/lang-pt-pt.ts +43 -43
- package/src/i18n/lang-ru.ts +43 -43
- package/src/i18n/lang-uk.ts +43 -43
- package/src/i18n/lang-zh-cn.ts +43 -43
- package/src/i18n/lang-zh-tw.ts +43 -43
- package/src/icons/fileIcons.ts +2197 -2159
- package/src/icons/folderIcons.ts +806 -804
- package/src/icons/generator/folderGenerator.ts +340 -340
- package/src/icons/generator/iconOpacity.ts +111 -111
- package/src/icons/generator/iconSaturation.ts +140 -140
- package/src/icons/generator/jsonGenerator.ts +191 -191
- package/src/icons/languageIcons.ts +141 -141
- package/src/models/i18n/translation.ts +41 -41
- package/src/models/iconConfiguration.ts +37 -37
- package/src/models/icons/iconJsonOptions.ts +21 -21
- package/src/models/index.ts +3 -3
- package/src/scripts/contributors/index.ts +138 -138
- package/src/scripts/helpers/screenshots.ts +32 -32
- package/src/scripts/icons/checks/checkIconAvailability.ts +215 -215
- package/src/scripts/icons/checks/checkIconConflicts.ts +152 -152
- package/src/scripts/icons/checks/checkIconUsage.ts +137 -137
- package/src/scripts/icons/checks/index.ts +7 -7
- package/src/scripts/preview/index.ts +40 -40
- package/src/scripts/preview/preview.ts +163 -163
- package/src/test/runTest.ts +26 -26
- package/src/test/spec/i18n/i18n.spec.ts +54 -54
- package/src/test/spec/icons/fileIcons.spec.ts +250 -250
- package/src/test/spec/icons/folderIcons.spec.ts +418 -418
- package/src/test/spec/icons/languageIcons.spec.ts +184 -184
|
@@ -1,152 +1,152 @@
|
|
|
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
|
+
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 +1,137 @@
|
|
|
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
|
+
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 +1,7 @@
|
|
|
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
|
+
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 +1,40 @@
|
|
|
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
|
-
]);
|
|
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
|
+
]);
|