mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-13 13:48:26 +00:00
Added git pre commit hook for checking the contents of icons.json
This commit is contained in:
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
yarn checkIcons
|
||||
echo $?
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<option name="LINE_SEPARATOR" value=" " />
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
</HTMLCodeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
Generated
+5
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="TsLint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
Generated
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/lucide.iml" filepath="$PROJECT_DIR$/.idea/lucide.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
+1
-1
@@ -4882,4 +4882,4 @@
|
||||
"icon": "cloud-sun"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -39,7 +39,8 @@
|
||||
"addtags": "babel-node ./scripts/addMissingKeysToTags.js --presets @babel/env",
|
||||
"tags2icons": "babel-node ./scripts/migrateTagsToIcons.js --presets @babel/env",
|
||||
"icons2tags": "babel-node ./scripts/migrateIconsToTags.js --presets @babel/env",
|
||||
"generate:changelog": "babel-node ./scripts/generateChangelog.js --presets @babel/env"
|
||||
"generate:changelog": "babel-node ./scripts/generateChangelog.js --presets @babel/env",
|
||||
"checkIcons": "babel-node ./scripts/checkIconsAndCategories.js --presets @babel/env"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ampproject/rollup-plugin-closure-compiler": "^0.25.2",
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import path from 'path';
|
||||
import icons from '../icons.json';
|
||||
import {readSvgDirectory} from './helpers';
|
||||
|
||||
const ICONS_DIR = path.resolve(__dirname, '../icons');
|
||||
|
||||
console.log(`Read all icons`);
|
||||
|
||||
const svgFiles = readSvgDirectory(ICONS_DIR);
|
||||
|
||||
const iconNames = svgFiles.map(icon => icon.split('.')[0]);
|
||||
|
||||
let error = false;
|
||||
|
||||
iconNames.forEach(iconName => {
|
||||
if (typeof icons.icons[iconName] === 'undefined') {
|
||||
console.error(`'${iconName}.svg' is not present in 'icons.json'.`);
|
||||
error = true;
|
||||
}
|
||||
});
|
||||
|
||||
Object.keys(icons.icons).forEach(iconName => {
|
||||
const icon = icons.icons[iconName];
|
||||
if (iconNames.indexOf(iconName) === -1) {
|
||||
console.error(`'${iconName}.svg' does not exist.`);
|
||||
error = true;
|
||||
}
|
||||
icon.categories.forEach(categoryName => {
|
||||
if (typeof icons.categories[categoryName] === 'undefined') {
|
||||
console.error(`Icon '${iconName}' refers to the non-existing category '${categoryName}'.`);
|
||||
error = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Object.keys(icons.categories).forEach(categoryName => {
|
||||
const category = icons.categories[categoryName];
|
||||
if (!category.icon) {
|
||||
console.error(`Category '${categoryName}' does not use an icon '${category.icon}'.`);
|
||||
error = true;
|
||||
} else if (typeof icons.icons[category.icon] === 'undefined') {
|
||||
console.error(`Category '${categoryName}' uses the non-existing icon '${category.icon}'.`);
|
||||
error = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw new Error('At least one error in icons.json prevents from committing changes.');
|
||||
}
|
||||
Reference in New Issue
Block a user