Cleanup #185
This commit is contained in:
parent
8b1e8a966b
commit
0bf00bb3d8
|
@ -0,0 +1,34 @@
|
|||
## Maintaining
|
||||
|
||||
We don't currently accept contributions for icons as the process for creating them is a bit complicated. This guide is for the maintainers.
|
||||
|
||||
### Adding a new icon
|
||||
|
||||
- Create the icon and export from Sketch.
|
||||
- Add the symbol name of the currency to `manifest.json`, for example:
|
||||
```js
|
||||
[
|
||||
{
|
||||
"symbol": "$PAC",
|
||||
"name": "Paccoin"
|
||||
},
|
||||
// …
|
||||
{
|
||||
"symbol": "BTC"
|
||||
}
|
||||
]
|
||||
```
|
||||
- Then run `npm install && npm run manifest` and the name will be filled in:
|
||||
```js
|
||||
[
|
||||
{
|
||||
"symbol": "$PAC",
|
||||
"name": "Paccoin"
|
||||
},
|
||||
// …
|
||||
{
|
||||
"symbol": "BTC",
|
||||
"name": "Bitcoin"
|
||||
}
|
||||
]
|
||||
```
|
1228
manifest.json
1228
manifest.json
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
|
@ -41,11 +41,18 @@
|
|||
"erc721"
|
||||
],
|
||||
"scripts": {
|
||||
"manifest": "node scripts/manifest.js",
|
||||
"precommit": "npm run manifest"
|
||||
"test": "xo",
|
||||
"manifest": "node scripts/manifest.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"alpha-sort": "^2.0.1",
|
||||
"coinlist": "^2.0.0"
|
||||
"coinlist": "^3.0.0",
|
||||
"husky": "^1.0.0-rc.13",
|
||||
"xo": "^0.22.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "npm run manifest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
const manifest = require('../manifest.json');
|
||||
'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 {
|
||||
name: coins.get(id, 'name') || id,
|
||||
symbol: id.toUpperCase(),
|
||||
name: coins.get(id, 'name') || id
|
||||
};
|
||||
});
|
||||
|
||||
icons.sort((a, b) => {
|
||||
return alphaSort.asc(a.symbol, b.symbol);
|
||||
});
|
||||
icons.sort((a, b) => alphaSort.asc(a.symbol, b.symbol));
|
||||
|
||||
fs.writeFileSync(path.resolve(__dirname, '../manifest.json'), JSON.stringify(icons, null, 4));
|
||||
const data = JSON.stringify(icons, null, '\t') + '\n';
|
||||
|
||||
fs.writeFileSync(path.resolve(__dirname, '../manifest.json'), data);
|
||||
|
|
Loading…
Reference in New Issue