Remove unused files
This commit is contained in:
parent
7c4263611f
commit
98d96eaf26
|
@ -63,8 +63,7 @@
|
|||
"svgstore": "npm run svgstore:black && npm run svgstore:color && npm run svgstore:icon && npm run svgstore:white",
|
||||
"clean": "rimraf build && rimraf dist",
|
||||
"build": "npm run minify-images && npm run imacss && npm run svgstore",
|
||||
"prebuild": "npm run clean",
|
||||
"table": "node src/table.js"
|
||||
"prebuild": "npm run clean"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -76,13 +75,7 @@
|
|||
"concat": "^1.0.3",
|
||||
"imacss": "^1.0.0",
|
||||
"imagemin-cli": "^3.0.0",
|
||||
"lodash": "^4.17.5",
|
||||
"markdown-table": "^1.1.1",
|
||||
"mkdirp": "^0.5.1",
|
||||
"node-dir": "^0.1.17",
|
||||
"path": "^0.12.7",
|
||||
"recursive-readdir": "^2.2.2",
|
||||
"request": "^2.85.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"svgstore-cli": "^1.3.1"
|
||||
}
|
||||
|
|
42
src/table.js
42
src/table.js
|
@ -1,42 +0,0 @@
|
|||
const fs = require('fs')
|
||||
const _ = require('lodash')
|
||||
const async = require('async')
|
||||
const path = require('path')
|
||||
const request = require('request')
|
||||
const recursive = require('recursive-readdir')
|
||||
const markdownTable = require('markdown-table')
|
||||
|
||||
const url = 'https://api.coinmarketcap.com/v1/ticker/?limit=0'
|
||||
|
||||
async.autoInject({
|
||||
files: (cb) => recursive(path.join(__dirname, '../svg/'), cb),
|
||||
crypto: (cb) => request(url, (err, res, body) => cb(err, body)),
|
||||
table: (files, crypto, cb) => {
|
||||
const coins = JSON.parse(crypto)
|
||||
const headers = {}
|
||||
const table = _.chain(files)
|
||||
.map(file => {
|
||||
const pathArray = file.split(path.sep)
|
||||
const folder = pathArray[pathArray.length - 2]
|
||||
headers[folder] = true
|
||||
const fileName = path.basename(file, '.svg')
|
||||
const coin = coins.find(coin => coin.symbol.toLowerCase() === fileName)
|
||||
return {
|
||||
symbol: fileName,
|
||||
name: coin ? coin.name : '?',
|
||||
[folder]: 'yes'
|
||||
}
|
||||
})
|
||||
.groupBy(e => e.symbol)
|
||||
.reduce((a, b) => [...a, b.reduce((m, n) => Object.assign({}, m, n))], [])
|
||||
.value()
|
||||
const header = ['symbol', 'name', ...Object.keys(headers)]
|
||||
const tableOfArrays = table.map((coin) => header.map(h => coin[h]))
|
||||
const markdown = markdownTable([header, ...tableOfArrays])
|
||||
|
||||
const readmePath = path.join(__dirname, '../README.md')
|
||||
const readme = fs.readFileSync(readmePath, 'utf-8')
|
||||
const updatedReadme = readme.replace(/<!---start--->[^\0]*?<!---end--->/, `<!---start--->\n${markdown}\n<!---end--->`)
|
||||
fs.writeFile(readmePath, updatedReadme, cb)
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue