@azrico/azcli 1.0.50 → 1.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/function getPackagePaths(){var a=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0],b=getDistPath(),c="./packages",d=_fs["default"].readdirSync(c).filter(function(b){return!!(a||"core"!==b)&&!b.startsWith("_")&&!b.startsWith(".")}).map(function(a){var d=_path["default"].join(c,a),e=_path["default"].join(b,c,a);return{path:d,distpath:e,fullpath:_path["default"].resolve(d),fulldistpath:_path["default"].resolve(e)}});return d}function getPackagesData(){var a=getBasePackageName();return getPackagePaths().map(function(b){var c,d=b.path.split(_path["default"].sep).pop(),e=_path["default"].join(b.path,"package.json"),f=JSON.parse((0,_commons.readIfExists)(e)),g=f.name?null===(c=(f.name+"").split("/").pop())||void 0===c?void 0:c.split(".").pop():d;//
|
|
9
9
|
//
|
|
10
10
|
//
|
|
11
|
-
return _objectSpread(_objectSpread({},b),{},{fullname:a+"."+g,name:g,jsonData:f})})}function
|
|
12
|
-
for(var h in
|
|
11
|
+
return _objectSpread(_objectSpread({},b),{},{fullname:a+"."+g,name:g,jsonData:f})})}function parseDeps(a){var b={};return a||(a={}),Array.isArray(a)?a.forEach(function(a){b[a]="latest"}):b=a,b}function upgradedeps(a,b){for(var c=["peerDependencies","dependencies"],d=0,e=c;d<e.length;d++){var f=e[d],g=parseDeps(a[f]);//make sure the key exists
|
|
12
|
+
for(var h in g)g[h].startsWith("workspace")&&(a[f][h]=b)}}function copydeps(a,b){for(var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:"",d=["peerDependencies","dependencies"],e=0,f=d;e<f.length;e++){var g=f[e],h=parseDeps(a[g]);for(var i in h){b[g]||(b[g]={});var j=(c||h[i]||"latest")+"";b[g][i]=j}}}function getBasePackageName(a){return a||(a=JSON.parse((0,_commons.readIfExists)("package.json"))),(0,_commons.custom_trim)((a.name+"").replaceAll("workspace",""),"."," ","/")}/**
|
|
13
13
|
* prepare the core package
|
|
14
14
|
*/function prepare(){return _prepare.apply(this,arguments)}/**
|
|
15
|
-
* set version of all packages in the dist path
|
|
16
|
-
*/function _prepare(){return _prepare=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e;return _regeneratorRuntime().wrap(function f(a){for(;1;)switch(a.prev=a.next){case 0:b=JSON.parse((0,_commons.readIfExists)("package.json")),c="./packages/core",_fs["default"].existsSync(c)&&_fs["default"].rmSync(c,{recursive:!0,force:!0}),d=_objectSpread({},b),d.name=getBasePackageName(b),d["private"]=!1,d.main="./index",d.homepage=".",delete d.scripts,delete d.soucre,delete d.workspaces,delete d.files,delete d.devDependencies,delete d.dependencies,delete d.peerDependencies,e=getPackagesData(),copydeps({dependencies:e.map(function(a){return a.fullname}),peerDependencies:e.map(function(a){return a.fullname})},d,"workspace:^"),_fs["default"].mkdirSync(c),_fs["default"].writeFileSync(_path["default"].join(c,"package.json"),JSON.stringify(d,void 0,2)),_fs["default"].writeFileSync(_path["default"].join(c,"index.ts"),e.map(function(a){return"export * from \"".concat(a.fullname,"\";")}).join("\n")),(0,_commons.show_msg)("created the core package");case 21:case"end":return a.stop()}},a)})),_prepare.apply(this,arguments)}function finalize(){return _finalize.apply(this,arguments)}function _finalize(){return _finalize=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e,f,g,h,i,j,k,l,m,n;return _regeneratorRuntime().wrap(function
|
|
15
|
+
* set version of all packages in the dist path to the correct version
|
|
16
|
+
*/function _prepare(){return _prepare=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e;return _regeneratorRuntime().wrap(function f(a){for(;1;)switch(a.prev=a.next){case 0:b=JSON.parse((0,_commons.readIfExists)("package.json")),c="./packages/core",_fs["default"].existsSync(c)&&_fs["default"].rmSync(c,{recursive:!0,force:!0}),d=_objectSpread({},b),d.name=getBasePackageName(b),d["private"]=!1,d.main="./index",d.homepage=".",delete d.scripts,delete d.soucre,delete d.workspaces,delete d.files,delete d.devDependencies,delete d.dependencies,delete d.peerDependencies,e=getPackagesData(),copydeps({dependencies:e.map(function(a){return a.fullname}),peerDependencies:e.map(function(a){return a.fullname})},d,"workspace:^"),_fs["default"].mkdirSync(c),_fs["default"].writeFileSync(_path["default"].join(c,"package.json"),JSON.stringify(d,void 0,2)),_fs["default"].writeFileSync(_path["default"].join(c,"index.ts"),e.map(function(a){return"export * from \"".concat(a.fullname,"\";")}).join("\n")),(0,_commons.show_msg)("created the core package");case 21:case"end":return a.stop()}},a)})),_prepare.apply(this,arguments)}function finalize(){return _finalize.apply(this,arguments)}function _finalize(){return _finalize=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;return _regeneratorRuntime().wrap(function p(a){for(;1;)switch(a.prev=a.next){case 0:return b=JSON.parse((0,_commons.readIfExists)("package.json")),c=getBasePackageName(b),d=getDistPath(),e=getPackagesData(),a.next=6,(0,_commons.do_exec)(["copyfiles ./packages/**/package.json ./dist"]);case 6:f=_path["default"].join(d,"packages/core","package.json"),g=JSON.parse((0,_commons.readIfExists)(f)),h=b.version,copydeps({dependencies:e.map(function(a){return a.fullname}),peerDependencies:e.map(function(a){return a.fullname})},g,h),_fs["default"].writeFileSync(f,JSON.stringify(g,void 0,2)),i=0,(0,_commons.show_msg)("working on ".concat(e.length," packages for ").concat(c),"text"),j=_createForOfIteratorHelper(e),a.prev=14,j.s();case 16:if((k=j.n()).done){a.next=34;break}return l=k.value,m=l.jsonData,n=_path["default"].join(l.distpath,"package.json"),m.name=c+"."+l.name,m.version=h,m.description="module of "+m.name,m["private"]=!1,delete m.scripts,copydeps(b,m,""),upgradedeps(m,h),_fs["default"].writeFileSync(n,JSON.stringify(m,void 0,2)),a.next=30,(0,_commons.do_exec)(["cd ".concat(l.fulldistpath,"/ & npm pkg fix")]);case 30:o=a.sent,0===o.code?((0,_commons.show_msg)([" -> fix:",l.name,m.version],"text"),i++):(0,_commons.show_error)([" -> fix failed:",l.name,"error:",o.stderr]);case 32:a.next=16;break;case 34:a.next=39;break;case 36:a.prev=36,a.t0=a["catch"](14),j.e(a.t0);case 39:return a.prev=39,j.f(),a.finish(39);case 42:(0,_commons.show_msg)("finalized ".concat(i," packages. you can publish them now :)"));case 43:case"end":return a.stop()}},a,null,[[14,36,39,42]])})),_finalize.apply(this,arguments)}function publish(){return _publish.apply(this,arguments)}function _publish(){return _publish=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c;return _regeneratorRuntime().wrap(function d(a){for(;1;)switch(a.prev=a.next){case 0:return(0,_commons.show_msg)("publishing ..."),b=0,c=getPackagePaths(!0),a.next=5,Promise.all(c.map(/*#__PURE__*/function(){var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a){var d;return _regeneratorRuntime().wrap(function e(c){for(;1;)switch(c.prev=c.next){case 0:return c.next=2,(0,_commons.do_exec)(["cd ".concat(a.fulldistpath,"/ & npm publish --access public --tag latest")]);case 2:d=c.sent,0===d.code?((0,_commons.show_msg)(["published:",a.distpath]),b++):(0,_commons.show_error)(["publish failed with code:",d.code,"error:",d.stderr]);case 4:case"end":return c.stop()}},c)}));return function(b){return a.apply(this,arguments)}}()));case 5:(0,_commons.show_msg)("published ".concat(b," packages"));case 6:case"end":return a.stop()}},a)})),_publish.apply(this,arguments)}function build(){return _build.apply(this,arguments)}function _build(){return _build=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b;return _regeneratorRuntime().wrap(function c(a){for(;1;)switch(a.prev=a.next){case 0:return(0,_commons.show_msg)("building ..."),a.next=3,(0,_commons.do_exec)("yarn run build");case 3:if(b=a.sent,0!==b.code){a.next=9;break}return(0,_commons.show_msg)("build command was run sucessfully"),a.abrupt("return",!0);case 9:return(0,_commons.show_error)(["build failed code:",b.code]),a.abrupt("return",!1);case 11:case"end":return a.stop()}},a)})),_build.apply(this,arguments)}function handle(a){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:if(b.prev=0,"go"!==a.mode){b.next=15;break}return(0,_commons.show_div)(),b.next=5,prepare();case 5:return b.next=7,build();case 7:if(!b.sent){b.next=12;break}return b.next=10,finalize();case 10:return b.next=12,publish();case 12:(0,_commons.show_div)(),b.next=31;break;case 15:if("publish"!==a.mode){b.next=20;break}return b.next=18,publish();case 18:b.next=31;break;case 20:if("prepare"!==a.mode){b.next=25;break}return b.next=23,prepare();case 23:b.next=31;break;case 25:if("finalize"!==a.mode){b.next=30;break}return b.next=28,finalize();case 28:b.next=31;break;case 30:(0,_commons.err_unknown_action)(a);case 31:b.next=36;break;case 33:return b.prev=33,b.t0=b["catch"](0),b.abrupt("return",(0,_commons.show_error)(b.t0));case 36:case"end":return b.stop()}},b,null,[[0,33]])})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _nodeChild_process=require("node:child_process"),_commons=require("../commons"),_filterOptionsByAcceptable=_interopRequireDefault(require("./filterOptionsByAcceptable"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}var SPAWN_OPTIONS={shell:!0},KEYPRESS_DOWN="\x1B[B",KEYPRESS_ENTER="\n";function yarnUpSkipWorkspace(){return _yarnUpSkipWorkspace.apply(this,arguments)}function _yarnUpSkipWorkspace(){return _yarnUpSkipWorkspace=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e=arguments;return _regeneratorRuntime().wrap(function f(a){for(;1;)switch(a.prev=a.next){case 0:for(b=e.length,c=Array(b),d=0;d<b;d++)c[d]=e[d];return(0,_commons.show_msg)("updating"),a.next=4,new Promise(function(a,b){var d,e=function b(a){if(null===d.stdin)throw new Error("Expected STDIN to exist, but received null.");d.stdin.write(a)},f=function b(a){var c=a.toString(),d=c.split("\n"),f=(0,_filterOptionsByAcceptable["default"])(d),g=d.findIndex(function(a){return(a+"").trim().includes(">")});1===d.length?process.stdout.write(c):0<f&&((0,_commons.show_msg)("acceptedOption: ".concat(f," currentSelectedIndex: ").concat(g)),f===g?((0,_commons.show_msg)("select: ".concat(d[g])),e(KEYPRESS_ENTER)):((0,_commons.show_msg)("skip: ".concat(d[g])),e(KEYPRESS_DOWN)))};/* --------------------------------- events --------------------------------- */if(d=(0,_nodeChild_process.spawn)("yarn",["up","--interactive"].concat(c),SPAWN_OPTIONS),d.on("close",a),d.on("error",b),null!==d.stdout)d.stdout.setEncoding("utf8"),d.stdout.on("data",f);else throw"Expected STDOUT to exist, but received null.";if(null!==d.stderr)d.stderr.on("data",_commons.show_error);else throw"Expected STDERR to exist, but received null.";/* -------------------------------------------------------------------------- */});case 4:(0,_commons.show_msg)("update done");case 5:case"end":return a.stop()}},a)})),_yarnUpSkipWorkspace.apply(this,arguments)}function handle(a){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:return b.prev=0,b.next=3,yarnUpSkipWorkspace(a.target);case 3:b.next=8;break;case 5:return b.prev=5,b.t0=b["catch"](0),b.abrupt("return",(0,_commons.show_error)(b.t0));case 8:case"end":return b.stop()}},b,null,[[0,5]])})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _nodeChild_process=require("node:child_process"),_commons=require("../commons"),_filterOptionsByAcceptable=_interopRequireDefault(require("./filterOptionsByAcceptable"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function b(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function f(b,d,e,f){var g=d&&d.prototype instanceof k?d:k,h=Object.create(g.prototype),a=new B(f||[]);return E(h,"_invoke",{value:w(b,e,a)}),h}function j(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function k(){}function l(){}function m(){}function q(a){["next","throw","return"].forEach(function(c){b(a,c,function(a){return this._invoke(c,a)})})}function s(b,d){function c(e,f,g,i){var a=j(b[e],b,f);if("throw"!==a.type){var k=a.arg,l=k.value;return l&&"object"==_typeof(l)&&t.call(l,"__await")?d.resolve(l.__await).then(function(a){c("next",a,g,i)},function(a){c("throw",a,g,i)}):d.resolve(l).then(function(a){k.value=a,g(k)},function(a){return c("throw",a,g,i)})}i(a.arg)}var e;E(this,"_invoke",{value:function value(a,b){function f(){return new d(function(d,e){c(a,b,d,e)})}return e=e?e.then(f,f):f()}})}function w(a,b,d){var e="suspendedStart";return function(f,g){if(e==="executing")throw Error("Generator is already running");if("completed"===e){if("throw"===f)throw g;return{value:D,done:!0}}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=x(h,d);if(i){if(i===G)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"===e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=j(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===G)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function x(b,c){var d=c.method,e=b.iterator[d];if(e===D)return c.delegate=null,"throw"===d&&b.iterator["return"]&&(c.method="return",c.arg=D,x(b,c),"throw"===c.method)||"return"!==d&&(c.method="throw",c.arg=new TypeError("The iterator does not provide a '"+d+"' method")),G;var f=j(e,b.iterator,c.arg);if("throw"===f.type)return c.method="throw",c.arg=f.arg,c.delegate=null,G;var g=f.arg;return g?g.done?(c[b.resultName]=g.value,c.next=b.nextLoc,"return"!==c.method&&(c.method="next",c.arg=D),c.delegate=null,G):g:(c.method="throw",c.arg=new TypeError("iterator result is not an object"),c.delegate=null,G)}function z(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function A(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function B(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(z,this),this.reset(!0)}function C(a){if(a||""===a){var b=a[F];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(t.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=D,b.done=!0,b};return d.next=d}}throw new TypeError(_typeof(a)+" is not iterable")}_regeneratorRuntime=function(){return h};var D,h={},e=Object.prototype,t=e.hasOwnProperty,E=Object.defineProperty||function(a,b,c){a[b]=c.value},n="function"==typeof Symbol?Symbol:{},F=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",c=n.toStringTag||"@@toStringTag";try{b({},"")}catch(a){b=function(a,b,c){return a[b]=c}}h.wrap=f;var G={},i={};b(i,F,function(){return this});var o=Object.getPrototypeOf,d=o&&o(o(C([])));d&&d!==e&&t.call(d,F)&&(i=d);var r=m.prototype=k.prototype=Object.create(i);return l.prototype=m,E(r,"constructor",{value:m,configurable:!0}),E(m,"constructor",{value:l,configurable:!0}),l.displayName=b(m,c,"GeneratorFunction"),h.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===l||"GeneratorFunction"===(b.displayName||b.name))},h.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,m):(a.__proto__=m,b(a,c,"GeneratorFunction")),a.prototype=Object.create(r),a},h.awrap=function(a){return{__await:a}},q(s.prototype),b(s.prototype,a,function(){return this}),h.AsyncIterator=s,h.async=function(b,c,d,e,g){void 0===g&&(g=Promise);var j=new s(f(b,c,d,e),g);return h.isGeneratorFunction(c)?j:j.next().then(function(a){return a.done?a.value:j.next()})},q(r),b(r,c,"Generator"),b(r,F,function(){return this}),b(r,"toString",function(){return"[object Generator]"}),h.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},h.values=C,B.prototype={constructor:B,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=D,this.done=!1,this.delegate=null,this.method="next",this.arg=D,this.tryEntries.forEach(A),!a)for(var b in this)"t"===b.charAt(0)&&t.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=D)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(b){function d(a,c){return h.type="throw",h.arg=b,e.next=a,c&&(e.method="next",e.arg=D),!!c}if(this.done)throw b;for(var e=this,f=this.tryEntries.length-1;0<=f;--f){var g=this.tryEntries[f],h=g.completion;if("root"===g.tryLoc)return d("end");if(g.tryLoc<=this.prev){var j=t.call(g,"catchLoc"),k=t.call(g,"finallyLoc");if(j&&k){if(this.prev<g.catchLoc)return d(g.catchLoc,!0);if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(!j){if(!k)throw Error("try statement without catch or finally");if(this.prev<g.finallyLoc)return d(g.finallyLoc)}else if(this.prev<g.catchLoc)return d(g.catchLoc,!0)}}},abrupt:function abrupt(b,c){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&t.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===b||"continue"===b)&&f.tryLoc<=c&&c<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=b,g.arg=c,f?(this.method="next",this.next=f.finallyLoc,G):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),G},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),A(b),G},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var f=d.arg;A(b)}return f}throw Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}var SPAWN_OPTIONS={shell:!0},KEYPRESS_DOWN="\x1B[B",KEYPRESS_ENTER="\n";function yarnUpSkipWorkspace(){return _yarnUpSkipWorkspace.apply(this,arguments)}function _yarnUpSkipWorkspace(){return _yarnUpSkipWorkspace=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){var b,c,d,e=arguments;return _regeneratorRuntime().wrap(function f(a){for(;1;)switch(a.prev=a.next){case 0:for(b=e.length,c=Array(b),d=0;d<b;d++)c[d]=e[d];return(0,_commons.show_msg)("updating"),a.next=4,new Promise(function(a,b){var d,e=function b(a){if(null===d.stdin)throw new Error("Expected STDIN to exist, but received null.");d.stdin.write(a)},f=function b(a){var c=a.toString(),d=c.split("\n"),f=(0,_filterOptionsByAcceptable["default"])(d),g=d.findIndex(function(a){return(a+"").trim().includes(">")});process.stdout.write(c),1===d.length||0<f&&(f===g?e(KEYPRESS_ENTER):e(KEYPRESS_DOWN))};/* --------------------------------- events --------------------------------- */if(d=(0,_nodeChild_process.spawn)("yarn",["up","--interactive"].concat(c),SPAWN_OPTIONS),d.on("close",a),d.on("error",b),null!==d.stdout)d.stdout.setEncoding("utf8"),d.stdout.on("data",f);else throw"Expected STDOUT to exist, but received null.";if(null!==d.stderr)d.stderr.on("data",_commons.show_error);else throw"Expected STDERR to exist, but received null.";/* -------------------------------------------------------------------------- */});case 4:process.stdout.write("\n\n"),(0,_commons.show_msg)("update done");case 6:case"end":return a.stop()}},a)})),_yarnUpSkipWorkspace.apply(this,arguments)}function handle(a){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:return b.prev=0,b.next=3,yarnUpSkipWorkspace(a.target);case 3:b.next=8;break;case 5:return b.prev=5,b.t0=b["catch"](0),b.abrupt("return",(0,_commons.show_error)(b.t0));case 8:case"end":return b.stop()}},b,null,[[0,5]])})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|