Make the manifest contain name of the coins (#185)

This commit is contained in:
Pierre Neter 2018-08-13 16:55:05 +07:00 committed by Sindre Sorhus
parent 59c6ccdaa8
commit 8b1e8a966b
3 changed files with 1259 additions and 312 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,5 +39,13 @@
"erc20-tokens",
"erc20",
"erc721"
]
],
"scripts": {
"manifest": "node scripts/manifest.js",
"precommit": "npm run manifest"
},
"devDependencies": {
"alpha-sort": "^2.0.1",
"coinlist": "^2.0.0"
}
}

20
scripts/manifest.js Normal file
View File

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