From 250c6fa4ebebc17ea84a91bd3dba070cd8f71f69 Mon Sep 17 00:00:00 2001 From: perissology Date: Tue, 23 Oct 2018 12:15:44 -0700 Subject: [PATCH 1/3] update to yargs 12 --- package-lock.json | 152 ++++++++++++++++++++++++++++++++------------ package.json | 2 +- src/cli.js | 11 ++-- src/commands/apm.js | 20 +----- src/commands/dao.js | 19 +----- 5 files changed, 120 insertions(+), 84 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1bcc5e7a7..7457d033d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16324,7 +16324,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "requires": { "graceful-fs": "^4.1.6" @@ -17123,6 +17123,14 @@ } } }, + "map-age-cleaner": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.2.tgz", + "integrity": "sha512-UN1dNocxQq44IhJyMI4TU8phc2m9BddacHRPRjKGLYaF0jqd3xLz0jS0skpAU9WgYyoR4gHtUpzytNBS385FWQ==", + "requires": { + "p-defer": "^1.0.0" + } + }, "map-cache": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", @@ -17295,6 +17303,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, "requires": { "mimic-fn": "^1.0.0" } @@ -18166,11 +18175,21 @@ "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=" + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=" + }, "p-limit": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", @@ -18723,7 +18742,7 @@ }, "progress": { "version": "1.1.8", - "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "resolved": "http://registry.npmjs.org/progress/-/progress-1.1.8.tgz", "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", "dev": true }, @@ -20397,7 +20416,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -23125,6 +23144,11 @@ "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" }, + "xregexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", + "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==" + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", @@ -23146,22 +23170,22 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" }, "yargs": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-10.1.2.tgz", - "integrity": "sha512-ivSoxqBGYOqQVruxD35+EyCFDYNEFL/Uo6FcOnz+9xZdZzK0Zzw4r4KhbrME1Oo2gOggwJod2MnsdamSG7H9ig==", + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", + "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", "requires": { "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", + "decamelize": "^2.0.0", + "find-up": "^3.0.0", "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", + "os-locale": "^3.0.0", "require-directory": "^2.1.1", "require-main-filename": "^1.0.1", "set-blocking": "^2.0.0", "string-width": "^2.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^8.1.0" + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^10.1.0" }, "dependencies": { "ansi-regex": { @@ -23184,45 +23208,95 @@ "wrap-ansi": "^2.0.0" } }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "decamelize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "xregexp": "4.0.0" } }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" + "locate-path": "^3.0.0" } }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==" + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "mem": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz", + "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^1.0.0", + "p-is-promise": "^1.1.0" + } + }, "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", + "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" + "execa": "^0.10.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" } }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==" + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -23246,9 +23320,9 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, "yargs-parser": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-8.1.0.tgz", - "integrity": "sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "requires": { "camelcase": "^4.1.0" } @@ -23257,7 +23331,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "requires": { "camelcase": "^3.0.0", diff --git a/package.json b/package.json index 10708fb16..e1555f7e3 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "truffle": "4.1.14", "truffle-flattener": "^1.2.9", "web3": "^1.0.0-beta.34", - "yargs": "^10.1.0" + "yargs": "^12.0.2" }, "devDependencies": { "@aragon/apps-finance": "2.0.0-beta.2", diff --git a/src/cli.js b/src/cli.js index 79e0977f5..523f3b713 100755 --- a/src/cli.js +++ b/src/cli.js @@ -13,13 +13,10 @@ const MIDDLEWARES = [ // Set up commands const cmd = require('yargs') - .commandDir('./commands', { - visit: (cmd) => { - // Add middlewares - cmd.middlewares = MIDDLEWARES - return cmd - } - }) // .strict() + .commandDir('./commands') + // .strict() + +cmd.middleware(MIDDLEWARES) cmd.alias('h', 'help') cmd.alias('v', 'version') diff --git a/src/commands/apm.js b/src/commands/apm.js index 37c6890cd..0071d45cb 100644 --- a/src/commands/apm.js +++ b/src/commands/apm.js @@ -1,15 +1,3 @@ -const { - manifestMiddleware, - moduleMiddleware, - environmentMiddleware -} = require('../middleware') - -const MIDDLEWARES = [ - manifestMiddleware, - moduleMiddleware, - environmentMiddleware -] - exports.command = 'apm ' exports.describe = 'Publish and manage your APM package' @@ -17,13 +5,7 @@ exports.describe = 'Publish and manage your APM package' exports.aliases = ['package'] exports.builder = function (yargs) { - const cmd = yargs.commandDir('apm_cmds', { - visit: (cmd) => { - // Add middlewares - cmd.middlewares = MIDDLEWARES - return cmd - } - }) + const cmd = yargs.commandDir('apm_cmds') cmd.demandCommand(1, 'You need to specify a command') return cmd diff --git a/src/commands/dao.js b/src/commands/dao.js index b97bb738c..216a6109a 100644 --- a/src/commands/dao.js +++ b/src/commands/dao.js @@ -1,15 +1,4 @@ const daoArg = require('./dao_cmds/utils/daoArg') -const { - manifestMiddleware, - moduleMiddleware, - environmentMiddleware -} = require('../middleware') - -const MIDDLEWARES = [ - manifestMiddleware, - moduleMiddleware, - environmentMiddleware -] exports.command = 'dao ' @@ -20,13 +9,7 @@ exports.builder = function (yargs) { yargs = daoArg(yargs) } - const cmd = yargs.commandDir('dao_cmds', { - visit: (cmd) => { - // Add middlewares - cmd.middlewares = MIDDLEWARES - return cmd - } - }) + const cmd = yargs.commandDir('dao_cmds') cmd.demandCommand(1, 'You need to specify a command') return cmd From ce1b6b1bd6950edac39eb3f13505174f293ff240 Mon Sep 17 00:00:00 2001 From: galactusss Date: Thu, 17 Jan 2019 10:40:47 -0300 Subject: [PATCH 2/3] minor release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ab9e59c14..5028ca1b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aragon/cli", - "version": "5.2.2", + "version": "5.3.0", "description": "Aragon command-line tools", "main": "dist/cli.js", "bin": { From b7563fffd97530d7e060c986a841b1987e196835 Mon Sep 17 00:00:00 2001 From: galactusss Date: Thu, 17 Jan 2019 19:14:01 -0300 Subject: [PATCH 3/3] remove middlewares from token and dao commands --- src/commands/dao_cmds/acl.js | 19 +------------------ src/commands/dao_cmds/token.js | 23 +++-------------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/src/commands/dao_cmds/acl.js b/src/commands/dao_cmds/acl.js index 8bff43df4..c2e18cd0d 100644 --- a/src/commands/dao_cmds/acl.js +++ b/src/commands/dao_cmds/acl.js @@ -1,28 +1,11 @@ const viewCommand = require('./acl_cmds/view') -const { - manifestMiddleware, - moduleMiddleware, - environmentMiddleware, -} = require('../../middleware') - -const MIDDLEWARES = [ - manifestMiddleware, - moduleMiddleware, - environmentMiddleware, -] - exports.command = 'acl ' exports.describe = 'Shortcut for aragon dao acl view ' exports.builder = function(yargs) { - return yargs.commandDir('acl_cmds', { - visit: cmd => { - cmd.middlewares = MIDDLEWARES - return cmd - }, - }) + return yargs.commandDir('acl_cmds') } exports.handler = viewCommand.handler diff --git a/src/commands/dao_cmds/token.js b/src/commands/dao_cmds/token.js index 28830e58d..a0acc67da 100644 --- a/src/commands/dao_cmds/token.js +++ b/src/commands/dao_cmds/token.js @@ -1,26 +1,9 @@ -const { - manifestMiddleware, - moduleMiddleware, - environmentMiddleware, -} = require('../../middleware') - -const MIDDLEWARES = [ - manifestMiddleware, - moduleMiddleware, - environmentMiddleware, -] - exports.command = 'token ' exports.describe = 'Create and interact with MiniMe tokens' exports.builder = function(yargs) { - return yargs - .commandDir('token_cmds', { - visit: cmd => { - cmd.middlewares = MIDDLEWARES - return cmd - }, - }) - .demandCommand(1, 'You need to specify a command') + const cmd = yargs.commandDir('token_cmds') + cmd.demandCommand(1, 'You need to specify a command') + return cmd }