From 4b099cc0eb1c837eacd2032c6530f535bd8d7a3e Mon Sep 17 00:00:00 2001 From: shuse2 Date: Tue, 11 Dec 2018 03:49:57 +0800 Subject: [PATCH 1/6] :seedling: Update copyright and warranty commands --- src/commands/{copyright.js => copyright.ts} | 22 +++++++++---------- src/commands/{warranty.js => warranty.ts} | 22 +++++++++---------- .../{copyright.test.js => copyright.test.ts} | 0 .../{warranty.test.js => warranty.test.ts} | 0 4 files changed, 22 insertions(+), 22 deletions(-) rename src/commands/{copyright.js => copyright.ts} (88%) rename src/commands/{warranty.js => warranty.ts} (88%) rename test/commands/{copyright.test.js => copyright.test.ts} (100%) rename test/commands/{warranty.test.js => warranty.test.ts} (100%) diff --git a/src/commands/copyright.js b/src/commands/copyright.ts similarity index 88% rename from src/commands/copyright.js rename to src/commands/copyright.ts index 281fa764..10aeb83a 100644 --- a/src/commands/copyright.js +++ b/src/commands/copyright.ts @@ -33,17 +33,17 @@ along with this program. If not, see . `.trim(); export default class CopyrightCommand extends BaseCommand { - async run() { - this.print({ copyright }); - } -} + static description = ` + Displays copyright notice. + `; -CopyrightCommand.flags = { - ...BaseCommand.flags, -}; + static examples = ['copyright']; -CopyrightCommand.description = ` -Displays copyright notice. -`; + static flags = { + ...BaseCommand.flags, + }; -CopyrightCommand.examples = ['copyright']; + async run(): Promise { + this.print({ copyright }); + } +} diff --git a/src/commands/warranty.js b/src/commands/warranty.ts similarity index 88% rename from src/commands/warranty.js rename to src/commands/warranty.ts index 9fed402d..8bee517a 100644 --- a/src/commands/warranty.js +++ b/src/commands/warranty.ts @@ -27,17 +27,17 @@ along with this program. If not, see . `.trim(); export default class WarrantyCommand extends BaseCommand { - async run() { - this.print({ warranty }); - } -} + static description = ` + Displays warranty notice. + `; -WarrantyCommand.flags = { - ...BaseCommand.flags, -}; + static examples = ['warranty']; -WarrantyCommand.description = ` -Displays warranty notice. -`; + static flags = { + ...BaseCommand.flags, + }; -WarrantyCommand.examples = ['warranty']; + async run(): Promise { + this.print({ warranty }); + } +} diff --git a/test/commands/copyright.test.js b/test/commands/copyright.test.ts similarity index 100% rename from test/commands/copyright.test.js rename to test/commands/copyright.test.ts diff --git a/test/commands/warranty.test.js b/test/commands/warranty.test.ts similarity index 100% rename from test/commands/warranty.test.js rename to test/commands/warranty.test.ts From bc6714748f3c7bf6117f4bf88fdea6f7c4bbd6be Mon Sep 17 00:00:00 2001 From: shuse2 Date: Tue, 11 Dec 2018 03:52:59 +0800 Subject: [PATCH 2/6] :arrow_up: Update oclif to fix esModuleInterop --- package-lock.json | 279 +++++++++++++++++++++++++----------------- package.json | 15 +-- src/utils/mnemonic.ts | 2 +- test/mocha.opts | 1 + 4 files changed, 174 insertions(+), 123 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2365a2aa..4eb3d697 100644 --- a/package-lock.json +++ b/package-lock.json @@ -84,54 +84,152 @@ "dev": true }, "@oclif/command": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@oclif/command/-/command-1.5.0.tgz", - "integrity": "sha512-ZKvLLLCtIVNgsUXIECOz7WhTOw5j+eyG5Ly7AncJrCN2ENfFfp5BobX6Vvg3P2eL01RxZhnSXIiyJX79QLiD6Q==", + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/@oclif/command/-/command-1.5.6.tgz", + "integrity": "sha512-XBj13dw13qrRzUfAc4d6b8PlZXALFglJ8xydX34aazLJCzeP8mtTcAJTi6ylTwWVhIW2HDO9npTd4FviDY279g==", "requires": { - "@oclif/errors": "^1.1.2", - "@oclif/parser": "^3.6.0", - "debug": "^3.1.0", - "semver": "^5.5.0" + "@oclif/errors": "^1.2.2", + "@oclif/parser": "^3.7.0", + "debug": "^4.1.0", + "semver": "^5.6.0" + }, + "dependencies": { + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + } } }, "@oclif/config": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/@oclif/config/-/config-1.7.4.tgz", - "integrity": "sha512-vkK/9PXNsOEEdjsb7D/slclLJNvwTax7e2ApjOpnh8sYL34LcpVC9RA05ypCeoDvQiihN8ZdbMut0/AwskKAaQ==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@oclif/config/-/config-1.9.0.tgz", + "integrity": "sha512-R9HJvS7x4Ff/VFGlg8b7hxFnuC77y7znr1iXwRay4Jhd/EFJyZRT9d9SHzA6TS8lz9vDTW93xOFakT9AXld4Kg==", "requires": { - "debug": "^3.1.0", + "debug": "^4.1.0", "tslib": "^1.9.3" + }, + "dependencies": { + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } } }, "@oclif/dev-cli": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/@oclif/dev-cli/-/dev-cli-1.18.0.tgz", - "integrity": "sha512-H32/r9ZS1YYTSqTrocaxk6I3HxMVI9/VudA3Sm1LrT6BsgdKToa0nyZ9vyOaBGOsvtiktMCNAFN5AWuT4xD29A==", + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@oclif/dev-cli/-/dev-cli-1.19.5.tgz", + "integrity": "sha512-9G2DM/AXahoaZ1u7HZVYpDPjEurpilS3sTJRB5M4g8hiidNBIHQjZeZ51IZsUJ3Fl45idVvkiuHyI43bbU2uKw==", "dev": true, "requires": { - "@oclif/command": "^1.5.0", - "@oclif/config": "^1.7.4", - "@oclif/errors": "^1.2.0", - "@oclif/plugin-help": "^2.1.1", - "cli-ux": "^4.8.1", - "debug": "^3.1.0", + "@oclif/command": "^1.5.4", + "@oclif/config": "^1.8.7", + "@oclif/errors": "^1.2.2", + "@oclif/plugin-help": "^2.1.2", + "cli-ux": "^4.9.0", + "debug": "^4.1.0", "fs-extra": "^7.0.0", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "normalize-package-data": "^2.4.0", "qqjs": "^0.3.10", "tslib": "^1.9.3" + }, + "dependencies": { + "@oclif/plugin-help": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@oclif/plugin-help/-/plugin-help-2.1.4.tgz", + "integrity": "sha512-wG4eR/UxYangQlyn4XvslVV4wpBNQrEC/PvRibQq+0jNop/7zfK3jdWuK5PVB0mxZfhPwBSMZzV/3ur6DN+Bbg==", + "dev": true, + "requires": { + "@oclif/command": "^1.5.4", + "chalk": "^2.4.1", + "indent-string": "^3.2.0", + "lodash.template": "^4.4.0", + "string-width": "^2.1.1", + "strip-ansi": "^5.0.0", + "widest-line": "^2.0.1", + "wrap-ansi": "^4.0.0" + } + }, + "ansi-regex": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz", + "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==", + "dev": true + }, + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "strip-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz", + "integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==", + "dev": true, + "requires": { + "ansi-regex": "^4.0.0" + } + } } }, "@oclif/errors": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@oclif/errors/-/errors-1.2.0.tgz", - "integrity": "sha512-DIcWydwfESHVMwrZt3lj5qLAiX296vdfA6K7utCa2/6nmT1JgBc102iFcjpmNxUzDKBU67NKCVBPSMCBDD/1wg==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@oclif/errors/-/errors-1.2.2.tgz", + "integrity": "sha512-Eq8BFuJUQcbAPVofDxwdE0bL14inIiwt5EaKRVY9ZDIG11jwdXZqiQEECJx0VfnLyUZdYfRd/znDI/MytdJoKg==", "requires": { "clean-stack": "^1.3.0", "fs-extra": "^7.0.0", "indent-string": "^3.2.0", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^3.0.1" + "strip-ansi": "^5.0.0", + "wrap-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz", + "integrity": "sha512-iB5Dda8t/UqpPI/IjsejXu5jOGDrzn41wJyljwPH65VCIbk6+1BzFIMJGFwTNrYXT1CrD+B4l19U7awiQ8rk7w==" + }, + "strip-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.0.0.tgz", + "integrity": "sha512-Uu7gQyZI7J7gn5qLn1Np3G9vcYGTVqB+lFTytnDJv83dd8T22aGH451P3jueT2/QemInJDfxHB5Tde5OzgG1Ow==", + "requires": { + "ansi-regex": "^4.0.0" + } + } } }, "@oclif/linewrap": { @@ -182,12 +280,12 @@ "dev": true }, "@oclif/test": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@oclif/test/-/test-1.2.0.tgz", - "integrity": "sha512-AStDnb9Ku4U+5Zs/2UIsgLBFaAWTDujW4r3JJpbJhhu0jJjJjD3qVo4oJ3QOzuH4/17iPn3jd8L6Np1Q+1GP8A==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@oclif/test/-/test-1.2.2.tgz", + "integrity": "sha512-ig8bwNRQVOqTJL03iSKzkEG0OHp4ai5uDragU1+8RHh1DDs5unF46lyd/zLkIicDZXrmEhlIuAjkBdK1apH6Bw==", "dev": true, "requires": { - "fancy-test": "^1.3.0" + "fancy-test": "^1.4.1" } }, "@sinonjs/formatio": { @@ -274,9 +372,9 @@ "dev": true }, "@types/lodash": { - "version": "4.14.119", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.119.tgz", - "integrity": "sha512-Z3TNyBL8Vd/M9D9Ms2S3LmFq2sSMzahodD6rCS9V2N44HUMINb75jNkSuwAx7eo2ufqTdfOdtGQpNbieUjPQmw==", + "version": "4.14.118", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.118.tgz", + "integrity": "sha512-iiJbKLZbhSa6FYRip/9ZDX6HXhayXLDGY2Fqws9cOkEQ6XeKfaxB0sC541mowZJueYyMnVUmmG+al5/4fCDrgw==", "dev": true }, "@types/mocha": { @@ -1123,27 +1221,6 @@ "tslib": "^1.9.3" }, "dependencies": { - "@oclif/errors": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@oclif/errors/-/errors-1.2.2.tgz", - "integrity": "sha512-Eq8BFuJUQcbAPVofDxwdE0bL14inIiwt5EaKRVY9ZDIG11jwdXZqiQEECJx0VfnLyUZdYfRd/znDI/MytdJoKg==", - "dev": true, - "requires": { - "clean-stack": "^1.3.0", - "fs-extra": "^7.0.0", - "indent-string": "^3.2.0", - "strip-ansi": "^5.0.0", - "wrap-ansi": "^4.0.0" - }, - "dependencies": { - "clean-stack": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-1.3.0.tgz", - "integrity": "sha1-noIVAa6XmYbEax1m0tQy2y/UrjE=", - "dev": true - } - } - }, "ansi-regex": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.0.0.tgz", @@ -1170,34 +1247,6 @@ "requires": { "ansi-regex": "^4.0.0" } - }, - "wrap-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-4.0.0.tgz", - "integrity": "sha512-uMTsj9rDb0/7kk1PbcbCcwvHUxp60fGDB/NNXpVa0Q+ic/e7y5+BwTxKfQ33VYgDppSwi/FBzpetYzo8s6tfbg==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } } } }, @@ -1309,16 +1358,17 @@ } }, "coveralls": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.0.tgz", - "integrity": "sha512-ZppXR9y5PraUOrf/DzHJY6gzNUhXYE3b9D43xEXs4QYZ7/Oe0Gy0CS+IPKWFfvQFXB3RG9QduaQUFehzSpGAFw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.2.tgz", + "integrity": "sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw==", "dev": true, "requires": { - "js-yaml": "^3.6.1", + "growl": "~> 1.10.0", + "js-yaml": "^3.11.0", "lcov-parse": "^0.0.10", - "log-driver": "^1.2.5", + "log-driver": "^1.2.7", "minimist": "^1.2.0", - "request": "^2.79.0" + "request": "^2.85.0" }, "dependencies": { "minimist": { @@ -1736,9 +1786,9 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" }, "fancy-test": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/fancy-test/-/fancy-test-1.4.0.tgz", - "integrity": "sha512-35CJcYGL/Y2K68EDf9TAMORgOUX2+EvzopPtHnFFQt4qXqzqV2fUXr5ZH4/ZPBPDrUfinLiWPxGjrHUiALlbqQ==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/fancy-test/-/fancy-test-1.4.1.tgz", + "integrity": "sha512-PdE3epBdheFF4T2C1o/w1M0k0VBdw4qOF2juYKbNMg8LCjMBZwBSjdRe0+0d+97MPzjQaCT+87PNdTpT9Fkiiw==", "dev": true, "requires": { "@types/chai": "^4.1.4", @@ -1747,11 +1797,17 @@ "@types/nock": "^9.3.0", "@types/node": "^10.9.4", "@types/sinon": "^5.0.2", - "lodash": "^4.17.10", + "lodash": "^4.17.11", "mock-stdin": "^0.3.1", "stdout-stderr": "^0.1.9" } }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, "fast-glob": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.4.tgz", @@ -2023,12 +2079,6 @@ "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true } } }, @@ -2108,9 +2158,9 @@ "dev": true }, "http-call": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/http-call/-/http-call-5.2.2.tgz", - "integrity": "sha512-DMEU+vvbrvt7n1BYPacbvtSwUmIgORP7HphTmKFqt1wBVeGi/+ADe7KkfyKAcnpa9HEoVaPWdfpOKy7fNeLdiw==", + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/http-call/-/http-call-5.2.3.tgz", + "integrity": "sha512-IkwGruHVHATmnonLKMGX5tkpM0KSn/C240o8/OfBsESRaJacykSia+akhD0d3fljQ5rQPXtBvSrVShAsj+EOUQ==", "dev": true, "requires": { "content-type": "^1.0.4", @@ -2564,14 +2614,6 @@ "extsprintf": "1.3.0", "json-schema": "0.2.3", "verror": "1.10.0" - }, - "dependencies": { - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true - } } }, "just-extend": { @@ -5543,6 +5585,12 @@ "tslib": "^1.9.0" } }, + "rxjs-compat": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.3.3.tgz", + "integrity": "sha512-caGN7ixiabHpOofginKEquuHk7GgaCrC7UpUQ9ZqGp80tMc68msadOeP/2AKy2R4YJsT1+TX5GZCtxO82qWkyA==", + "dev": true + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -5855,9 +5903,9 @@ "dev": true }, "spdx-correct": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.2.tgz", - "integrity": "sha512-q9hedtzyXHr5S0A1vEPoK/7l8NpfkFYTq6iCY+Pno2ZbdZR6WexZFtqeVGkGxW3TEJMN914Z55EnAGMmenlIQQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", "dev": true, "requires": { "spdx-expression-parse": "^3.0.0", @@ -6457,10 +6505,11 @@ } }, "wrap-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", - "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-4.0.0.tgz", + "integrity": "sha512-uMTsj9rDb0/7kk1PbcbCcwvHUxp60fGDB/NNXpVa0Q+ic/e7y5+BwTxKfQ33VYgDppSwi/FBzpetYzo8s6tfbg==", "requires": { + "ansi-styles": "^3.2.0", "string-width": "^2.1.1", "strip-ansi": "^4.0.0" } diff --git a/package.json b/package.json index 08c059c2..07262f36 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "lint:fix": "npm run lint -- --fix", "test": "if [ -z $JENKINS_HOME ]; then npm run test:local; else npm run test:ci; fi", "test:local": "TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/{,/**/,/**/**/,/**/**/**/}/*.ts", - "test:ci": "NODE_ENV=test nyc --exclude \"**/node_modules/** coverage/**\" mocha test", + "test:ci": "npm run test:local", "test:watch": "npm run test:local -- --watch", "test:watch:min": "npm run test:watch -- --reporter=min", "cover": "if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi", @@ -108,9 +108,9 @@ "@liskhq/lisk-cryptography": "2.0.0", "@liskhq/lisk-passphrase": "2.0.0", "@liskhq/lisk-transactions": "2.0.0", - "@oclif/command": "1.5.0", - "@oclif/config": "1.7.4", - "@oclif/errors": "1.2.0", + "@oclif/command": "1.5.6", + "@oclif/config": "1.9.0", + "@oclif/errors": "1.2.2", "@oclif/plugin-help": "2.1.1", "bip39": "2.5.0", "chalk": "2.4.1", @@ -122,8 +122,8 @@ "tslib": "1.9.3" }, "devDependencies": { - "@oclif/dev-cli": "1.18.0", - "@oclif/test": "1.2.0", + "@oclif/dev-cli": "1.19.5", + "@oclif/test": "1.2.2", "@types/bip39": "2.4.0", "@types/chai": "4.1.5", "@types/chai-as-promised": "7.1.0", @@ -139,13 +139,14 @@ "@types/strip-ansi": "3.0.0", "chai": "4.1.2", "chai-as-promised": "7.1.1", - "coveralls": "3.0.0", + "coveralls": "3.0.2", "globby": "8.0.1", "husky": "0.14.3", "lint-staged": "5.0.0", "mocha": "4.0.1", "nyc": "11.3.0", "prettier": "1.9.2", + "rxjs-compat": "6.3.3", "sinon": "4.1.2", "sinon-chai": "2.14.0", "source-map-support": "0.5.9", diff --git a/src/utils/mnemonic.ts b/src/utils/mnemonic.ts index 01724f8e..437ba2f8 100644 --- a/src/utils/mnemonic.ts +++ b/src/utils/mnemonic.ts @@ -13,7 +13,7 @@ * Removal or modification of this copyright notice is prohibited. * */ -import Mnemonic from 'bip39'; +import { Mnemonic } from '@liskhq/lisk-passphrase'; export const createMnemonicPassphrase = Mnemonic.generateMnemonic; diff --git a/test/mocha.opts b/test/mocha.opts index f5c0df33..8c7a30e8 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1,4 +1,5 @@ --recursive +--timeout 8000 --require ts-node/register --require tsconfig-paths/register --require source-map-support/register From 0ce6f1e0ad61e465cf4fb09653a5af76c3bc7f80 Mon Sep 17 00:00:00 2001 From: shuse2 Date: Tue, 11 Dec 2018 03:53:28 +0800 Subject: [PATCH 3/6] :nail_care: Apply format --- src/base.ts | 4 +-- src/commands/account/get.ts | 4 +-- src/commands/delegate/get.ts | 4 ++- src/commands/delegate/voters.ts | 6 +++- src/commands/node/forging.ts | 18 +++++----- src/commands/node/get.ts | 3 -- src/commands/signature/broadcast.ts | 1 - src/commands/signature/create.ts | 9 +++-- src/commands/transaction/broadcast.ts | 1 - src/commands/transaction/create.ts | 14 +++++--- src/commands/transaction/create/delegate.ts | 12 +++++-- .../transaction/create/multisignature.ts | 21 +++++++---- .../transaction/create/second-passphrase.ts | 15 +++++--- src/commands/transaction/create/transfer.ts | 11 +++--- src/commands/transaction/create/vote.ts | 19 +++++++--- src/commands/transaction/get.ts | 11 ++++-- src/commands/transaction/sign.ts | 2 +- src/commands/transaction/verify.ts | 4 +-- src/utils/query.ts | 25 +++++++------ test/commands/signature/create.test.ts | 36 +++++++++++-------- test/commands/transaction/create/vote.test.ts | 6 +++- test/commands/transaction/get.test.ts | 12 +++++-- test/utils/query.ts | 36 ++++--------------- 23 files changed, 154 insertions(+), 120 deletions(-) diff --git a/src/base.ts b/src/base.ts index 150b6434..5ec5faf7 100644 --- a/src/base.ts +++ b/src/base.ts @@ -63,8 +63,8 @@ export default abstract class BaseCommand extends Command { async init(): Promise { // Typing problem where constructor is not allow as Input but it requires to be the type - const { flags } = this.parse((// tslint:disable-next-line no-any - this.constructor as unknown) as flagParser.Input); + const { flags } = this.parse(// tslint:disable-next-line no-any + (this.constructor as unknown) as flagParser.Input); this.printFlags = flags; process.stdout.on('error', handleEPIPE); diff --git a/src/commands/account/get.ts b/src/commands/account/get.ts index e904650b..08e61109 100644 --- a/src/commands/account/get.ts +++ b/src/commands/account/get.ts @@ -46,9 +46,7 @@ export default class GetCommand extends BaseCommand { async run(): Promise { const { args } = this.parse(GetCommand); const { addresses: addressesStr }: Args = args; - const addresses = addressesStr - .split(',') - .filter(Boolean); + const addresses = addressesStr.split(',').filter(Boolean); const req = addresses.map((address: string) => ({ query: { limit: 1, diff --git a/src/commands/delegate/get.ts b/src/commands/delegate/get.ts index c9e4d23f..2504c39b 100644 --- a/src/commands/delegate/get.ts +++ b/src/commands/delegate/get.ts @@ -46,7 +46,9 @@ export default class GetCommand extends BaseCommand { async run(): Promise { const { args } = this.parse(GetCommand); const { usernames: usernamesStr }: Args = args; - const usernames: ReadonlyArray = usernamesStr.split(',').filter(Boolean); + const usernames: ReadonlyArray = usernamesStr + .split(',') + .filter(Boolean); const req = usernames.map(username => ({ query: { limit: 1, diff --git a/src/commands/delegate/voters.ts b/src/commands/delegate/voters.ts index b28375f7..d7dcc124 100644 --- a/src/commands/delegate/voters.ts +++ b/src/commands/delegate/voters.ts @@ -34,7 +34,11 @@ const DEFAULT_LIMIT = 10; const DEFAULT_OFFSET = 0; const DEFAULT_SORT = 'balance:desc'; -const processFlagInputs = (limitStr: string, offsetStr: string, sortStr: string): QueryParameters => { +const processFlagInputs = ( + limitStr: string, + offsetStr: string, + sortStr: string, +): QueryParameters => { const limit = parseInt(limitStr, 10); const offset = parseInt(offsetStr, 10); const sort = sortStr ? sortStr.trim() : undefined; diff --git a/src/commands/node/forging.ts b/src/commands/node/forging.ts index 3de1968c..b75c65e8 100644 --- a/src/commands/node/forging.ts +++ b/src/commands/node/forging.ts @@ -30,7 +30,12 @@ interface Args { const STATUS_ENABLE = 'enable'; const STATUS_DISABLE = 'disable'; -const processInput = (client: APIClient, status: string, publicKey: string, password?: string) => { +const processInput = ( + client: APIClient, + status: string, + publicKey: string, + password?: string, +) => { if (!password) { throw new ValidationError('No password was provided.'); } @@ -42,8 +47,7 @@ const processInput = (client: APIClient, status: string, publicKey: string, pass forging: status === STATUS_ENABLE, }) .then(response => response.data); -} - +}; export default class ForgingCommand extends BaseCommand { static args = [ @@ -75,10 +79,9 @@ export default class ForgingCommand extends BaseCommand { }; async run(): Promise { - const { - args, - flags: { password: passwordSource }, - } = this.parse(ForgingCommand); + const { args, flags: { password: passwordSource } } = this.parse( + ForgingCommand, + ); const { status, publicKey }: Args = args; transactions.utils.validatePublicKey(publicKey); @@ -94,4 +97,3 @@ export default class ForgingCommand extends BaseCommand { this.print(result); } } - diff --git a/src/commands/node/get.ts b/src/commands/node/get.ts index f49f040b..95cbca63 100644 --- a/src/commands/node/get.ts +++ b/src/commands/node/get.ts @@ -62,6 +62,3 @@ export default class GetCommand extends BaseCommand { this.print(fullInfo); } } - - - diff --git a/src/commands/signature/broadcast.ts b/src/commands/signature/broadcast.ts index 7d4314fb..f51b06c9 100644 --- a/src/commands/signature/broadcast.ts +++ b/src/commands/signature/broadcast.ts @@ -76,4 +76,3 @@ export default class BroadcastCommand extends BaseCommand { this.print(response.data); } } - diff --git a/src/commands/signature/create.ts b/src/commands/signature/create.ts index ebe73d68..09d06289 100644 --- a/src/commands/signature/create.ts +++ b/src/commands/signature/create.ts @@ -62,10 +62,9 @@ export default class CreateCommand extends BaseCommand { }; async run(): Promise { - const { - args, - flags: { passphrase: passphraseSource }, - } = this.parse(CreateCommand); + const { args, flags: { passphrase: passphraseSource } } = this.parse( + CreateCommand, + ); const { transaction }: Args = args; const transactionInput = transaction || (await getTransactionInput()); @@ -95,4 +94,4 @@ export default class CreateCommand extends BaseCommand { this.print(result); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/broadcast.ts b/src/commands/transaction/broadcast.ts index 9984f80f..107fc8a9 100644 --- a/src/commands/transaction/broadcast.ts +++ b/src/commands/transaction/broadcast.ts @@ -64,4 +64,3 @@ export default class BroadcastCommand extends BaseCommand { this.print(response.data); } } - diff --git a/src/commands/transaction/create.ts b/src/commands/transaction/create.ts index dcc7df02..aca0cfce 100644 --- a/src/commands/transaction/create.ts +++ b/src/commands/transaction/create.ts @@ -37,7 +37,11 @@ const typeNumberMap: TypeNumberMap = { }; const options = Object.entries(typeNumberMap).reduce( - (accumulated: string[], [key, value]: [string, string]) => [...accumulated, key, value], + (accumulated: string[], [key, value]: [string, string]) => [ + ...accumulated, + key, + value, + ], [], ); @@ -53,7 +57,10 @@ const typeClassMap: TypeClassMap = { multisignature: MultisignatureCommand, }; -const resolveFlags = (accumulated: ReadonlyArray, [key, value]: [string, string | boolean | undefined]) => { +const resolveFlags = ( + accumulated: ReadonlyArray, + [key, value]: [string, string | boolean | undefined], +) => { if (key === 'type') { return accumulated; } @@ -104,6 +111,3 @@ export default class CreateCommand extends BaseCommand { await typeClassMap[commandType].run([...argv, ...resolvedFlags]); } } - - - diff --git a/src/commands/transaction/create/delegate.ts b/src/commands/transaction/create/delegate.ts index ae5591e8..e32601c1 100644 --- a/src/commands/transaction/create/delegate.ts +++ b/src/commands/transaction/create/delegate.ts @@ -17,13 +17,19 @@ import { registerDelegate } from '@liskhq/lisk-transactions'; import { flags as flagParser } from '@oclif/command'; import BaseCommand from '../../../base'; import { flags as commonFlags } from '../../../utils/flags'; -import { getInputsFromSources, InputFromSourceOutput } from '../../../utils/input'; +import { + getInputsFromSources, + InputFromSourceOutput, +} from '../../../utils/input'; interface Args { readonly username: string; } -const processInputs = (username: string) => ({ passphrase, secondPassphrase }: InputFromSourceOutput) => +const processInputs = (username: string) => ({ + passphrase, + secondPassphrase, +}: InputFromSourceOutput) => registerDelegate({ passphrase, secondPassphrase, @@ -90,4 +96,4 @@ export default class DelegateCommand extends BaseCommand { const result = processFunction(inputs); this.print(result); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/create/multisignature.ts b/src/commands/transaction/create/multisignature.ts index 089fe618..90081dbb 100644 --- a/src/commands/transaction/create/multisignature.ts +++ b/src/commands/transaction/create/multisignature.ts @@ -13,12 +13,18 @@ * Removal or modification of this copyright notice is prohibited. * */ -import { registerMultisignature, utils as transactionUtils } from '@liskhq/lisk-transactions'; +import { + registerMultisignature, + utils as transactionUtils, +} from '@liskhq/lisk-transactions'; import { flags as flagParser } from '@oclif/command'; import BaseCommand from '../../../base'; import { flags as commonFlags } from '../../../utils/flags'; import { validateLifetime, validateMinimum } from '../../../utils/helpers'; -import { getInputsFromSources, InputFromSourceOutput } from '../../../utils/input'; +import { + getInputsFromSources, + InputFromSourceOutput, +} from '../../../utils/input'; interface Args { readonly keysgroup: string; @@ -26,10 +32,11 @@ interface Args { readonly minimum: string; } -const processInputs = (lifetime: number, minimum: number, keysgroup: ReadonlyArray) => ({ - passphrase, - secondPassphrase, -}: InputFromSourceOutput) => +const processInputs = ( + lifetime: number, + minimum: number, + keysgroup: ReadonlyArray, +) => ({ passphrase, secondPassphrase }: InputFromSourceOutput) => registerMultisignature({ passphrase, secondPassphrase, @@ -129,4 +136,4 @@ export default class MultisignatureCommand extends BaseCommand { const result = processFunction(inputs); this.print(result); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/create/second-passphrase.ts b/src/commands/transaction/create/second-passphrase.ts index b615bee2..bf0d0c91 100644 --- a/src/commands/transaction/create/second-passphrase.ts +++ b/src/commands/transaction/create/second-passphrase.ts @@ -18,9 +18,15 @@ import { flags as flagParser } from '@oclif/command'; import BaseCommand from '../../../base'; import { ValidationError } from '../../../utils/error'; import { flags as commonFlags } from '../../../utils/flags'; -import { getInputsFromSources, InputFromSourceOutput } from '../../../utils/input'; +import { + getInputsFromSources, + InputFromSourceOutput, +} from '../../../utils/input'; -export const processInputs = () => ({ passphrase, secondPassphrase }: InputFromSourceOutput) => { +export const processInputs = () => ({ + passphrase, + secondPassphrase, +}: InputFromSourceOutput) => { if (!secondPassphrase) { throw new ValidationError('No second passphrase was provided.'); } @@ -29,8 +35,7 @@ export const processInputs = () => ({ passphrase, secondPassphrase }: InputFromS passphrase, secondPassphrase, }); -} - +}; export default class SecondPassphraseCommand extends BaseCommand { static description = ` @@ -78,4 +83,4 @@ export default class SecondPassphraseCommand extends BaseCommand { const result = processFunction(inputs); this.print(result); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/create/transfer.ts b/src/commands/transaction/create/transfer.ts index f9f2c48b..81bd4c88 100644 --- a/src/commands/transaction/create/transfer.ts +++ b/src/commands/transaction/create/transfer.ts @@ -17,7 +17,10 @@ import { transfer, utils as transactionUtils } from '@liskhq/lisk-transactions'; import { flags as flagParser } from '@oclif/command'; import BaseCommand from '../../../base'; import { AlphabetLowercase, flags as commonFlags } from '../../../utils/flags'; -import { getInputsFromSources, InputFromSourceOutput } from '../../../utils/input'; +import { + getInputsFromSources, + InputFromSourceOutput, +} from '../../../utils/input'; interface Args { readonly address: string; @@ -62,9 +65,7 @@ export default class TransferCommand extends BaseCommand { Creates a transaction which will transfer the specified amount to an address if broadcast to the network. `; - static examples = [ - 'transaction:create:transfer 100 13356260975429434553L', - ]; + static examples = ['transaction:create:transfer 100 13356260975429434553L']; static flags = { ...BaseCommand.flags, @@ -121,4 +122,4 @@ export default class TransferCommand extends BaseCommand { const result = processFunction(inputs); this.print(result); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/create/vote.ts b/src/commands/transaction/create/vote.ts index 2ae49965..0397fdef 100644 --- a/src/commands/transaction/create/vote.ts +++ b/src/commands/transaction/create/vote.ts @@ -13,15 +13,24 @@ * Removal or modification of this copyright notice is prohibited. * */ -import { castVotes, utils as transactionUtils } from '@liskhq/lisk-transactions'; +import { + castVotes, + utils as transactionUtils, +} from '@liskhq/lisk-transactions'; import { flags as flagParser } from '@oclif/command'; import BaseCommand from '../../../base'; import { ValidationError } from '../../../utils/error'; import { flags as commonFlags } from '../../../utils/flags'; -import { getInputsFromSources, InputFromSourceOutput } from '../../../utils/input'; +import { + getInputsFromSources, + InputFromSourceOutput, +} from '../../../utils/input'; import { getData } from '../../../utils/input/utils'; -const processInputs = (votes: ReadonlyArray, unvotes: ReadonlyArray) => ({ passphrase, secondPassphrase }: InputFromSourceOutput) => +const processInputs = ( + votes: ReadonlyArray, + unvotes: ReadonlyArray, +) => ({ passphrase, secondPassphrase }: InputFromSourceOutput) => castVotes({ passphrase, votes, @@ -118,7 +127,7 @@ export default class VoteCommand extends BaseCommand { repeatPrompt: true, }, secondPassphrase: !secondPassphraseSource - ? undefined + ? undefined : { source: secondPassphraseSource, repeatPrompt: true, @@ -128,4 +137,4 @@ export default class VoteCommand extends BaseCommand { const result = processFunction(inputs); this.print(result); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/get.ts b/src/commands/transaction/get.ts index 7108499e..78a3d1ff 100644 --- a/src/commands/transaction/get.ts +++ b/src/commands/transaction/get.ts @@ -56,7 +56,8 @@ export default class GetCommand extends BaseCommand { { name: 'ids', required: false, - description: 'Comma-separated transaction ID(s) to get information about.', + description: + 'Comma-separated transaction ID(s) to get information about.', }, ]; @@ -236,7 +237,11 @@ export default class GetCommand extends BaseCommand { message: 'No transactions found.', }, }; - const senderAddressResult = await query(client, 'transactions', reqSenderId); + const senderAddressResult = await query( + client, + 'transactions', + reqSenderId, + ); this.print(senderAddressResult); return; @@ -256,4 +261,4 @@ export default class GetCommand extends BaseCommand { this.print(defaultResults); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/sign.ts b/src/commands/transaction/sign.ts index eca42602..317e1974 100644 --- a/src/commands/transaction/sign.ts +++ b/src/commands/transaction/sign.ts @@ -100,4 +100,4 @@ export default class SignCommand extends BaseCommand { this.print(result); } -} \ No newline at end of file +} diff --git a/src/commands/transaction/verify.ts b/src/commands/transaction/verify.ts index 3919333b..f9ad58b6 100644 --- a/src/commands/transaction/verify.ts +++ b/src/commands/transaction/verify.ts @@ -79,7 +79,7 @@ export default class VerifyCommand extends BaseCommand { args, flags: { 'second-public-key': secondPublicKeySource }, } = this.parse(VerifyCommand); - + const { transaction }: Args = args; const transactionInput = transaction || (await getTransactionInput()); const transactionObject = parseTransactionString(transactionInput); @@ -94,4 +94,4 @@ export default class VerifyCommand extends BaseCommand { ); this.print({ verified }); } -} \ No newline at end of file +} diff --git a/src/utils/query.ts b/src/utils/query.ts index 16e57e13..e0447586 100644 --- a/src/utils/query.ts +++ b/src/utils/query.ts @@ -87,14 +87,17 @@ export const query = async ( handleResponse(endpoint, res, parameters.placeholder), ); -export const queryNodeTransaction = - async (client: NodeResource, txnState: string, parameters: ReadonlyArray): Promise => - Promise.all( - parameters.map(async (param: QueryParameter) => - client - .getTransactions(txnState, param.query) - .then(res => - handleResponse('node/transactions', res, param.placeholder), - ), - ), - ); +export const queryNodeTransaction = async ( + client: NodeResource, + txnState: string, + parameters: ReadonlyArray, +): Promise => + Promise.all( + parameters.map(async (param: QueryParameter) => + client + .getTransactions(txnState, param.query) + .then(res => + handleResponse('node/transactions', res, param.placeholder), + ), + ), + ); diff --git a/test/commands/signature/create.test.ts b/test/commands/signature/create.test.ts index 5a27bf5d..59cb21c1 100644 --- a/test/commands/signature/create.test.ts +++ b/test/commands/signature/create.test.ts @@ -133,12 +133,14 @@ describe('signature:create', () => { .it( 'should take transaction from arg and passphrase from flag to create', () => { - expect(inputUtilsModule.getInputsFromSources).to.be.calledWithExactly({ - passphrase: { - source: 'pass:123', - repeatPrompt: true, + expect(inputUtilsModule.getInputsFromSources).to.be.calledWithExactly( + { + passphrase: { + source: 'pass:123', + repeatPrompt: true, + }, }, - }); + ); expect(transactions.createSignatureObject).to.be.calledWithExactly( defaultTransaction, defaultInputs.passphrase, @@ -183,12 +185,14 @@ describe('signature:create', () => { .it( 'should take transaction from stdin and create signature object', () => { - expect(inputUtilsModule.getInputsFromSources).to.be.calledWithExactly({ - passphrase: { - source: undefined, - repeatPrompt: true, + expect(inputUtilsModule.getInputsFromSources).to.be.calledWithExactly( + { + passphrase: { + source: undefined, + repeatPrompt: true, + }, }, - }); + ); expect(transactions.createSignatureObject).to.be.calledWithExactly( defaultTransaction, defaultInputs.passphrase, @@ -211,12 +215,14 @@ describe('signature:create', () => { .it( 'should take transaction from stdin and sign with passphrase from flag', () => { - expect(inputUtilsModule.getInputsFromSources).to.be.calledWithExactly({ - passphrase: { - source: 'pass:123', - repeatPrompt: true, + expect(inputUtilsModule.getInputsFromSources).to.be.calledWithExactly( + { + passphrase: { + source: 'pass:123', + repeatPrompt: true, + }, }, - }); + ); expect(transactions.createSignatureObject).to.be.calledWithExactly( defaultTransaction, defaultInputs.passphrase, diff --git a/test/commands/transaction/create/vote.test.ts b/test/commands/transaction/create/vote.test.ts index 0111f91e..2358ae24 100644 --- a/test/commands/transaction/create/vote.test.ts +++ b/test/commands/transaction/create/vote.test.ts @@ -63,7 +63,11 @@ describe('transaction:create:vote', () => { sandbox.stub().returns(defaultTransaction), ) .stub(transactions, 'utils', transactionUtilStub) - .stub(inputModule, 'getData', sandbox.stub().resolves(fileVotes.join(','))) + .stub( + inputModule, + 'getData', + sandbox.stub().resolves(fileVotes.join(',')), + ) .stub( inputUtils, 'getInputsFromSources', diff --git a/test/commands/transaction/get.test.ts b/test/commands/transaction/get.test.ts index 38437bfe..3c53909e 100644 --- a/test/commands/transaction/get.test.ts +++ b/test/commands/transaction/get.test.ts @@ -360,7 +360,11 @@ describe('transaction:get', () => { describe('transaction:get transactions --state=unprocessed', () => { setupTest() - .stub(apiUtils, 'getAPIClient', sandbox.stub().returns(apiClientStubNode)) + .stub( + apiUtils, + 'getAPIClient', + sandbox.stub().returns(apiClientStubNode), + ) .stub( queryHandler, 'queryNodeTransaction', @@ -523,7 +527,11 @@ describe('transaction:get', () => { }; setupTest() - .stub(apiUtils, 'getAPIClient', sandbox.stub().returns(localClientStub)) + .stub( + apiUtils, + 'getAPIClient', + sandbox.stub().returns(localClientStub), + ) .stub( queryHandler, 'queryNodeTransaction', diff --git a/test/utils/query.ts b/test/utils/query.ts index 44d3eacb..f11f1b97 100644 --- a/test/utils/query.ts +++ b/test/utils/query.ts @@ -57,11 +57,7 @@ describe('query utils', () => { get: sandbox.stub().resolves(response), }, } as any; - queryResult = query( - apiClient, - defaultEndpoint, - defaultParameters, - ); + queryResult = query(apiClient, defaultEndpoint, defaultParameters); return Promise.resolve(); }); @@ -91,11 +87,7 @@ describe('query utils', () => { }); it('should call API client and should reject with an error', () => { - queryResult = query( - apiClient, - defaultEndpoint, - defaultParameters, - ); + queryResult = query(apiClient, defaultEndpoint, defaultParameters); expect(apiClient.accounts.get).to.be.calledWithExactly( defaultParameters.query, ); @@ -114,11 +106,7 @@ describe('query utils', () => { ...defaultParameters, placeholder, }; - queryResult = query( - apiClient, - defaultEndpoint, - paramWithPlaceholder, - ); + queryResult = query(apiClient, defaultEndpoint, paramWithPlaceholder); expect(apiClient.accounts.get).to.be.calledWithExactly( defaultParameters.query, ); @@ -142,11 +130,7 @@ describe('query utils', () => { get: sandbox.stub().resolves(response), }, } as any; - queryResult = query( - apiClient, - defaultEndpoint, - defaultParameters, - ); + queryResult = query(apiClient, defaultEndpoint, defaultParameters); return Promise.resolve(); }); @@ -203,11 +187,7 @@ describe('query utils', () => { get: sandbox.stub().resolves(response), }, } as any; - queryResult = query( - apiClient, - defaultEndpoint, - defaultParameters, - ); + queryResult = query(apiClient, defaultEndpoint, defaultParameters); return Promise.resolve(); }); @@ -233,11 +213,7 @@ describe('query utils', () => { get: sandbox.stub().resolves(response), }, } as any; - query( - apiClient, - defaultEndpoint, - defaultArrayParameters, - ); + query(apiClient, defaultEndpoint, defaultArrayParameters); return Promise.resolve(); }); From e787e51f14572c18538bca6fd0bdac1b187e2378 Mon Sep 17 00:00:00 2001 From: shuse2 Date: Tue, 11 Dec 2018 03:54:09 +0800 Subject: [PATCH 4/6] :recycle: Apply format on base ts --- src/base.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/base.ts b/src/base.ts index 5ec5faf7..d6ae15b9 100644 --- a/src/base.ts +++ b/src/base.ts @@ -63,8 +63,10 @@ export default abstract class BaseCommand extends Command { async init(): Promise { // Typing problem where constructor is not allow as Input but it requires to be the type - const { flags } = this.parse(// tslint:disable-next-line no-any - (this.constructor as unknown) as flagParser.Input); + const { flags } = this.parse( + // tslint:disable-next-line no-any + (this.constructor as unknown) as flagParser.Input, + ); this.printFlags = flags; process.stdout.on('error', handleEPIPE); From 2b29267dd43aab124918af89c2f3fcd61832f899 Mon Sep 17 00:00:00 2001 From: shuse2 Date: Fri, 14 Dec 2018 20:29:14 +0800 Subject: [PATCH 5/6] :recycle: Add return types --- src/commands/node/forging.ts | 4 ++-- src/commands/transaction/create.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/node/forging.ts b/src/commands/node/forging.ts index b75c65e8..d8cacd3c 100644 --- a/src/commands/node/forging.ts +++ b/src/commands/node/forging.ts @@ -30,12 +30,12 @@ interface Args { const STATUS_ENABLE = 'enable'; const STATUS_DISABLE = 'disable'; -const processInput = ( +const processInput = async ( client: APIClient, status: string, publicKey: string, password?: string, -) => { +): Promise => { if (!password) { throw new ValidationError('No password was provided.'); } diff --git a/src/commands/transaction/create.ts b/src/commands/transaction/create.ts index aca0cfce..d0c7ce78 100644 --- a/src/commands/transaction/create.ts +++ b/src/commands/transaction/create.ts @@ -60,7 +60,7 @@ const typeClassMap: TypeClassMap = { const resolveFlags = ( accumulated: ReadonlyArray, [key, value]: [string, string | boolean | undefined], -) => { +): ReadonlyArray => { if (key === 'type') { return accumulated; } From 2b398f86c5398c3842f4db82e73bbb9c8d291906 Mon Sep 17 00:00:00 2001 From: shuse2 Date: Fri, 14 Dec 2018 20:58:21 +0800 Subject: [PATCH 6/6] :arrow_up: Revert version of coverall --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e702f57..9c57e975 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "@types/strip-ansi": "3.0.0", "chai": "4.1.2", "chai-as-promised": "7.1.1", - "coveralls": "3.0.0", + "coveralls": "3.0.2", "husky": "0.14.3", "lint-staged": "5.0.0", "mocha": "4.0.1",