mirror of
https://github.com/Instadapp/chains.git
synced 2024-07-29 22:37:19 +00:00
add spinner
This commit is contained in:
parent
a6ac20e777
commit
2791f005f1
|
@ -1,6 +1,13 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { CHAINS_DIRECTORY, stat, tableLog, toNumber } = require('./shared')
|
||||
const {
|
||||
CHAINS_DIRECTORY,
|
||||
startSpinner,
|
||||
stopSpinner,
|
||||
stat,
|
||||
tableLog,
|
||||
toNumber
|
||||
} = require('./shared')
|
||||
|
||||
fs.readdir(CHAINS_DIRECTORY, async function (err, files) {
|
||||
if (err) {
|
||||
|
@ -10,6 +17,8 @@ fs.readdir(CHAINS_DIRECTORY, async function (err, files) {
|
|||
|
||||
let matches = []
|
||||
|
||||
startSpinner(`Counting ${CHAINS_DIRECTORY}`)
|
||||
|
||||
await Promise.all(
|
||||
files.map(async function (file, index) {
|
||||
const filePath = path.join(CHAINS_DIRECTORY, file)
|
||||
|
@ -25,6 +34,8 @@ fs.readdir(CHAINS_DIRECTORY, async function (err, files) {
|
|||
})
|
||||
)
|
||||
|
||||
stopSpinner()
|
||||
|
||||
console.log(
|
||||
`There are ${files.length} known EVM chains from which ${
|
||||
matches.length
|
||||
|
|
84
scripts/package-lock.json
generated
84
scripts/package-lock.json
generated
|
@ -64,7 +64,6 @@
|
|||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-convert": "^1.9.0"
|
||||
}
|
||||
|
@ -134,7 +133,6 @@
|
|||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
|
@ -151,22 +149,30 @@
|
|||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
|
||||
"integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"restore-cursor": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"cli-spinners": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.2.0.tgz",
|
||||
"integrity": "sha512-tgU3fKwzYjiLEQgPMD9Jt+JjHVL9kW93FiIMX/l7rivvOD4/LL0Mf7gda3+4U2KJBloybwgj5KEoQgGRioMiKQ=="
|
||||
},
|
||||
"cli-width": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
|
||||
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
|
||||
"dev": true
|
||||
},
|
||||
"clone": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz",
|
||||
"integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4="
|
||||
},
|
||||
"color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
|
@ -174,8 +180,7 @@
|
|||
"color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"dev": true
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
|
@ -217,6 +222,14 @@
|
|||
"integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=",
|
||||
"dev": true
|
||||
},
|
||||
"defaults": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",
|
||||
"integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=",
|
||||
"requires": {
|
||||
"clone": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"define-properties": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||
|
@ -283,8 +296,7 @@
|
|||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
|
||||
"dev": true
|
||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||
},
|
||||
"eslint": {
|
||||
"version": "5.16.0",
|
||||
|
@ -707,8 +719,7 @@
|
|||
"has-flag": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
|
||||
},
|
||||
"has-symbols": {
|
||||
"version": "1.0.0",
|
||||
|
@ -943,11 +954,18 @@
|
|||
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
|
||||
"integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg="
|
||||
},
|
||||
"log-symbols": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
|
||||
"integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==",
|
||||
"requires": {
|
||||
"chalk": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"mimic-fn": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz",
|
||||
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ=="
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
|
@ -1028,7 +1046,6 @@
|
|||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
|
||||
"integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mimic-fn": "^1.0.0"
|
||||
}
|
||||
|
@ -1047,6 +1064,34 @@
|
|||
"wordwrap": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"ora": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/ora/-/ora-3.4.0.tgz",
|
||||
"integrity": "sha512-eNwHudNbO1folBP3JsZ19v9azXWtQZjICdr3Q0TDPIaeBQ3mXLrh54wM+er0+hSp+dWKf+Z8KM58CYzEyIYxYg==",
|
||||
"requires": {
|
||||
"chalk": "^2.4.2",
|
||||
"cli-cursor": "^2.1.0",
|
||||
"cli-spinners": "^2.0.0",
|
||||
"log-symbols": "^2.2.0",
|
||||
"strip-ansi": "^5.2.0",
|
||||
"wcwidth": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg=="
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"requires": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
|
@ -1213,7 +1258,6 @@
|
|||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
|
||||
"integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"onetime": "^2.0.0",
|
||||
"signal-exit": "^3.0.2"
|
||||
|
@ -1276,8 +1320,7 @@
|
|||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||
"dev": true
|
||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
||||
},
|
||||
"slice-ansi": {
|
||||
"version": "2.1.0",
|
||||
|
@ -1363,7 +1406,6 @@
|
|||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"has-flag": "^3.0.0"
|
||||
}
|
||||
|
@ -1463,6 +1505,14 @@
|
|||
"spdx-expression-parse": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"wcwidth": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz",
|
||||
"integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=",
|
||||
"requires": {
|
||||
"defaults": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
"axios": "^0.19.0",
|
||||
"bignumber.js": "^9.0.0",
|
||||
"dotenv": "^8.0.0",
|
||||
"lodash.sortby": "^4.7.0"
|
||||
"lodash.sortby": "^4.7.0",
|
||||
"ora": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^5.16.0",
|
||||
|
|
|
@ -3,6 +3,7 @@ const path = require('path')
|
|||
const axios = require('axios')
|
||||
const BigNumber = require('bignumber.js')
|
||||
const sortBy = require('lodash.sortby')
|
||||
const ora = require('ora')
|
||||
|
||||
require('dotenv').config()
|
||||
|
||||
|
@ -24,6 +25,18 @@ const CHAIN_ID_REQ = {
|
|||
params: []
|
||||
}
|
||||
|
||||
let spinner = null
|
||||
|
||||
function startSpinner (message) {
|
||||
spinner = ora(message).start()
|
||||
}
|
||||
|
||||
function stopSpinner () {
|
||||
if (spinner) {
|
||||
spinner.stop()
|
||||
}
|
||||
}
|
||||
|
||||
function padRight (n, width, z) {
|
||||
z = z || '0'
|
||||
n = n + ''
|
||||
|
@ -165,6 +178,8 @@ module.exports = {
|
|||
CHAINS_DIRECTORY,
|
||||
NET_VERSION_REQ,
|
||||
CHAIN_ID_REQ,
|
||||
startSpinner,
|
||||
stopSpinner,
|
||||
padRight,
|
||||
paddedLog,
|
||||
tableLog,
|
||||
|
|
|
@ -2,6 +2,8 @@ const fs = require('fs')
|
|||
const path = require('path')
|
||||
const {
|
||||
CHAINS_DIRECTORY,
|
||||
startSpinner,
|
||||
stopSpinner,
|
||||
tableLog,
|
||||
stat,
|
||||
writeJson,
|
||||
|
@ -15,7 +17,7 @@ fs.readdir(CHAINS_DIRECTORY, async function (err, files) {
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log('Verifying:', CHAINS_DIRECTORY)
|
||||
startSpinner(`Verifying ${CHAINS_DIRECTORY}`)
|
||||
|
||||
let result = []
|
||||
|
||||
|
@ -38,6 +40,8 @@ fs.readdir(CHAINS_DIRECTORY, async function (err, files) {
|
|||
})
|
||||
)
|
||||
|
||||
stopSpinner()
|
||||
|
||||
tableLog(result)
|
||||
|
||||
console.log(
|
||||
|
|
Loading…
Reference in New Issue
Block a user