Skip to content

Commit 474d05f

Browse files
committed
Added SOL, GRT, STX, AAVE, CRV, SUSHI, NKN, SNX, ANKR, KSM
1 parent f1702f5 commit 474d05f

File tree

468 files changed

+4235
-3704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

468 files changed

+4235
-3704
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cryptoicon",
3-
"version": "0.17.1",
3+
"version": "0.17.2",
44
"description": "Beautiful pixel perfect 400+ cryptocurrency and 10+ Fiat currency icon",
55
"main": "lib/vue-cryptoicon.common.js",
66
"author": "man15h",
@@ -46,7 +46,7 @@
4646
"prod": "cross-env NODE_ENV=production vue-cli-service build",
4747
"test:unit": "vue-cli-service test:unit",
4848
"test": "npm run test:unit",
49-
"update": "node -r esm scripts/updateManifest.js && node scripts/fetchDetails.js",
49+
"update": "node -r esm scripts/build.js && node -r esm scripts/updateManifest.js && node scripts/fetchDetails.js",
5050
"new": "node -r esm scripts/newIcons.js",
5151
"update:manifest": "node -r esm scripts/updateManifest.js"
5252
},
@@ -68,7 +68,7 @@
6868
"babel-eslint": "^10.0.1",
6969
"babel-jest": "^23.6.0",
7070
"cross-env": "^5.2.0",
71-
"cryptocurrency-icons": "^0.10.1",
71+
"cryptocurrency-icons": "^0.17.2",
7272
"eslint": "^5.15.1",
7373
"eslint-config-prettier": "^3.1.0",
7474
"eslint-loader": "^2.1.2",

scripts/build.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
const fs = require('fs');
2+
const glob = require('glob');
3+
const path = require('path');
4+
const { capitalize, removeSvg, fixName } = require('./helpers');
5+
6+
const rootDir = path.join(__dirname, '..');
7+
8+
const indexFile = path.join(rootDir, 'src', 'icons', 'index.js');
9+
const allIcons = [];
10+
glob(
11+
`${rootDir}/node_modules/cryptocurrency-icons/svg/color/*.svg`,
12+
(_, icons) => {
13+
fs.writeFileSync(indexFile, '', 'utf-8');
14+
15+
icons.forEach(icon => {
16+
const colorSvg = fs.readFileSync(icon, 'utf-8');
17+
const blackSvg = fs.readFileSync(icon.replace('color', 'black'), 'utf-8');
18+
19+
const [name] = path.basename(icon).split('.');
20+
const capitalizedName = capitalize(fixName(name));
21+
const colorSvgContent = removeSvg(colorSvg);
22+
const blackSvgContent = removeSvg(blackSvg);
23+
const template =
24+
`const ${capitalizedName} = {
25+
symbol: '${fixName(name)}',
26+
color: '#000', \ncolorIcon() { return ` +
27+
'`' +
28+
colorSvgContent +
29+
'`' +
30+
` }, \nplainIcon: c => {
31+
return` +
32+
'`' +
33+
blackSvgContent.replace(
34+
'<path',
35+
'<path fill-rule="evenodd" fill="${c ? c : this.color}"'
36+
) +
37+
'`\n' +
38+
`} }\n export default ${capitalizedName}; `;
39+
// console.log(prettier.format(template, { semi: false, parser: 'babel' }));
40+
fs.writeFileSync(
41+
`${rootDir}/src/icons/${fixName(name).toLowerCase()}.js`,
42+
template,
43+
'utf-8'
44+
);
45+
const importString = `import ${fixName(
46+
capitalizedName
47+
)} from './${fixName(name).toLowerCase()}';\r\n`;
48+
fs.appendFileSync(indexFile, importString, 'utf-8');
49+
allIcons.push(capitalizedName);
50+
});
51+
const exportString = `export {${fixName(
52+
allIcons.join(', ')
53+
)}} \r\nexport default [${allIcons.join(', ')}]`;
54+
fs.appendFileSync(indexFile, exportString, 'utf-8');
55+
}
56+
);

scripts/helpers.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
exports.capitalize = string => string.charAt(0).toUpperCase() + string.slice(1);
2+
exports.fixName = name => {
3+
switch (name) {
4+
case '0xbtc':
5+
return 'ZeroxBtc';
6+
case '2give':
7+
return 'TwoGive';
8+
default:
9+
return name;
10+
}
11+
};
12+
13+
exports.removeSvg = svg => {
14+
return svg
15+
.replace(
16+
'<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">',
17+
''
18+
)
19+
.replace(
20+
'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">',
21+
''
22+
)
23+
.replace(
24+
'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">',
25+
''
26+
)
27+
.replace(
28+
'<svg height="32" viewBox="0 0 32 32" width="32" xmlns="http://www.w3.org/2000/svg">',
29+
''
30+
)
31+
.replace(
32+
'<svg height="32" width="32" xmlns="http://www.w3.org/2000/svg">',
33+
''
34+
)
35+
.replace(
36+
'<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">',
37+
''
38+
)
39+
.replace(
40+
'<svg width="32" height="32" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">',
41+
''
42+
)
43+
.replace(
44+
'<svg height="32" viewBox="0 0 32 32" width="32" xmlns="http://www.w3.org/2000/svg">',
45+
''
46+
)
47+
.replace(`</svg>`, '');
48+
};

scripts/newIcons.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
const updatedCurrencies = require('./../src/cryptoicons/manifest.json');
1+
const path = require('path');
2+
const { fixName } = require('./helpers');
3+
4+
const rootDir = path.join(__dirname, '..');
5+
const updatedCurrencies = require(`${rootDir}/node_modules/cryptocurrency-icons/manifest.json`);
26
const currencies = require('./../src/icons').default;
37
const newCurrencies = updatedCurrencies.filter(
48
o =>
5-
!currencies.find(o2 => o.symbol.toLowerCase() === o2.symbol.toLowerCase())
9+
!currencies.find(
10+
o2 => fixName(o.symbol.toLowerCase()) == o2.symbol.toLowerCase()
11+
)
612
);
713

814
console.log(newCurrencies);

scripts/updateManifest.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
const fs = require('fs');
2-
const updatedCurrencies = require('./../src/cryptoicons/manifest.json');
2+
const path = require('path');
3+
4+
const rootDir = path.join(__dirname, '..');
5+
const updatedCurrencies = require(`${rootDir}/node_modules/cryptocurrency-icons/manifest.json`);
36
const currencies = require('./../src/icons').default;
47
const newCurrencies = updatedCurrencies.filter(o =>
58
currencies.find(o2 => o.symbol.toLowerCase() === o2.symbol.toLowerCase())

src/cryptoicons

Submodule cryptoicons deleted from 9ab8d69

src/data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/icons/$pac.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/icons/aave.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const Aave = {
2+
symbol: 'aave',
3+
color: '#000',
4+
colorIcon() {
5+
return `<g fill="none"><circle fill="#2EBAC6" cx="16" cy="16" r="16"/><path d="M22.934 21.574l-5.35-13.532C17.28 7.342 16.834 7 16.243 7h-.473c-.592 0-1.039.343-1.341 1.042l-2.327 5.896h-1.761c-.528.002-.956.448-.96 1v.014c.004.553.432.999.96 1.001h.946l-2.221 5.621a1.235 1.235 0 00-.066.384c0 .315.092.562.263.754.17.192.407.288.71.288a.933.933 0 00.552-.192c.17-.123.289-.302.38-.507l2.446-6.348h1.696c.527-.002.955-.449.96-1.001v-.027c-.005-.553-.433-1-.96-1.001h-.907l1.866-4.867L21.093 22.3c.092.205.21.384.381.507.161.122.354.19.553.192.302 0 .539-.096.71-.288.17-.192.262-.439.262-.754a.944.944 0 00-.065-.384z" fill="#FFF"/></g>`;
6+
},
7+
plainIcon: c => {
8+
return `<path fill-rule="evenodd" fill="${
9+
c ? c : this.color
10+
}" d="M16 0c8.837 0 16 7.163 16 16s-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0zm.243 7h-.473c-.592 0-1.039.343-1.341 1.042l-2.327 5.896h-1.761c-.528.002-.956.448-.96 1v.014c.004.553.432.999.96 1.001h.946l-2.221 5.621a1.235 1.235 0 00-.066.384c0 .315.092.562.263.754.17.192.407.288.71.288a.933.933 0 00.552-.192c.17-.123.289-.302.38-.507l2.446-6.348h1.696c.527-.002.955-.449.96-1.001v-.027c-.005-.553-.433-1-.96-1.001h-.907l1.866-4.867L21.093 22.3c.092.205.21.384.381.507.161.122.354.19.553.192.302 0 .539-.096.71-.288.17-.192.262-.439.262-.754a.944.944 0 00-.065-.384l-5.35-13.532C17.28 7.342 16.834 7 16.243 7z"/>`;
11+
}
12+
};
13+
export default Aave;

0 commit comments

Comments
 (0)