Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 29 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
const fs = require('fs');
const fetch = require('isomorphic-fetch');
const sortby = require('lodash.sortby');
const request = require('sync-request');
const ora = require('ora');
const chalk = require('chalk');

const endpoint = 'https://www.cryptocompare.com/api/data/coinlist/';

const spinner = ora('Building currencies').start();
spinner.color = 'magenta';

fetch(endpoint)
.then(response => response.json())
.then(json => {
const sorted = sortby(json.Data, o => o.CoinName);

const symbols = {};
let imagesSaved = 0;

/**
* Build the JSON file based on the cryptocompare coinlist.
*/
sorted.forEach(currency => {
const {Name, CoinName} = currency;
sorted.forEach((currency, index) => {
const {Name, CoinName, ImageUrl} = currency;
symbols[Name] = CoinName;

// download the image for future use
if (ImageUrl) {
spinner.text = `${chalk.gray(index)} ${Name}`;
spinner.render();
const res = request('get', `https://www.cryptocompare.com${ImageUrl}`);
fs.writeFileSync(`images/${Name}.${ImageUrl.split('.').pop()}`, res.getBody());
imagesSaved += 1;
}
});

spinner.succeed([`${imagesSaved} images saved to /images`]);

spinner.color = 'yellow';
spinner.start(`Saving cryptocurrencies.json file`);

fs.writeFileSync('cryptocurrencies.json', JSON.stringify(symbols, null, 2));
console.log('JSON File written');
spinner.succeed(`${sorted.length} currencies saved to cryptocurrencies.json`);

spinner.start('Saving Readme');

/**
* Build the Markdown Table of currencies in the Readme.
Expand All @@ -45,6 +68,8 @@ fetch(endpoint)
const targetRegex = /<!-- BEGIN TABLE INJECT -->(\w|\W)*<!-- END TABLE INJECT -->/gim;
const updated = template.replace(targetRegex, `<!-- BEGIN TABLE INJECT -->\n${table}\n<!-- END TABLE INJECT -->`);
fs.writeFileSync('readme.md', updated);
console.log('Readme Markdown Table updated');
spinner.succeed(['Readme Markdown Table updated']);

console.log('\n', 'Remember to', chalk.yellow('git commit'), 'and', chalk.yellow('npm publish'));
})
.catch(err => console.error(err));
4 changes: 2 additions & 2 deletions cryptocurrencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@
"BURST": "BurstCoin",
"BUZZ": "BuzzCoin",
"BYC": "ByteCent",
"BTE": "ByteCoin",
"BCN": "ByteCoin",
"BTE": "ByteCoin",
"GBYTE": "Byteball",
"BTH": "Bytether ",
"BTM*": "Bytom",
Expand Down Expand Up @@ -1884,7 +1884,7 @@
"WISC": "WisdomCoin",
"WSC": "WiserCoin",
"WSH": "Wish Finance",
"WISH*": "WishFinance",
"WISH* (1)": "WishFinance",
"WLK": "Wolk",
"WOMEN": "WomenCoin",
"LOG": "Wood Coin",
Expand Down
Binary file added images/007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1337.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1CR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1ST.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2015.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2BACCO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/2GIVE.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/32BIT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/365.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/3DES.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/42.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/4CHN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/611.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/808.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/888.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/8BIT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/8BT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/8S.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ABC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ABT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ABY.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ABYSS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/AC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/AC3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/ACC.jpg
Binary file added images/ACCO.png
Binary file added images/ACE.png
Binary file added images/ACES.png
Binary file added images/ACID.png
Binary file added images/ACN.png
Binary file added images/ACOIN.png
Binary file added images/ACP.png
Binary file added images/ACT*.png
Binary file added images/ACT.png
Binary file added images/ADA.png
Binary file added images/ADB.png
Binary file added images/ADC.png
Binary file added images/ADCN.png
Binary file added images/ADL.png
Binary file added images/ADN.png
Binary file added images/ADST.png
Binary file added images/ADT.png
Binary file added images/ADX.png
Binary file added images/ADZ.jpg
Binary file added images/AE.png
Binary file added images/AEC.png
Binary file added images/AEON.png
Binary file added images/AERM.png
Binary file added images/AERO.png
Binary file added images/AGRS.png
Binary file added images/AGS.png
Binary file added images/AHT*.png
Binary file added images/AHT.png
Binary file added images/AIB.png
Binary file added images/AID.png
Binary file added images/AION.png
Binary file added images/AIR*.png
Binary file added images/AIR.png
Binary file added images/ALC.png
Binary file added images/ALEX.png
Binary file added images/ALF.png
Binary file added images/ALIS.png
Binary file added images/ALN.png
Binary file added images/ALQO.png
Binary file added images/ALTCOM.png
Binary file added images/ALTOCAR.png
Binary file added images/AM.png
Binary file added images/AMB.png
Binary file added images/AMBER.png
Binary file added images/AMC.png
Binary file added images/AMIS.png
Binary file added images/AMM.png
Binary file added images/AMMO.png
Binary file added images/AMP.png
Binary file added images/AMS.png
Binary file added images/AMT.jpg
Binary file added images/AMY.jpg
Binary file added images/ANAL.jpg
Binary file added images/ANC.png
Binary file added images/ANCP.png
Binary file added images/AND.png
Binary file added images/ANT.png
Binary file added images/ANTC.png
Binary file added images/ANTI.png
Binary file added images/APC.png
Binary file added images/APEX.png
Binary file added images/APPC.png
Binary file added images/APT.png
Binary file added images/APX.png
Binary file added images/AR*.png
Binary file added images/ARB.png
Binary file added images/ARBI.png
Binary file added images/ARC*.png
Binary file added images/ARC.png
Binary file added images/ARCH.png
Binary file added images/ARCO.png
Binary file added images/ARDR.png
Binary file added images/ARENA.png
Binary file added images/ARG.png
Binary file added images/ARGUS.png
Binary file added images/ARI*.png
Binary file added images/ARI.png
Binary file added images/ARK.png
Binary file added images/ARM.png
Binary file added images/ARN.png
Binary file added images/ARNA.png
Binary file added images/ARPA.png
Binary file added images/ART.png
Binary file added images/ASAFE2.jpg
Binary file added images/ASN.png
Binary file added images/AST*.png
Binary file added images/AST.png
Binary file added images/ASTRO.png
Binary file added images/ATB.png
Binary file added images/ATCC.png
Binary file added images/ATFS.png
Binary file added images/ATKN.png
Binary file added images/ATL.png
Binary file added images/ATM.png
Binary file added images/ATMS.png
Binary file added images/ATOM*.jpg
Binary file added images/ATOM.png
Binary file added images/ATS.png
Binary file added images/ATX.png
Binary file added images/AUR.png
Binary file added images/AURS.png
Binary file added images/AUT.png
Binary file added images/AUTH.png
Binary file added images/AV.png
Binary file added images/AVA.png
Binary file added images/AVE.png
Binary file added images/AVT.png
Binary file added images/AXIOM.png
Binary file added images/AXR.png
Binary file added images/AXT.png
Binary file added images/B2BX.png
Binary file added images/B3.png
Binary file added images/B@.png
Binary file added images/BAC*.png
Binary file added images/BAC.png
Binary file added images/BAM.png
Binary file added images/BAN.png
Binary file added images/BAR.png
Binary file added images/BAS.png
Binary file added images/BASH.png
Binary file added images/BAT.png
Binary file added images/BAY.png
Binary file added images/BBCC.png
Binary file added images/BBR.png
Binary file added images/BBT*.png
Binary file added images/BBT.png
Binary file added images/BCAP.png
Binary file added images/BCCOIN.png
Binary file added images/BCD*.png
Binary file added images/BCD.png
Binary file added images/BCF.png
Binary file added images/BCH.jpg
Binary file added images/BCN.png
Binary file added images/BCO.png
Binary file added images/BCOIN.png
Binary file added images/BCPT.png
Binary file added images/BCR.png
Binary file added images/BCX*.png
Binary file added images/BCX.png
Binary file added images/BCY.png
Binary file added images/BDG.png
Binary file added images/BDL.png
Binary file added images/BDR.png
Binary file added images/BELA.jpg
Binary file added images/BEN.png
Binary file added images/BENJI.png
Binary file added images/BERN.png
Binary file added images/BEST.jpg
Binary file added images/BET*.png
Binary file added images/BET.png
Binary file added images/BFX.png
Binary file added images/BHC*.png
Binary file added images/BHC.png
Binary file added images/BIC.png
Binary file added images/BIGUP.png
Binary file added images/BIO.png
Binary file added images/BIOB.png
Binary file added images/BIOS.png
Binary file added images/BIP.png
Binary file added images/BIS.png
Binary file added images/BIT16.png
Binary file added images/BITB.png
Binary file added images/BITCNY.png
Binary file added images/BITOK.jpg
Binary file added images/BITS.png
Binary file added images/BITSD.png
Binary file added images/BITUSD.png
Binary file added images/BITZ.png
Binary file added images/BKX.png
Binary file added images/BLAS.png
Binary file added images/BLAZR.png
Binary file added images/BLC.png
Binary file added images/BLITZ.png
Binary file added images/BLK.png
Binary file added images/BLOCK.png
Binary file added images/BLOCKPAY.png
Binary file added images/BLRY.png
Binary file added images/BLT.png
Binary file added images/BLU.png
Binary file added images/BLUE.png
Binary file added images/BLX.png
Binary file added images/BM*.png
Binary file added images/BM.png
Binary file added images/BMC.png
Binary file added images/BMT.png
Binary file added images/BMXT.png
Binary file added images/BNB*.png
Binary file added images/BNB.png
Binary file added images/BNC.png
Binary file added images/BNK.png
Binary file added images/BNT.jpg
Binary file added images/BNTY.png
Binary file added images/BNX.png
Binary file added images/BOAT.png
Binary file added images/BOB.png
Binary file added images/BOG.png
Binary file added images/BOLI.png
Binary file added images/BOMB.png
Binary file added images/BON*.png
Binary file added images/BON.png
Binary file added images/BOOM.png
Binary file added images/BOS.png
Binary file added images/BOSON.png
Binary file added images/BOSS.png
Binary file added images/BOST.png
Binary file added images/BOTS.png
Binary file added images/BOU.jpg
Binary file added images/BOXY.png
Binary file added images/BPL.png
Binary file added images/BQ.png
Binary file added images/BQC.png
Binary file added images/BRAIN.png
Binary file added images/BRAT.png
Binary file added images/BRD.png
Binary file added images/BRDD.png
Binary file added images/BRIT.png
Binary file added images/BRK.png
Binary file added images/BRO.png
183 changes: 183 additions & 0 deletions images/BRONZ.png
Binary file added images/BRX.png
Binary file added images/BS.png
Binary file added images/BSC.png
Binary file added images/BSD.png
Binary file added images/BST.png
Binary file added images/BSTAR.png
Binary file added images/BSTK.png
Binary file added images/BSTY.png
Binary file added images/BT.png
Binary file added images/BT1.png
Binary file added images/BT2.png
Binary file added images/BTA.png
Binary file added images/BTB.png
Binary file added images/BTC.png
Binary file added images/BTCA.png
Binary file added images/BTCD.png
Binary file added images/BTCE.png
Binary file added images/BTCL*.png
Binary file added images/BTCL.png
Binary file added images/BTCM.png
Binary file added images/BTCR.png
Binary file added images/BTCRED.png
Binary file added images/BTCRY.png
Binary file added images/BTCS.png
Binary file added images/BTCZ.png
Binary file added images/BTD.png
Binary file added images/BTDX.png
Binary file added images/BTE*.png
Binary file added images/BTE.png
Binary file added images/BTG*.png
Binary file added images/BTG.png
Binary file added images/BTH.png
Binary file added images/BTLC.png
Binary file added images/BTM*.png
Binary file added images/BTM.png
Binary file added images/BTMI.png
Binary file added images/BTPL.png
Binary file added images/BTQ.png
Binary file added images/BTS.png
Binary file added images/BTTF.png
Binary file added images/BTX*.png
Binary file added images/BTX.png
Binary file added images/BTZ.png
Binary file added images/BUCKS*.png
Binary file added images/BUCKS.png
Binary file added images/BUK.png
Binary file added images/BULLS.png
Binary file added images/BURST.png
Binary file added images/BUZZ.png
Binary file added images/BVC.png
Binary file added images/BWK.png
Binary file added images/BXC.jpg
Binary file added images/BXT.png
Loading