Unverified Commit a84c8c63 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento

Merge remote-tracking branch 'origin/master' into apps-engine-merge

# Conflicts:
#	package-lock.json
parents c3bd5de8 50755975
{
"name": "@rocket.chat/apps-cli",
"version": "1.0.3",
"version": "1.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -358,6 +358,16 @@
"integrity": "sha1-nrs5HO2lSJJvWBmtFkBTSWQbmZ8=",
"dev": true
},
"@types/inquirer": {
"version": "0.0.42",
"resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-0.0.42.tgz",
"integrity": "sha512-flMaNWU2g9NrtZ4bIV+7SEY2W7OdWNNhmJ0rE1lWVxGrkp3TfFGMcFCxRIBmGWigI8e6n+2HqLjizTTfgcpHLg==",
"dev": true,
"requires": {
"@types/rx": "*",
"@types/through": "*"
}
},
"@types/lodash": {
"version": "4.14.109",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.109.tgz",
......@@ -400,6 +410,132 @@
"@types/node": "*"
}
},
"@types/rx": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/@types/rx/-/rx-4.1.1.tgz",
"integrity": "sha1-WY/JSla67ZdfGUV04PVy/Y5iekg=",
"dev": true,
"requires": {
"@types/rx-core": "*",
"@types/rx-core-binding": "*",
"@types/rx-lite": "*",
"@types/rx-lite-aggregates": "*",
"@types/rx-lite-async": "*",
"@types/rx-lite-backpressure": "*",
"@types/rx-lite-coincidence": "*",
"@types/rx-lite-experimental": "*",
"@types/rx-lite-joinpatterns": "*",
"@types/rx-lite-testing": "*",
"@types/rx-lite-time": "*",
"@types/rx-lite-virtualtime": "*"
}
},
"@types/rx-core": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-core/-/rx-core-4.0.3.tgz",
"integrity": "sha1-CzNUsSOM7b4rdPYybxOdvHpZHWA=",
"dev": true
},
"@types/rx-core-binding": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/@types/rx-core-binding/-/rx-core-binding-4.0.4.tgz",
"integrity": "sha512-5pkfxnC4w810LqBPUwP5bg7SFR/USwhMSaAeZQQbEHeBp57pjKXRlXmqpMrLJB4y1oglR/c2502853uN0I+DAQ==",
"dev": true,
"requires": {
"@types/rx-core": "*"
}
},
"@types/rx-lite": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/rx-lite/-/rx-lite-4.0.5.tgz",
"integrity": "sha512-KZk5XTR1dm/kNgBx8iVpjno6fRYtAUQWBOmj+O8j724+nk097sz4fOoHJNpCkOJUtHUurZlJC7QvSFCZHbkC+w==",
"dev": true,
"requires": {
"@types/rx-core": "*",
"@types/rx-core-binding": "*"
}
},
"@types/rx-lite-aggregates": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-aggregates/-/rx-lite-aggregates-4.0.3.tgz",
"integrity": "sha512-MAGDAHy8cRatm94FDduhJF+iNS5//jrZ/PIfm+QYw9OCeDgbymFHChM8YVIvN2zArwsRftKgE33QfRWvQk4DPg==",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/rx-lite-async": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/@types/rx-lite-async/-/rx-lite-async-4.0.2.tgz",
"integrity": "sha512-vTEv5o8l6702ZwfAM5aOeVDfUwBSDOs+ARoGmWAKQ6LOInQ8J4/zjM7ov12fuTpktUKdMQjkeCp07Vd73mPkxw==",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/rx-lite-backpressure": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-backpressure/-/rx-lite-backpressure-4.0.3.tgz",
"integrity": "sha512-Y6aIeQCtNban5XSAF4B8dffhIKu6aAy/TXFlScHzSxh6ivfQBQw6UjxyEJxIOt3IT49YkS+siuayM2H/Q0cmgA==",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/rx-lite-coincidence": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-coincidence/-/rx-lite-coincidence-4.0.3.tgz",
"integrity": "sha512-1VNJqzE9gALUyMGypDXZZXzR0Tt7LC9DdAZQ3Ou/Q0MubNU35agVUNXKGHKpNTba+fr8GdIdkC26bRDqtCQBeQ==",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/rx-lite-experimental": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-experimental/-/rx-lite-experimental-4.0.1.tgz",
"integrity": "sha1-xTL1y98/LBXaFt7Ykw0bKYQCPL0=",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/rx-lite-joinpatterns": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-joinpatterns/-/rx-lite-joinpatterns-4.0.1.tgz",
"integrity": "sha1-9w/jcFGKhDLykVjMkv+1a05K/D4=",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/rx-lite-testing": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@types/rx-lite-testing/-/rx-lite-testing-4.0.1.tgz",
"integrity": "sha1-IbGdEfTf1v/vWp0WSOnIh5v+Iek=",
"dev": true,
"requires": {
"@types/rx-lite-virtualtime": "*"
}
},
"@types/rx-lite-time": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-time/-/rx-lite-time-4.0.3.tgz",
"integrity": "sha512-ukO5sPKDRwCGWRZRqPlaAU0SKVxmWwSjiOrLhoQDoWxZWg6vyB9XLEZViKOzIO6LnTIQBlk4UylYV0rnhJLxQw==",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/rx-lite-virtualtime": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/rx-lite-virtualtime/-/rx-lite-virtualtime-4.0.3.tgz",
"integrity": "sha512-3uC6sGmjpOKatZSVHI2xB1+dedgml669ZRvqxy+WqmGJDVusOdyxcKfyzjW0P3/GrCiN4nmRkLVMhPwHCc5QLg==",
"dev": true,
"requires": {
"@types/rx-lite": "*"
}
},
"@types/semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-5.5.0.tgz",
......@@ -412,6 +548,15 @@
"integrity": "sha512-yxzBCIjE3lp9lYjfBbIK/LRCoXgCLLbIIBIje7eNCcUIIR2CZZtyX5uto2hVoMSMqLrsRrT6mwwUEd0yFgOwpA==",
"dev": true
},
"@types/through": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.29.tgz",
"integrity": "sha512-9a7C5VHh+1BKblaYiq+7Tfc+EOmjMdZaD1MYtkQjSoxgB69tBjW98ry6SKsi4zEIWztLOMRuL87A3bdT/Fc/4w==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/tv4": {
"version": "1.2.29",
"resolved": "https://registry.npmjs.org/@types/tv4/-/tv4-1.2.29.tgz",
......@@ -824,6 +969,11 @@
"supports-color": "^5.3.0"
}
},
"chardet": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.5.0.tgz",
"integrity": "sha512-9ZTaoBaePSCFvNlNGrsyI8ZVACP2svUtq0DkM7t4K2ClAa96sqOIRjAzDTc8zXzFt1cZR46rRzLTiHFSJ+Qw0g=="
},
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
......@@ -864,6 +1014,14 @@
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-1.3.0.tgz",
"integrity": "sha1-noIVAa6XmYbEax1m0tQy2y/UrjE="
},
"cli-cursor": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz",
"integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=",
"requires": {
"restore-cursor": "^2.0.0"
}
},
"cli-ux": {
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/cli-ux/-/cli-ux-4.6.2.tgz",
......@@ -888,6 +1046,11 @@
"supports-hyperlinks": "^1.0.1"
}
},
"cli-width": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz",
"integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk="
},
"collection-visit": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz",
......@@ -1239,6 +1402,16 @@
}
}
},
"external-editor": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.1.tgz",
"integrity": "sha512-e1neqvSt5pSwQcFnYc6yfGuJD2Q4336cdbHs5VeUO0zTkqPbrHMyw2q1r47fpfLWbvIG8H8A6YO3sck7upTV6Q==",
"requires": {
"chardet": "^0.5.0",
"iconv-lite": "^0.4.22",
"tmp": "^0.0.33"
}
},
"extglob": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz",
......@@ -1434,6 +1607,11 @@
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"fuzzy": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/fuzzy/-/fuzzy-0.1.3.tgz",
"integrity": "sha1-THbsL/CsGjap3M+aAN+GIweNTtg="
},
"get-caller-file": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz",
......@@ -1641,6 +1819,14 @@
"resolved": "https://registry.npmjs.org/hyperlinker/-/hyperlinker-1.0.0.tgz",
"integrity": "sha512-Ty8UblRWFEcfSuIaajM34LdPXIhbs1ajEX/BBPv24J+enSVaEVY63xQ6lTO9VRYS5LAoghIG0IDJ+p+IPzKUQQ=="
},
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"ignore": {
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.8.tgz",
......@@ -1672,6 +1858,82 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"inquirer": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz",
"integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==",
"requires": {
"ansi-escapes": "^3.0.0",
"chalk": "^2.0.0",
"cli-cursor": "^2.1.0",
"cli-width": "^2.0.0",
"external-editor": "^3.0.0",
"figures": "^2.0.0",
"lodash": "^4.17.10",
"mute-stream": "0.0.7",
"run-async": "^2.2.0",
"rxjs": "^6.1.0",
"string-width": "^2.1.0",
"strip-ansi": "^4.0.0",
"through": "^2.3.6"
}
},
"inquirer-checkbox-plus-prompt": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/inquirer-checkbox-plus-prompt/-/inquirer-checkbox-plus-prompt-1.0.1.tgz",
"integrity": "sha1-VP8e0Jd3oQNThWIna1z0Uhox0W0=",
"requires": {
"cli-cursor": "^2.1.0",
"figures": "^2.0.0",
"inquirer": "^5.1.0",
"lodash": "^4.17.5"
},
"dependencies": {
"chardet": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz",
"integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I="
},
"external-editor": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz",
"integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==",
"requires": {
"chardet": "^0.4.0",
"iconv-lite": "^0.4.17",
"tmp": "^0.0.33"
}
},
"inquirer": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz",
"integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==",
"requires": {
"ansi-escapes": "^3.0.0",
"chalk": "^2.0.0",
"cli-cursor": "^2.1.0",
"cli-width": "^2.0.0",
"external-editor": "^2.1.0",
"figures": "^2.0.0",
"lodash": "^4.3.0",
"mute-stream": "0.0.7",
"run-async": "^2.2.0",
"rxjs": "^5.5.2",
"string-width": "^2.1.0",
"strip-ansi": "^4.0.0",
"through": "^2.3.6"
}
},
"rxjs": {
"version": "5.5.11",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.11.tgz",
"integrity": "sha512-3bjO7UwWfA2CV7lmwYMBzj4fQ6Cq+ftHc2MvUe+WMS7wcdJ1LosDWmdjPQanYp2dBRj572p7PeU81JUxHKOcBA==",
"requires": {
"symbol-observable": "1.0.1"
}
}
}
},
"invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
......@@ -1845,6 +2107,11 @@
"isobject": "^3.0.1"
}
},
"is-promise": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz",
"integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o="
},
"is-retry-allowed": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz",
......@@ -2102,6 +2369,11 @@
"mime-db": "~1.33.0"
}
},
"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=="
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
......@@ -2170,6 +2442,11 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"mute-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
},
"nanomatch": {
"version": "1.2.9",
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz",
......@@ -4595,6 +4872,14 @@
"wrappy": "1"
}
},
"onetime": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",
"integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=",
"requires": {
"mimic-fn": "^1.0.0"
}
},
"opener": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz",
......@@ -4620,8 +4905,7 @@
"os-tmpdir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=",
"dev": true
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
},
"p-finally": {
"version": "1.0.0",
......@@ -4941,12 +5225,37 @@
"integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=",
"dev": true
},
"restore-cursor": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz",
"integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=",
"requires": {
"onetime": "^2.0.0",
"signal-exit": "^3.0.2"
}
},
"ret": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz",
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
"dev": true
},
"run-async": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz",
"integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=",
"requires": {
"is-promise": "^2.1.0"
}
},
"rxjs": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz",
"integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==",
"requires": {
"tslib": "^1.9.0"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
......@@ -4962,6 +5271,11 @@
"ret": "~0.1.10"
}
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
......@@ -5006,8 +5320,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="
},
"slash": {
"version": "1.0.0",
......@@ -5346,6 +5659,11 @@
}
}
},
"symbol-observable": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz",
"integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ="
},
"tar-fs": {
"version": "1.16.2",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.16.2.tgz",
......@@ -5373,11 +5691,15 @@
"xtend": "^4.0.0"
}
},
"through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true,
"requires": {
"os-tmpdir": "~1.0.2"
}
......
{
"name": "@rocket.chat/apps-cli",
"description": "The CLI tool for helping with Rocket.Chat Apps.",
"version": "1.0.3",
"version": "1.2.1",
"author": "Rocket.Chat <support@rocket.chat>",
"preferGlobal": true,
"bin": {
......@@ -21,8 +21,11 @@
"figures": "^2.0.0",
"form-data": "^2.3.2",
"fs-extra": "^6.0.1",
"fuzzy": "^0.1.3",
"glob": "^7.1.2",
"indent-string": "^3.2.0",
"inquirer": "^6.1.0",
"inquirer-checkbox-plus-prompt": "^1.0.1",
"node-fetch": "^2.1.2",
"pascal-case": "^2.0.1",
"pascalcase": "^0.1.1",
......@@ -43,6 +46,7 @@
"@types/fs-extra": "^5.0.3",
"@types/glob": "^5.0.35",
"@types/indent-string": "^3.0.0",
"@types/inquirer": "0.0.42",
"@types/mocha": "^5.2.1",
"@types/node": "^10.3.2",
"@types/node-fetch": "^2.1.1",
......
import { Command, flags } from '@oclif/command';
import chalk from 'chalk';
import cli from 'cli-ux';
import * as FormData from 'form-data';
import * as fs from 'fs';
import * as fuzzy from 'fuzzy';
import * as inquirer from 'inquirer';
import fetch from 'node-fetch';
import { Response } from 'node-fetch';
import { AppCompiler, AppPackager, FolderDetails, VariousUtils } from '../misc';
export default class Submit extends Command {
public static description = 'submits an App to the Marketplace for review';
public static flags = {
help: flags.help({ char: 'h' }),
// In the future, we will allow people to have their own marketplace instances
// url: flags.string({ description: 'which marketplace should be used' }),
update: flags.boolean({ description: 'submits an update instead of creating one' }),
email: flags.string({ char: 'e', description: 'the email of the publisher account' }),
categories: flags.string({
char: 'c',
dependsOn: ['email'],
description: 'a comma separated list of the categories for the App',
}),
};
public async run() {
inquirer.registerPrompt('checkbox-plus', require('inquirer-checkbox-plus-prompt'));
const { flags } = this.parse(Submit);
//#region app packaging
cli.action.start(`${ chalk.green('packaging') } your app`);
const fd = new FolderDetails(this);
try {
await fd.readInfoFile();
} catch (e) {
this.error(e.message);
return;
}
const compiler = new AppCompiler(this, fd);
const report = compiler.logDiagnostics();
if (!report.isValid) {
this.error('TypeScript compiler error(s) occured');
this.exit(1);
return;
}
const packager = new AppPackager(this, fd);
const zipName = await packager.zipItUp();
cli.action.stop('packaged!');
//#endregion
//#region fetching categories
cli.action.start(`${ chalk.green('fetching') } the available categories`);
const categories = await VariousUtils.fetchCategories();
cli.action.stop('fetched!');
//#endregion
//#region asking for information
if (!flags.email) {
const result = await inquirer.prompt([{
type: 'input',
name: 'email',
message: 'What is the publisher\'s email address?',
validate: (answer: string) => {
const regex = /^[^@\s]+@[^@\s]+\.[^@\s]+$/g;
return regex.test(answer);
},
}]);
flags.email = (result as any).email;
}
if (typeof flags.update === 'undefined') {
const isNewApp = await inquirer.prompt([{
type: 'confirm',
name: 'isNew',
message: 'Is this a new App?',
default: true,
}]);
flags.update = !(isNewApp as any).isNew;
}
let selectedCategories = new Array<string>();
if (flags.categories) {
selectedCategories = flags.categories.split(',');
} else {
const result = await inquirer.prompt([{
type: 'checkbox-plus',
name: 'categories',
message: 'Please select the categories which apply to this App?',
pageSize: 10,
highlight: true,
searchable: true,
validate: (answer: Array<string>) => {
if (answer.length === 0) {
return 'You must choose at least one color.';