diff --git a/.githooks/pre-commit b/.githooks/pre-commit
new file mode 100755
index 000000000..19fe2539c
--- /dev/null
+++ b/.githooks/pre-commit
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+yarn checkIcons
+echo $?
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 000000000..b58b603fe
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 000000000..ac6ddd4e3
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 000000000..307554b77
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 000000000..9c6941105
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/lucide.iml b/.idea/lucide.iml
new file mode 100644
index 000000000..0b872d82d
--- /dev/null
+++ b/.idea/lucide.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 000000000..ef004d16c
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 000000000..e9b95cfdd
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..9661ac713
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/icons.json b/icons.json
index 5ae07710a..aa568e297 100644
--- a/icons.json
+++ b/icons.json
@@ -4882,4 +4882,4 @@
"icon": "cloud-sun"
}
}
-}
\ No newline at end of file
+}
diff --git a/package.json b/package.json
index 001a34d85..279da02c0 100644
--- a/package.json
+++ b/package.json
@@ -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",
diff --git a/scripts/checkIconsAndCategories.js b/scripts/checkIconsAndCategories.js
new file mode 100644
index 000000000..6fcdbd738
--- /dev/null
+++ b/scripts/checkIconsAndCategories.js
@@ -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.');
+}