cryptocurrency-icons/scripts/manifest.js

22 lines
556 B
JavaScript

'use strict';
const fs = require('fs');
const path = require('path');
const coins = require('coinlist');
const alphaSort = require('alpha-sort');
const manifest = require('../manifest.json');
const icons = manifest.map(icon => {
const id = typeof icon === 'string' ? icon : icon.symbol;
return {
symbol: id.toUpperCase(),
name: coins.get(id, 'name') || id
};
});
icons.sort((a, b) => alphaSort.asc(a.symbol, b.symbol));
const data = JSON.stringify(icons, null, '\t') + '\n';
fs.writeFileSync(path.resolve(__dirname, '../manifest.json'), data);