jd-minigame-ci 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/jgc.js +1 -1
  2. package/package.json +1 -1
package/dist/jgc.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(global,(()=>(()=>{var t={85:t=>{t.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:S(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(N([])));j&&j!==r&&i.call(j,u)&&(k=j);var L=x.prototype=b.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function S(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?m:y,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(_.prototype),p(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),p(L,f,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;q(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var a=r(652),c=r(928),u=r(172),s=r(410).globSync;function f(t){try{if(a.pathExistsSync(t))return!0;if(f(c.dirname(t)))return a.mkdirsSync(t),!0}catch(t){console.log("make dir error,",t)}}e.writeFile=function(){var t,e=(t=o().mark((function t(e,r){var n,i=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=i.length>2&&void 0!==i[2]?i[2]:"utf8",f(c.posix.parse(e).dir)&&a.writeFileSync(e,r,n);case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))});return function(t,r){return e.apply(this,arguments)}}(),e.verifyGameRequiredFilesExist=function(t){if(!a.pathExistsSync(t))return{code:-1,err_msg:"当前入口文件目录不存在!"};var e=s("game.json",{cwd:t,ignore:"node_modules/**"}),r=s("game.js",{cwd:t,ignore:"node_modules/**"});return 0===e.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},e.hasJgcConfigFile=function(t){try{return a.accessSync(t,a.constants.F_OK),!0}catch(t){return console.log("文件不存在"),!1}},e.compressDirectory=function(t,e){return new Promise((function(r,n){var o=a.createWriteStream(e),i=u("zip",{zlib:{level:9}});o.on("close",(function(){return r(i.pointer())})),i.on("warning",(function(t){return"ENOENT"!==t.code&&n(t)})),i.on("error",n),i.pipe(o),i.glob("**/*",{cwd:t,ignore:["**/.*","**/*.js.map"]}),i.finalize()}))},e.deleteFile=function(t){a.existsSync(t)&&a.unlink(t,(function(t){t&&console.log("删除zip文件失败: ",t)}))}},522:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}var o=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.configPrompts=[{name:"appId",type:"input",message:"请输入appId:",validate:function(t){return!!t||"appId不能为空"}},{name:"requestToken",type:"input",message:"请输入代码上传秘钥:",validate:function(t){return!!t||"代码上传秘钥不能为空"}},{name:"entry",type:"input",message:"请输入需要被打包的游戏(或者插件)的路径:",default:"./"},{name:"versionName",type:"input",message:"请输入需要被打包的游戏(或者插件)的版本号:",default:"1.0.0"},{name:"description",type:"input",message:"请输入需要被打包的游戏(或者插件)的备注:",default:""}]},(e=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();t.exports=o},890:(t,e,r)=>{var n=r(420),o=r(241),i=r(268);e.showQrCode=function(t){return new Promise((function(e,r){n.read(t).then((function(t){var r=t.bitmap,n=r.width,a=r.height,c=r.data,u=new Uint8ClampedArray(c),s=i(u,n,a);o.generate(s.data,{small:!1}),e(!0)})).catch((function(t){r(!1)}))}))},e.getBase64=function(t){return n.read(t).then((function(t){return t.getBase64Async("image/png")})).catch((function(){throw new Error("获取二维码base64失败")}))}},425:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return e};var t,e={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),c=new T(n||[]);return i(a,"_invoke",{value:S(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(N([])));j&&j!==r&&o.call(j,u)&&(k=j);var L=x.prototype=b.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(i,a,c,u){var s=h(t[i],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&o.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function S(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?m:y,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,i(L,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(_.prototype),p(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),p(L,f,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;q(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){u(i,n,o,a,c,"next",t)}function c(t){u(i,n,o,a,c,"throw",t)}a(void 0)}))}}var f=r(938),p=r(305),l=r(652),h=r(85),d=h.FAIL_CODE,y=h.SUCCEED_CODE,v="https://vapp-ide-pack.jd.com";function m(){return(m=s(c().mark((function t(e){var r,n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,w(e);case 3:if((r=t.sent).code===y){t.next=6;break}return t.abrupt("return",r);case 6:return n=r.data.result,t.next=9,k(e,n);case 9:if((o=t.sent).code===y){t.next=12;break}return t.abrupt("return",o);case 12:return t.abrupt("return",{code:y,packId:o.data});case 15:return t.prev=15,t.t0=t.catch(0),t.abrupt("return",{code:d,err_msg:t.t0 instanceof Error?t.t0.message:"上传失败"});case 18:case"end":return t.stop()}}),t,null,[[0,15]])})))).apply(this,arguments)}function g(t,e){return b.apply(this,arguments)}function b(){return b=s(c().mark((function t(e,r){var n,o,a,u,s=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a in n=s.length>2&&void 0!==s[2]?s[2]:"请求失败",o=new p,r)o.append(a,r[a]);return t.prev=3,t.next=6,f.post(e,o,{headers:i({},o.getHeaders())});case 6:if((u=t.sent).data.code!==y){t.next=9;break}return t.abrupt("return",{code:y,data:u.data});case 9:return t.abrupt("return",{code:d,err_msg:"".concat(n,": ").concat(u.data.errorMessage)});case 12:return t.prev=12,t.t0=t.catch(3),t.abrupt("return",{code:d,err_msg:"".concat(n,": ").concat(t.t0)});case 15:case"end":return t.stop()}}),t,null,[[3,12]])}))),b.apply(this,arguments)}function w(t){return x.apply(this,arguments)}function x(){return(x=s(c().mark((function t(e){var r,n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.sourceFile,n=e.appId,o=e.requestToken,i="".concat(v,"/v1/devops/pack"),a={appId:n,requestToken:o,sourceFile:l.createReadStream(r)},t.abrupt("return",g(i,a,"文件上传报错"));case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function k(t,e){return E.apply(this,arguments)}function E(){return(E=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Date.now(),o=5e5,i=3e3;case 3:if(!(Date.now()-n<o)){t.next=15;break}return t.next=6,new Promise((function(t){return setTimeout(t,i)}));case 6:return t.next=8,j(e,r);case 8:if((a=t.sent).code===y){t.next=11;break}return t.abrupt("return",{code:d,err_msg:a.err_msg});case 11:if(!a.data.result){t.next=13;break}return t.abrupt("return",{code:y,data:a.data.result});case 13:t.next=3;break;case 15:return t.abrupt("return",{code:d,err_msg:"查询超时"});case 16:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function j(t,e){return L.apply(this,arguments)}function L(){return(L=s(c().mark((function t(e,r){var n,o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,uuid:r},t.abrupt("return",g("".concat(v,"/v1/ci/queryPackIdByUuid"),i,"获取构建包id失效"));case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function O(){return(O=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o=e.packId,i={appId:r,requestToken:n,packId:o},t.next=4,g("".concat(v,"/v1/ci/queryQrcodeByPackId"),i,"获取二维码失效");case 4:if((a=t.sent).code===y){t.next=7;break}return t.abrupt("return",{code:d,err_msg:a.err_msg});case 7:if(!a.data.result){t.next=13;break}return(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:y,imgUrl:a.data.result,expiredTime:"".concat(_(u.getHours()),":").concat(_(u.getMinutes()))});case 13:return t.abrupt("return",{code:d,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function _(t){return String(t).length<2?"0".concat(String(t)):String(t)}function S(){return(S=s(c().mark((function t(e,r){var n,o,i,a,u,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i=e.versionName,a=e.description,u={packId:r,appId:n,requestToken:o,versionName:i,description:a},t.next=4,g("".concat(v,"/v1/ci/commitDevVersion"),u,"设置为开发版失效");case 4:if((s=t.sent).code===y){t.next=7;break}return t.abrupt("return",s);case 7:return t.abrupt("return",{code:y,devId:s.data.result});case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function I(){return(I=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,devId:r},t.next=4,g("".concat(v,"/v1/ci/devExperience"),i,"设置为体验版失效");case 4:if((a=t.sent).code===y){t.next=7;break}return t.abrupt("return",a);case 7:return t.abrupt("return",{code:y});case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function P(){return(P=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o={appId:r,requestToken:n},t.next=4,g("".concat(v,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((i=t.sent).code===y){t.next=7;break}return t.abrupt("return",{code:d,err_msg:i.err_msg});case 7:return a=i.data.result,(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:y,imgUrl:a,expiredTime:"".concat(_(u.getHours()),":").concat(_(u.getMinutes()))});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}t.exports={uploadProject:function(t){return m.apply(this,arguments)},generateQrCode:function(t){return O.apply(this,arguments)},commitDevVersion:function(t,e){return S.apply(this,arguments)},setDevExperience:function(t,e){return I.apply(this,arguments)},queryExperienceQrcodeByPackId:function(t){return P.apply(this,arguments)}}},60:(t,e)=>{function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}e.checkConfigOptions=function(t,e){for(var n,o=t||{},i=o.appId,a=o.requestToken,c=o.entry,u=o.versionName,s=o.description,f=1===e?{appId:i,requestToken:a,entry:c}:{appId:i,requestToken:a,entry:c,versionName:u,description:s},p=0,l=Object.entries(f);p<l.length;p++){var h=r(l[p],2),d=h[0],y=h[1];if("string"!=typeof(n=y)||!n.trim())return{code:-1,err_msg:"".concat(d," 不能为空")}}return{code:0,err_msg:"ok"}}},589:t=>{function e(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}e.keys=()=>[],e.resolve=e,e.id=589,t.exports=e},172:t=>{"use strict";t.exports=require("archiver")},938:t=>{"use strict";t.exports=require("axios")},858:t=>{"use strict";t.exports=require("commander")},305:t=>{"use strict";t.exports=require("form-data")},652:t=>{"use strict";t.exports=require("fs-extra")},410:t=>{"use strict";t.exports=require("glob")},937:t=>{"use strict";t.exports=require("inquirer")},420:t=>{"use strict";t.exports=require("jimp")},268:t=>{"use strict";t.exports=require("jsqr")},720:t=>{"use strict";t.exports=require("ora")},205:t=>{"use strict";t.exports=require("picocolors")},241:t=>{"use strict";t.exports=require("qrcode-terminal")},857:t=>{"use strict";t.exports=require("os")},928:t=>{"use strict";t.exports=require("path")},330:t=>{"use strict";t.exports=JSON.parse('{"name":"jd-minigame-ci","version":"0.2.0","description":"The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.","author":"chenlong328","license":"ISC","main":"dist/index.js","bin":{"jgc":"./dist/jgc.js"},"scripts":{"config":"NODE_ENV=development node ./dist/jgc.js config","preview":"NODE_ENV=development node ./dist/jgc.js preview","dev:config":"NODE_ENV=development node ./src/jgc.js config","dev:preview":"NODE_ENV=development node ./src/jgc.js preview","dev:upload":"NODE_ENV=development node ./src/jgc.js upload","build":"webpack --mode production --progress --config webpack.config.js && chmod 777 ./dist/index.js && chmod 777 ./dist/jgc.js"},"dependencies":{"@babel/cli":"^7.23.9","@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","archiver":"^6.0.1","axios":"^1.7.3","commander":"^11.1.0","fs-extra":"^11.2.0","glob":"^10.3.10","inquirer":"8.2.6","jimp":"^0.22.12","jsqr":"1.4.0","minimist":"^1.2.8","ora":"5.4.1","qrcode":"^1.5.3","qrcode-terminal":"^0.12.0","string-width":"4.2.3","strip-ansi":"6.0.1"},"devDependencies":{"babel-loader":"^9.1.3","babel-minify-webpack-plugin":"^0.3.1","clean-webpack-plugin":"^4.0.0","terser-webpack-plugin":"^5.3.10","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"files":["dist","package.json","README.md"]}')}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:S(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(N([])));j&&j!==r&&i.call(j,u)&&(k=j);var L=x.prototype=b.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function S(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?m:y,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(_.prototype),p(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),p(L,f,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;q(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}var c=r(928),u=r(857),s=r(720),f=r(205),p=new(0,r(858).Command),l=r(937),h=r(938),d=r(522),y=r(538),v=r(60),m=r(425),g=r(890),b=r(85).SUCCEED_CODE,w=r(330);function x(t){return k.apply(this,arguments)}function k(){return(k=a(o().mark((function t(e){var n,i,a,p,l,h,d,w,x,k,E,j,L,O,_,S,I,P,q,T,N,D,F,C,G;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=1===e?"preview":"upload",i=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(i)){t.next=5;break}return t.abrupt("return",console.log("".concat(f.red("请先创建配置文件!"))));case 5:if(a="function"==typeof require?require:r(589),p=a(i),(l=v.checkConfigOptions(p,e)).code===b){t.next=10;break}return t.abrupt("return",console.log(l.err_msg));case 10:if(h=p.appId,d=p.requestToken,w=p.versionName,x=p.entry,k=p.description,(E=y.verifyGameRequiredFilesExist(x)).code===b){t.next=14;break}return t.abrupt("return",console.log(E.err_msg));case 14:return j=u.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(j),L=s("文件压缩").start(),t.prev=17,t.next=20,y.compressDirectory(x,j);case 20:O=t.sent,L.succeed("压缩完成,共"+O/1e3+"KB"),t.next=28;break;case 24:t.prev=24,t.t0=t.catch(17),L.fail("压缩失败:",t.t0),process.exit(1);case 28:return L.start(),L.text="上传中",t.prev=30,t.next=33,m.uploadProject({sourceFile:j,appId:h,requestToken:d});case 33:if((_=t.sent).code!==b&&(L.fail(_.err_msg),process.exit(1)),S=_.packId,L.succeed("上传完成,packId:".concat(S)),"preview"!==n){t.next=49;break}return t.next=40,m.generateQrCode({packId:S,appId:h,requestToken:d});case 40:return(I=t.sent).code!==b&&(L.fail(I.err_msg),process.exit(1)),P=I.imgUrl,q=I.expiredTime,t.next=45,g.showQrCode(P);case 45:L.succeed("二维码生成完成,将于".concat(q,"过期")),L.info("二维码仅支持协作成员访问"),t.next=71;break;case 49:if("upload"!==n){t.next=71;break}return L.start(),t.next=53,m.commitDevVersion({appId:h,requestToken:d,versionName:w,description:k},S);case 53:return(T=t.sent).code!==b&&(L.fail(T.err_msg),process.exit(1)),N=T.devId,L.succeed("开发版设置完成, devId:"+N),t.next=59,m.setDevExperience({appId:h,requestToken:d},N);case 59:return(D=t.sent).code!==b&&(L.fail(D.err_msg),process.exit(1)),L.succeed("体验版设置完成"),t.next=64,m.queryExperienceQrcodeByPackId({appId:h,requestToken:d});case 64:return(F=t.sent).code!==b&&(L.fail(F.err_msg),process.exit(1)),C=F.imgUrl,G=F.expiredTime,t.next=69,g.showQrCode(C);case 69:L.info("二维码仅支持协作成员访问"),L.succeed("二维码生成完成,将于".concat(G,"过期"));case 71:t.next=77;break;case 73:t.prev=73,t.t1=t.catch(30),L.fail("CLI执行报错 --\x3e".concat(t.t1)),process.exit(1);case 77:case"end":return t.stop()}}),t,null,[[17,24],[30,73]])})))).apply(this,arguments)}return p.command("config").description("小游戏配置").action(a(o().mark((function t(){var e,r,n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=(new d).getPrompts(),t.next=3,l.prompt(e);case 3:if(r=t.sent,(n=y.verifyGameRequiredFilesExist(r.entry)).code===b){t.next=7;break}return t.abrupt("return",console.log("".concat(f.red(n.err_msg))));case 7:return t.prev=7,y.writeFile("./".concat("jgc.config.js"),"module.exports = ".concat(JSON.stringify(r,null,2)),"utf-8"),t.abrupt("return",console.log("✨ ".concat(f.green("创建小游戏配置文件成功"))));case 13:t.prev=13,t.t0=t.catch(7),console.log("创建小游戏配置文件失败:",t.t0);case 16:case"end":return t.stop()}}),t,null,[[7,13]])})))),p.command("preview").description("小游戏真机预览").action(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:x(1);case 1:case"end":return t.stop()}}),t)})))),p.command("upload").description("小游戏发布").action(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:x(2);case 1:case"end":return t.stop()}}),t)})))),p.version(w.version,"-v, -V").description("获取本地京东小游戏CLI工具版本"),p.command("latest").description("获取并对比京东小游戏CLI工具最新版本").action(a(o().mark((function t(){var e,r,n,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e=s("npm最新版本获取中……").start(),t.next=4,h.get("https://registry.npmjs.org/jd-minigame-ci/latest");case 4:r=t.sent,n=r.data.version,i=w.version,e.succeed("最新版本: ".concat(n)),n===i?e.info("当前版本 (".concat(i,") 已是最新版本。")):(e.info("本地版本: ".concat(i)),e.info("请更新到最新版本以获取最新功能和修复。")),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),spinner.fail("获取最新版本信息失败: ".concat(t.t0));case 14:case"end":return t.stop()}}),t,null,[[0,11]])})))),p.parse(process.argv),{}})()));
2
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(global,(()=>(()=>{var t={85:t=>{t.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:S(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(N([])));j&&j!==r&&i.call(j,u)&&(k=j);var L=x.prototype=b.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function S(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?m:y,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(_.prototype),p(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),p(L,f,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;q(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}var a=r(652),c=r(928),u=r(172),s=r(410).globSync;function f(t){try{if(a.pathExistsSync(t))return!0;if(f(c.dirname(t)))return a.mkdirsSync(t),!0}catch(t){console.log("make dir error,",t)}}e.writeFile=function(){var t,e=(t=o().mark((function t(e,r){var n,i=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=i.length>2&&void 0!==i[2]?i[2]:"utf8",f(c.posix.parse(e).dir)&&a.writeFileSync(e,r,n);case 4:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))});return function(t,r){return e.apply(this,arguments)}}(),e.verifyGameRequiredFilesExist=function(t){if(!a.pathExistsSync(t))return{code:-1,err_msg:"当前入口文件目录不存在!"};var e=s("game.json",{cwd:t,ignore:"node_modules/**"}),r=s("game.js",{cwd:t,ignore:"node_modules/**"});return 0===e.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},e.hasJgcConfigFile=function(t){try{return a.accessSync(t,a.constants.F_OK),!0}catch(t){return console.log("文件不存在"),!1}},e.compressDirectory=function(t,e){return new Promise((function(r,n){var o=a.createWriteStream(e),i=u("zip",{zlib:{level:9}});o.on("close",(function(){return r(i.pointer())})),i.on("warning",(function(t){return"ENOENT"!==t.code&&n(t)})),i.on("error",n),i.pipe(o),i.glob("**/*",{cwd:t,ignore:["**/.*","**/*.js.map"]}),i.finalize()}))},e.deleteFile=function(t){a.existsSync(t)&&a.unlink(t,(function(t){t&&console.log("删除zip文件失败: ",t)}))}},522:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}var o=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.configPrompts=[{name:"appId",type:"input",message:"请输入appId:",validate:function(t){return!!t||"appId不能为空"}},{name:"requestToken",type:"input",message:"请输入代码上传秘钥:",validate:function(t){return!!t||"代码上传秘钥不能为空"}},{name:"entry",type:"input",message:"请输入需要被打包的游戏(或者插件)的路径:",default:"./"},{name:"versionName",type:"input",message:"请输入需要被打包的游戏(或者插件)的版本号:",default:"1.0.0"},{name:"description",type:"input",message:"请输入需要被打包的游戏(或者插件)的备注:",default:""}]},(e=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();t.exports=o},890:(t,e,r)=>{var n=r(420),o=r(241),i=r(268);e.showQrCode=function(t){return new Promise((function(e,r){n.read(t).then((function(t){var r=t.bitmap,n=r.width,a=r.height,c=r.data,u=new Uint8ClampedArray(c),s=i(u,n,a);o.generate(s.data,{small:!1}),e(!0)})).catch((function(t){r(!1)}))}))},e.getBase64=function(t){return n.read(t).then((function(t){return t.getBase64Async("image/png")})).catch((function(){throw new Error("获取二维码base64失败")}))}},425:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return e};var t,e={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",f=a.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,a=Object.create(o.prototype),c=new T(n||[]);return i(a,"_invoke",{value:S(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(N([])));j&&j!==r&&o.call(j,u)&&(k=j);var L=x.prototype=b.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(i,a,c,u){var s=h(t[i],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&o.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var a;i(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return a=a?a.then(o,o):o()}})}function S(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?m:y,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,i(L,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(_.prototype),p(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),p(L,f,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;q(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function u(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){u(i,n,o,a,c,"next",t)}function c(t){u(i,n,o,a,c,"throw",t)}a(void 0)}))}}var f=r(938),p=r(305),l=r(652),h=r(85),d=h.FAIL_CODE,y=h.SUCCEED_CODE,v="https://vapp-ide-pack.jd.com";function m(){return(m=s(c().mark((function t(e){var r,n,o;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,w(e);case 3:if((r=t.sent).code===y){t.next=6;break}return t.abrupt("return",r);case 6:return n=r.data.result,t.next=9,k(e,n);case 9:if((o=t.sent).code===y){t.next=12;break}return t.abrupt("return",o);case 12:return t.abrupt("return",{code:y,packId:o.data});case 15:return t.prev=15,t.t0=t.catch(0),t.abrupt("return",{code:d,err_msg:t.t0 instanceof Error?t.t0.message:"上传失败"});case 18:case"end":return t.stop()}}),t,null,[[0,15]])})))).apply(this,arguments)}function g(t,e){return b.apply(this,arguments)}function b(){return b=s(c().mark((function t(e,r){var n,o,a,u,s=arguments;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a in n=s.length>2&&void 0!==s[2]?s[2]:"请求失败",o=new p,r)o.append(a,r[a]);return t.prev=3,t.next=6,f.post(e,o,{headers:i({},o.getHeaders())});case 6:if((u=t.sent).data.code!==y){t.next=9;break}return t.abrupt("return",{code:y,data:u.data});case 9:return t.abrupt("return",{code:d,err_msg:"".concat(n,": ").concat(u.data.errorMessage)});case 12:return t.prev=12,t.t0=t.catch(3),t.abrupt("return",{code:d,err_msg:"".concat(n,": ").concat(t.t0)});case 15:case"end":return t.stop()}}),t,null,[[3,12]])}))),b.apply(this,arguments)}function w(t){return x.apply(this,arguments)}function x(){return(x=s(c().mark((function t(e){var r,n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.sourceFile,n=e.appId,o=e.requestToken,i="".concat(v,"/v1/devops/pack"),a={appId:n,requestToken:o,sourceFile:l.createReadStream(r)},t.abrupt("return",g(i,a,"文件上传报错"));case 5:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function k(t,e){return E.apply(this,arguments)}function E(){return(E=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=Date.now(),o=5e5,i=3e3;case 3:if(!(Date.now()-n<o)){t.next=15;break}return t.next=6,new Promise((function(t){return setTimeout(t,i)}));case 6:return t.next=8,j(e,r);case 8:if((a=t.sent).code===y){t.next=11;break}return t.abrupt("return",{code:d,err_msg:a.err_msg});case 11:if(!a.data.result){t.next=13;break}return t.abrupt("return",{code:y,data:a.data.result});case 13:t.next=3;break;case 15:return t.abrupt("return",{code:d,err_msg:"查询超时"});case 16:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function j(t,e){return L.apply(this,arguments)}function L(){return(L=s(c().mark((function t(e,r){var n,o,i;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,uuid:r},t.abrupt("return",g("".concat(v,"/v1/ci/queryPackIdByUuid"),i,"获取构建包id失效"));case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function O(){return(O=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o=e.packId,i={appId:r,requestToken:n,packId:o},t.next=4,g("".concat(v,"/v1/ci/queryQrcodeByPackId"),i,"获取二维码失效");case 4:if((a=t.sent).code===y){t.next=7;break}return t.abrupt("return",{code:d,err_msg:a.err_msg});case 7:if(!a.data.result){t.next=13;break}return(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:y,imgUrl:a.data.result,expiredTime:"".concat(_(u.getHours()),":").concat(_(u.getMinutes()))});case 13:return t.abrupt("return",{code:d,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function _(t){return String(t).length<2?"0".concat(String(t)):String(t)}function S(){return(S=s(c().mark((function t(e,r){var n,o,i,a,u,s;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i=e.versionName,a=e.description,u={packId:r,appId:n,requestToken:o,versionName:i,description:a},t.next=4,g("".concat(v,"/v1/ci/commitDevVersion"),u,"设置为开发版失效");case 4:if((s=t.sent).code===y){t.next=7;break}return t.abrupt("return",s);case 7:return t.abrupt("return",{code:y,devId:s.data.result});case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function I(){return(I=s(c().mark((function t(e,r){var n,o,i,a;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.appId,o=e.requestToken,i={appId:n,requestToken:o,devId:r},t.next=4,g("".concat(v,"/v1/ci/devExperience"),i,"设置为体验版失效");case 4:if((a=t.sent).code===y){t.next=7;break}return t.abrupt("return",a);case 7:return t.abrupt("return",{code:y});case 8:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function P(){return(P=s(c().mark((function t(e){var r,n,o,i,a,u;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.appId,n=e.requestToken,o={appId:r,requestToken:n},t.next=4,g("".concat(v,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((i=t.sent).code===y){t.next=7;break}return t.abrupt("return",{code:d,err_msg:i.err_msg});case 7:return a=i.data.result,(u=new Date).setMinutes(u.getMinutes()+25),t.abrupt("return",{code:y,imgUrl:a,expiredTime:"".concat(_(u.getHours()),":").concat(_(u.getMinutes()))});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}t.exports={uploadProject:function(t){return m.apply(this,arguments)},generateQrCode:function(t){return O.apply(this,arguments)},commitDevVersion:function(t,e){return S.apply(this,arguments)},setDevExperience:function(t,e){return I.apply(this,arguments)},queryExperienceQrcodeByPackId:function(t){return P.apply(this,arguments)}}},60:(t,e)=>{function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}e.checkConfigOptions=function(t,e){for(var n,o=t||{},i=o.appId,a=o.requestToken,c=o.entry,u=o.versionName,s=o.description,f=1===e?{appId:i,requestToken:a,entry:c}:{appId:i,requestToken:a,entry:c,versionName:u,description:s},p=0,l=Object.entries(f);p<l.length;p++){var h=r(l[p],2),d=h[0],y=h[1];if("string"!=typeof(n=y)||!n.trim())return{code:-1,err_msg:"".concat(d," 不能为空")}}return{code:0,err_msg:"ok"}}},589:t=>{function e(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}e.keys=()=>[],e.resolve=e,e.id=589,t.exports=e},172:t=>{"use strict";t.exports=require("archiver")},938:t=>{"use strict";t.exports=require("axios")},858:t=>{"use strict";t.exports=require("commander")},305:t=>{"use strict";t.exports=require("form-data")},652:t=>{"use strict";t.exports=require("fs-extra")},410:t=>{"use strict";t.exports=require("glob")},937:t=>{"use strict";t.exports=require("inquirer")},420:t=>{"use strict";t.exports=require("jimp")},268:t=>{"use strict";t.exports=require("jsqr")},720:t=>{"use strict";t.exports=require("ora")},205:t=>{"use strict";t.exports=require("picocolors")},241:t=>{"use strict";t.exports=require("qrcode-terminal")},857:t=>{"use strict";t.exports=require("os")},928:t=>{"use strict";t.exports=require("path")},330:t=>{"use strict";t.exports=JSON.parse('{"name":"jd-minigame-ci","version":"0.2.2","description":"The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.","author":"chenlong328","license":"ISC","main":"dist/index.js","bin":{"jgc":"./dist/jgc.js"},"scripts":{"config":"NODE_ENV=development node ./dist/jgc.js config","preview":"NODE_ENV=development node ./dist/jgc.js preview","dev:config":"NODE_ENV=development node ./src/jgc.js config","dev:preview":"NODE_ENV=development node ./src/jgc.js preview","dev:upload":"NODE_ENV=development node ./src/jgc.js upload","build":"webpack --mode production --progress --config webpack.config.js && chmod 777 ./dist/index.js && chmod 777 ./dist/jgc.js"},"dependencies":{"@babel/cli":"^7.23.9","@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","archiver":"^6.0.1","axios":"^1.7.3","commander":"^11.1.0","fs-extra":"^11.2.0","glob":"^10.3.10","inquirer":"8.2.6","jimp":"^0.22.12","jsqr":"1.4.0","minimist":"^1.2.8","ora":"5.4.1","qrcode":"^1.5.3","qrcode-terminal":"^0.12.0","string-width":"4.2.3","strip-ansi":"6.0.1"},"devDependencies":{"babel-loader":"^9.1.3","babel-minify-webpack-plugin":"^0.3.1","clean-webpack-plugin":"^4.0.0","terser-webpack-plugin":"^5.3.10","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"files":["dist","package.json","README.md"]}')}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return e};var t,e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",f=c.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),c=new T(n||[]);return a(i,"_invoke",{value:S(t,r,c)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var d="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function x(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,j=E&&E(E(N([])));j&&j!==r&&i.call(j,u)&&(k=j);var L=x.prototype=b.prototype=Object.create(k);function O(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,a,c,u){var s=h(t[o],t,a);if("throw"!==s.type){var f=s.arg,p=f.value;return p&&"object"==n(p)&&i.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(p).then((function(t){f.value=t,c(f)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function S(e,r,n){var o=d;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=I(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?m:y,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=m,n.method="throw",n.arg=s.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function q(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function N(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(i.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(n(e)+" is not iterable")}return w.prototype=x,a(L,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=p(x,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,f,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},O(_.prototype),p(_.prototype,s,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(L),p(L,f,"Generator"),p(L,u,(function(){return this})),p(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(q),!e)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),s=i.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),q(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;q(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:N(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function i(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}var c=r(928),u=r(857),s=r(720),f=r(205),p=new(0,r(858).Command),l=r(937),h=r(938),d=r(522),y=r(538),v=r(60),m=r(425),g=r(890),b=r(85).SUCCEED_CODE,w=r(330);function x(t){return k.apply(this,arguments)}function k(){return(k=a(o().mark((function t(e){var n,i,a,p,l,h,d,w,x,k,E,j,L,O,_,S,I,P,q,T,N,D,F,C,G;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=1===e?"preview":"upload",i=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(i)){t.next=5;break}return t.abrupt("return",console.log("".concat(f.red("请先创建配置文件!"))));case 5:if(a="function"==typeof require?require:r(589),p=a(i),(l=v.checkConfigOptions(p,e)).code===b){t.next=10;break}return t.abrupt("return",console.log(l.err_msg));case 10:if(h=p.appId,d=p.requestToken,w=p.versionName,x=p.entry,k=p.description,(E=y.verifyGameRequiredFilesExist(x)).code===b){t.next=14;break}return t.abrupt("return",console.log(E.err_msg));case 14:return j=u.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(j),L=s("文件压缩").start(),t.prev=17,t.next=20,y.compressDirectory(x,j);case 20:O=t.sent,L.succeed("压缩完成,共"+O/1e3+"KB"),t.next=28;break;case 24:t.prev=24,t.t0=t.catch(17),L.fail("压缩失败:",t.t0),process.exit(1);case 28:return L.start(),L.text="上传中",t.prev=30,t.next=33,m.uploadProject({sourceFile:j,appId:h,requestToken:d});case 33:if((_=t.sent).code!==b&&(L.fail(_.err_msg),process.exit(1)),S=_.packId,L.succeed("上传完成,packId:".concat(S)),"preview"!==n){t.next=49;break}return t.next=40,m.generateQrCode({packId:S,appId:h,requestToken:d});case 40:return(I=t.sent).code!==b&&(L.fail(I.err_msg),process.exit(1)),P=I.imgUrl,q=I.expiredTime,t.next=45,g.showQrCode(P);case 45:L.succeed("二维码生成完成,将于".concat(q,"过期")),L.info("二维码仅支持协作成员访问"),t.next=71;break;case 49:if("upload"!==n){t.next=71;break}return L.start(),t.next=53,m.commitDevVersion({appId:h,requestToken:d,versionName:w,description:k},S);case 53:return(T=t.sent).code!==b&&(L.fail(T.err_msg),process.exit(1)),N=T.devId,L.succeed("开发版设置完成, devId:"+N),t.next=59,m.setDevExperience({appId:h,requestToken:d},N);case 59:return(D=t.sent).code!==b&&(L.fail(D.err_msg),process.exit(1)),L.succeed("体验版设置完成"),t.next=64,m.queryExperienceQrcodeByPackId({appId:h,requestToken:d});case 64:return(F=t.sent).code!==b&&(L.fail(F.err_msg),process.exit(1)),C=F.imgUrl,G=F.expiredTime,t.next=69,g.showQrCode(C);case 69:L.info("二维码仅支持协作成员访问"),L.succeed("二维码生成完成,将于".concat(G,"过期"));case 71:t.next=77;break;case 73:t.prev=73,t.t1=t.catch(30),L.fail("CLI执行报错 --\x3e".concat(t.t1)),process.exit(1);case 77:case"end":return t.stop()}}),t,null,[[17,24],[30,73]])})))).apply(this,arguments)}return p.command("config").description("小游戏配置").action(a(o().mark((function t(){var e,r,n;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=(new d).getPrompts(),t.next=3,l.prompt(e);case 3:if(r=t.sent,(n=y.verifyGameRequiredFilesExist(r.entry)).code===b){t.next=7;break}return t.abrupt("return",console.log("".concat(f.red(n.err_msg))));case 7:return t.prev=7,y.writeFile("./".concat("jgc.config.js"),"module.exports = ".concat(JSON.stringify(r,null,2)),"utf-8"),t.abrupt("return",console.log("✨ ".concat(f.green("创建小游戏配置文件成功"))));case 13:t.prev=13,t.t0=t.catch(7),console.log("创建小游戏配置文件失败:",t.t0);case 16:case"end":return t.stop()}}),t,null,[[7,13]])})))),p.command("preview").description("小游戏真机预览").action(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:x(1);case 1:case"end":return t.stop()}}),t)})))),p.command("upload").description("小游戏发布").action(a(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:x(2);case 1:case"end":return t.stop()}}),t)})))),p.version(w.version,"-v, -V").description("获取本地京东小游戏CLI工具版本"),p.command("latest").description("获取并对比京东小游戏CLI工具最新版本").action(a(o().mark((function t(){var e,r,n,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e=s("npm最新版本获取中……").start(),t.next=4,h.get("https://registry.npmjs.org/jd-minigame-ci/latest");case 4:r=t.sent,n=r.data.version,i=w.version,e.succeed("最新版本: ".concat(n)),n===i?e.info("当前版本 (".concat(i,") 已是最新版本。")):(e.info("本地版本: ".concat(i)),e.info("请更新到最新版本以获取最新功能和修复。")),t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0),spinner.fail("获取最新版本信息失败: ".concat(t.t0));case 14:case"end":return t.stop()}}),t,null,[[0,11]])})))),p.parse(process.argv),{}})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jd-minigame-ci",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.",
5
5
  "author": "chenlong328",
6
6
  "license": "ISC",