Files
ionicons/scripts/data.js
T
Kevin Ports 3e57401ce2 Docs updates (#533)
* New docs landing page design

* Add icon type toggle, new toast bar layout

* Design tweaks, responsive toast bar

* Move toast bar to separate component

* Sticky list headers, sitcky header nav, toggle focus between search inputs on scroll

* Add svg source file zip archiving to build scripts

* Add links to download svgs

* Tweak header bar overlay state threshold

* Get rid of toast bar flashing on first page load

* Cleanup, adding some presentational details

* Add mobile styles

* Add router, scss

* Finish mobile styles, browser testing fixes

* Finish mobile styles, browser testing fixes

* Add version to data.json file, a few style tweaks

* Add 404 page and router switch

* A few route tweaks

* Update stencil, a few fixes

* Add og image, update meta data

* Add Twitter card meta

* Custom search input clear button

* cleanup

* Woops! git was ignoring the src/docs folder

* Add sticky subheaders back in for icon list

* Update OG image

* Update bug in ios trash icon
2018-05-10 13:37:50 -05:00

46 lines
1.3 KiB
JavaScript

const fs = require('fs-extra');
const path = require('path');
const ROOT_DIR = path.join(__dirname, '..');
const SRC_DIR = path.join(ROOT_DIR, 'src');
const SRC_SVG_DIR = path.join(SRC_DIR, 'svg');
const PKG_JSON = path.join(ROOT_DIR, 'package.json');
const SRC_JSON = path.join(SRC_DIR, 'data.json');
const DST_DIR = path.join(ROOT_DIR, 'dist');
const DST_JSON = path.join(DST_DIR, 'ionicons/data.json');
console.log('checking icon data: ' + SRC_JSON);
let srcData = fs.readJsonSync(SRC_JSON);
let svgFiles = fs.readdirSync(SRC_SVG_DIR);
let pkgData = fs.readJsonSync(PKG_JSON);
srcData['version'] = pkgData.version;
svgFiles.filter(f => f.indexOf('.svg') > -1).forEach(svgFile => {
let iconName = svgFile.split('.')[0];
let icon = srcData.icons.find(i => i.icons.indexOf(iconName) > -1);
if (!icon) {
console.log('icon data missing for: ' + svgFile);
}
});
srcData.icons.forEach(i => {
if (i.tags.length === 0) {
console.log('icon data missing search tags for: ' + i.icons);
}
i.icons.forEach(iconName => {
let svgFile = iconName + '.svg';
let f = svgFiles.find(f => f === svgFile);
if (!f) {
console.log('icon data contains "' + iconName + '", but the file "' + path.join(SRC_SVG_DIR, svgFile) + '" doesn\'t exist');
}
});
});
let content = JSON.stringify(srcData);
fs.writeFileSync(DST_JSON, content);