@azrico/azcli 1.0.27 → 1.0.29

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.
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- /* -------------------------------------------------------------------------- */import chalk from"chalk";import figlet from"figlet";import{hideBin}from"yargs/helpers";import yargs from"yargs";/* -------------------------------------------------------------------------- */ /* Consts */ /* -------------------------------------------------------------------------- */const header=chalk.red(figlet.textSync("Az-cli",{font:"Cyberlarge",horizontalLayout:"full"}));/* -------------------------------------------------------------------------- */ /* Helper functions */ /* -------------------------------------------------------------------------- */function loadCommands(a,b){!a||Array.isArray(b)&&(Array.isArray(b[0])?b.forEach(b=>{loadCommands(a,b)}):a.command(b[0],b[1],b[2],b[3]))}/* -------------------------------------------------------------------------- */ /* Start */ /* -------------------------------------------------------------------------- */const yg=yargs(hideBin(process.argv));yg.usage(header);/* -------------------------------------------------------------------------- */import builder from"./libs/builder/index";import cleaner from"./libs/cleaner/index";import yarnhelp from"./libs/yarnhelp/index";import packager from"./libs/packager/index";loadCommands(yg,builder),loadCommands(yg,cleaner),loadCommands(yg,yarnhelp),loadCommands(yg,packager),yg.demandCommand(1).options({quiet:{alias:["q","s"],describe:"quiet mode",demandOption:!1}});/* -------------------------------------------------------------------------- */const ygresult=yg.parse();
2
+ /* -------------------------------------------------------------------------- */"use strict";var _chalk=_interopRequireDefault(require("chalk")),_figlet=_interopRequireDefault(require("figlet")),_helpers=require("yargs/helpers"),_yargs=_interopRequireDefault(require("yargs")),_index=_interopRequireDefault(require("./libs/builder/index")),_index2=_interopRequireDefault(require("./libs/cleaner/index")),_index3=_interopRequireDefault(require("./libs/yarnhelp/index")),_index4=_interopRequireDefault(require("./libs/packager/index"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/* -------------------------------------------------------------------------- */ /* Consts */ /* -------------------------------------------------------------------------- */var header=_chalk["default"].red(_figlet["default"].textSync("Az-cli",{font:"Cyberlarge",horizontalLayout:"full"}));/* -------------------------------------------------------------------------- */ /* Helper functions */ /* -------------------------------------------------------------------------- */function loadCommands(a,b){!a||Array.isArray(b)&&(Array.isArray(b[0])?b.forEach(function(b){loadCommands(a,b)}):a.command(b[0],b[1],b[2],b[3]))}/* -------------------------------------------------------------------------- */ /* Start */ /* -------------------------------------------------------------------------- */var yg=(0,_yargs["default"])((0,_helpers.hideBin)(process.argv));yg.usage(header),loadCommands(yg,_index["default"]),loadCommands(yg,_index2["default"]),loadCommands(yg,_index3["default"]),loadCommands(yg,_index4["default"]),yg.demandCommand(1).options({quiet:{alias:["q","s"],describe:"quiet mode",demandOption:!1}});/* -------------------------------------------------------------------------- */var ygresult=yg.parse();
@@ -1,3 +1 @@
1
- /* This lib helps you build a wordpress plugin */import{cpfile,mkdirIfNotExists,rmIfExists,show_div,show_error,show_msg}from"../commons";import chalk from"chalk";import fs from"fs";import os from"os";import path from"path";const zl=require("zip-lib"),extraFiles=["wp-content","node_modules","vendor","package.json","composer.json","composer.lock",".gitignore","tsconfig.json","yarn.lock","yarn-error.log","build","dist"];export async function handle(){show_msg("Building WP Plugin","text");const a=os.tmpdir(),b=os.homedir(),c=path.resolve("./"),d=path.basename(c),e=path.resolve(c,`build`),f=path.resolve(a,d),g=path.resolve(b,"Desktop"),h=path.resolve(g,"Build"),i=path.resolve(h,d+".zip");// /tmp
2
- // See: https://www.npmjs.com/package/os
3
- /* -------------------------------------------------------------------------- */show_msg(chalk.gray("Plugin Name :")+" "+chalk.blue(d)),show_msg(chalk.gray("Temp Build :")+" "+chalk.gray(f)),show_msg(chalk.gray("Local Build :")+" "+chalk.gray(e)),show_div();try{show_msg(chalk.gray("Removing old build files")),rmIfExists(e),rmIfExists(f)}catch(a){return show_error(a),!1}show_msg(chalk.gray("Creating folders")),mkdirIfNotExists(h),mkdirIfNotExists(f),mkdirIfNotExists(e);/* -------------------------------------------------------------------------- */try{show_div();const a=fs.readdirSync(c);show_msg(chalk.white("Copy all local files to temp path")+" "+chalk.gray("[")+chalk.blue(a.length)+chalk.gray("]"));const b=extraFiles.map(a=>path.resolve(c,a)),d=a.map(a=>path.resolve(c,a));for(let a=0;a<d.length;a++){const c=d[a];b.includes(c)?show_msg(chalk.red("ignore: "+c+""),"text",!1):cpfile(c,f)&&show_msg(chalk.gray("cp: "+c+""),"text",!1)}}catch(a){return show_error(a),!1}try{show_div(),show_msg(chalk.white("Zip files and copy to destination")),show_msg(chalk.white(`CP:`),"none",!1),show_msg(chalk.gray(f),"none",!1),show_msg(chalk.white(" TO "),"none",!1),show_msg(chalk.gray(i),"none",!1),await zl.archiveFolder(f,i),show_msg(chalk.white("Zip done"))}catch(a){return show_error(a),!1}try{show_div(),show_msg(chalk.white("Clean up")),rmIfExists(f),cpfile(i,e)}catch(a){return show_error(a),!1}}export default handle;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),_chalk=_interopRequireDefault(require("chalk")),_fs=_interopRequireDefault(require("fs")),_os=_interopRequireDefault(require("os")),_path=_interopRequireDefault(require("path"));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(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}/* This lib helps you build a wordpress plugin */var zl=require("zip-lib"),extraFiles=["wp-content","node_modules","vendor","package.json","composer.json","composer.lock",".gitignore","tsconfig.json","yarn.lock","yarn-error.log","build","dist"];function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_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:(0,_commons.show_msg)("Building WP Plugin","text"),b=_os["default"].tmpdir(),c=_os["default"].homedir(),d=_path["default"].resolve("./"),e=_path["default"].basename(d),f=_path["default"].resolve(d,"build"),g=_path["default"].resolve(b,e),h=_path["default"].resolve(c,"Desktop"),i=_path["default"].resolve(h,"Build"),j=_path["default"].resolve(i,e+".zip"),(0,_commons.show_msg)(_chalk["default"].gray("Plugin Name :")+" "+_chalk["default"].blue(e)),(0,_commons.show_msg)(_chalk["default"].gray("Temp Build :")+" "+_chalk["default"].gray(g)),(0,_commons.show_msg)(_chalk["default"].gray("Local Build :")+" "+_chalk["default"].gray(f)),(0,_commons.show_div)(),a.prev=14,(0,_commons.show_msg)(_chalk["default"].gray("Removing old build files")),(0,_commons.rmIfExists)(f),(0,_commons.rmIfExists)(g),a.next=24;break;case 20:return a.prev=20,a.t0=a["catch"](14),(0,_commons.show_error)(a.t0),a.abrupt("return",!1);case 24:for((0,_commons.show_msg)(_chalk["default"].gray("Creating folders")),(0,_commons.mkdirIfNotExists)(i),(0,_commons.mkdirIfNotExists)(g),(0,_commons.mkdirIfNotExists)(f),a.prev=28,(0,_commons.show_div)(),k=_fs["default"].readdirSync(d),(0,_commons.show_msg)(_chalk["default"].white("Copy all local files to temp path")+" "+_chalk["default"].gray("[")+_chalk["default"].blue(k.length)+_chalk["default"].gray("]")),l=extraFiles.map(function(a){return _path["default"].resolve(d,a)}),m=k.map(function(a){return _path["default"].resolve(d,a)}),n=0;n<m.length;n++)o=m[n],l.includes(o)?(0,_commons.show_msg)(_chalk["default"].red("ignore: "+o+""),"text",!1):(0,_commons.cpfile)(o,g)&&(0,_commons.show_msg)(_chalk["default"].gray("cp: "+o+""),"text",!1);a.next=41;break;case 37:return a.prev=37,a.t1=a["catch"](28),(0,_commons.show_error)(a.t1),a.abrupt("return",!1);case 41:return a.prev=41,(0,_commons.show_div)(),(0,_commons.show_msg)(_chalk["default"].white("Zip files and copy to destination")),(0,_commons.show_msg)(_chalk["default"].white("CP:"),"none",!1),(0,_commons.show_msg)(_chalk["default"].gray(g),"none",!1),(0,_commons.show_msg)(_chalk["default"].white(" TO "),"none",!1),(0,_commons.show_msg)(_chalk["default"].gray(j),"none",!1),a.next=50,zl.archiveFolder(g,j);case 50:(0,_commons.show_msg)(_chalk["default"].white("Zip done")),a.next=57;break;case 53:return a.prev=53,a.t2=a["catch"](41),(0,_commons.show_error)(a.t2),a.abrupt("return",!1);case 57:a.prev=57,(0,_commons.show_div)(),(0,_commons.show_msg)(_chalk["default"].white("Clean up")),(0,_commons.rmIfExists)(g),(0,_commons.cpfile)(j,f),a.next=68;break;case 64:return a.prev=64,a.t3=a["catch"](57),(0,_commons.show_error)(a.t3),a.abrupt("return",!1);case 68:case"end":return a.stop()}},a,null,[[14,20],[28,37],[41,53],[57,64]])})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- /* Automatically integrates tools */import{err_unknown,err_unknown_action}from"../commons";import buildwp from"./buildwp";export function handle(a){try{a.wp?buildwp(a):err_unknown_action(a)}catch(a){err_unknown("unknown error")}}export default[["build <wp>","Build helper",()=>{},handle]];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),_buildwp=_interopRequireDefault(require("./buildwp"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/* Automatically integrates tools */function handle(a){try{a.wp?(0,_buildwp["default"])(a):(0,_commons.err_unknown_action)(a)}catch(a){(0,_commons.err_unknown)("unknown error")}}var _default=exports["default"]=[["build <wp>","Build helper",function(){},handle]];
@@ -1 +1 @@
1
- /* This lib helps you build a wordpress plugin */import{do_exec,show_msg}from"../commons";const cmd1=["rimraf build && rimraf dist"];export async function handle(a){show_msg("Cleaning up build & dist files","text");const b=a.q?void 0:console.log;await do_exec(cmd1,b),show_msg("Build cleanup done","text")}export default handle;
1
+ "use strict";var _commons=require("../commons");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;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(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}/* This lib helps you build a wordpress plugin */var cmd1=["rimraf build && rimraf dist"];function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return(0,_commons.show_msg)("Cleaning up build & dist files","text"),c=a.q?void 0:console.log,b.next=4,(0,_commons.do_exec)(cmd1,c);case 4:(0,_commons.show_msg)("Build cleanup done","text");case 5:case"end":return b.stop()}},b)})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- /* This lib helps you build a wordpress plugin */import{do_exec,show_msg}from"../commons";const cmd1=["rimraf .next"];export async function handle(a){show_msg("Cleaning up next files","text");const b=a.q?void 0:console.log;await do_exec(cmd1,b),show_msg("next cleanup done","text")}export default handle;
1
+ "use strict";var _commons=require("../commons");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;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(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}/* This lib helps you build a wordpress plugin */var cmd1=["rimraf .next"];function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return(0,_commons.show_msg)("Cleaning up next files","text"),c=a.q?void 0:console.log,b.next=4,(0,_commons.do_exec)(cmd1,c);case 4:(0,_commons.show_msg)("next cleanup done","text");case 5:case"end":return b.stop()}},b)})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- /* This lib helps you build a wordpress plugin */import{do_exec,err_unknown,show_msg}from"../commons";const cmd1=["rimraf ./**/node_modules"],cmd_clean_cache=["rimraf .yarn/cache && rimraf ./**/.yarn/cache && rimraf ./**/.jest/cache"],cmd_clean_lock=["rimraf ./**/yarn.lock && rimraf ./**/package-lock.json"];export async function handle(a){const b=a.q?void 0:console.log;try{show_msg("Cleaning up node_module","text"),await do_exec(cmd1,b),show_msg("Cleaning up cache files","text"),await do_exec(cmd_clean_cache,b),show_msg("Cleaning up lock files","text"),await do_exec(cmd_clean_lock,b),show_msg("Node cleanup done","text")}catch{err_unknown("cleanup failed")}}export default handle;
1
+ "use strict";var _commons=require("../commons");Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;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(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}/* This lib helps you build a wordpress plugin */var cmd1=["rimraf ./**/node_modules"],cmd_clean_cache=["rimraf .yarn/cache && rimraf ./**/.yarn/cache && rimraf ./**/.jest/cache"],cmd_clean_lock=["rimraf ./**/yarn.lock && rimraf ./**/package-lock.json"];function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.q?void 0:console.log,b.prev=1,(0,_commons.show_msg)("Cleaning up node_module","text"),b.next=5,(0,_commons.do_exec)(cmd1,c);case 5:return(0,_commons.show_msg)("Cleaning up cache files","text"),b.next=8,(0,_commons.do_exec)(cmd_clean_cache,c);case 8:return(0,_commons.show_msg)("Cleaning up lock files","text"),b.next=11,(0,_commons.do_exec)(cmd_clean_lock,c);case 11:(0,_commons.show_msg)("Node cleanup done","text"),b.next=17;break;case 14:b.prev=14,b.t0=b["catch"](1),(0,_commons.err_unknown)("cleanup failed");case 17:case"end":return b.stop()}},b,null,[[1,14]])})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- /* Automatically integrates tools */import{err_unknown,err_unknown_action,show_div}from"../commons";import cleanbuild from"./cleanbuild";import cleannode from"./cleannode";import cleannext from"./cleannext";export async function handle(a){try{const b=a.mode??"";switch(b){case"build":await cleanbuild(a);break;case"node":await cleannode(a);break;case"next":cleannext(a);break;case"all":await cleanbuild(a),show_div(),await cleannode(a),show_div(),await cleannext(a);break;case"":default:err_unknown_action(a)}}catch(a){err_unknown("unknown error")}}export default[["clean <mode>","Modes: node,build,next,all",()=>{},handle]];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),_cleanbuild=_interopRequireDefault(require("./cleanbuild")),_cleannode=_interopRequireDefault(require("./cleannode")),_cleannext=_interopRequireDefault(require("./cleannext"));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(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}/* Automatically integrates tools */function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d;return _regeneratorRuntime().wrap(function e(b){for(;1;)switch(b.prev=b.next){case 0:b.prev=0,d=null!==(c=a.mode)&&void 0!==c?c:"",b.t0=d,b.next="build"===b.t0?5:"node"===b.t0?8:"next"===b.t0?11:"all"===b.t0?13:""===b.t0?22:22;break;case 5:return b.next=7,(0,_cleanbuild["default"])(a);case 7:return b.abrupt("break",24);case 8:return b.next=10,(0,_cleannode["default"])(a);case 10:return b.abrupt("break",24);case 11:return(0,_cleannext["default"])(a),b.abrupt("break",24);case 13:return b.next=15,(0,_cleanbuild["default"])(a);case 15:return(0,_commons.show_div)(),b.next=18,(0,_cleannode["default"])(a);case 18:return(0,_commons.show_div)(),b.next=21,(0,_cleannext["default"])(a);case 21:return b.abrupt("break",24);case 22:return(0,_commons.err_unknown_action)(a),b.abrupt("break",24);case 24:b.next=29;break;case 26:b.prev=26,b.t1=b["catch"](0),(0,_commons.err_unknown)("unknown error");case 29:case"end":return b.stop()}},b,null,[[0,26]])})),_handle.apply(this,arguments)}var _default=exports["default"]=[["clean <mode>","Modes: node,build,next,all",function(){},handle]];
@@ -1,6 +1,6 @@
1
- import fs from"fs";import fsextra from"fs-extra";import path from"path";import{show_error}from"./helper_interface";export function rmIfExists(a){if(!fs.existsSync(a))return!1;const b=fs.lstatSync(a).isDirectory();return b?fs.rmSync(a,{recursive:!0}):fs.unlinkSync(a),!0}export function mkdirIfNotExists(a){return!fs.existsSync(a)&&(fs.mkdirSync(a),!0)}export function readIfExists(a="./package.json"){if(!fs.existsSync(a))throw show_error("file does not exists: "+a);return fs.readFileSync(a)}export function cpfile(a,b){if(!fs.existsSync(a))return!1;if(path.basename(a).startsWith("."))return!1;//cant copy hiddens
2
- if(fs.existsSync(b)){const c=fs.lstatSync(b).isDirectory();if(c){//targetPath is a directory
3
- const c=path.basename(a);b=path.resolve(b,c)}}return a!==b&&(fsextra.copySync(a,b),!0)}/**
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.cpfile=cpfile,exports.mkdirIfNotExists=mkdirIfNotExists,exports.readIfExists=readIfExists,exports.rmIfExists=rmIfExists;var _fs=_interopRequireDefault(require("fs")),_fsExtra=_interopRequireDefault(require("fs-extra")),_path=_interopRequireDefault(require("path")),_helper_interface=require("./helper_interface");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function rmIfExists(a){if(!_fs["default"].existsSync(a))return!1;var b=_fs["default"].lstatSync(a).isDirectory();return b?_fs["default"].rmSync(a,{recursive:!0}):_fs["default"].unlinkSync(a),!0}function mkdirIfNotExists(a){return!_fs["default"].existsSync(a)&&(_fs["default"].mkdirSync(a),!0)}function readIfExists(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:"./package.json";if(!_fs["default"].existsSync(a))throw(0,_helper_interface.show_error)("file does not exists: "+a);return _fs["default"].readFileSync(a)}function cpfile(a,b){if(!_fs["default"].existsSync(a))return!1;if(_path["default"].basename(a).startsWith("."))return!1;//cant copy hiddens
2
+ if(_fs["default"].existsSync(b)){var c=_fs["default"].lstatSync(b).isDirectory();if(c){//targetPath is a directory
3
+ var d=_path["default"].basename(a);b=_path["default"].resolve(b,d)}}return a!==b&&(_fsExtra["default"].copySync(a,b),!0)}/**
4
4
  * Checks whether a path starts with or contains a hidden file or a folder.
5
5
  * @param {string} source - The path of the file that needs to be validated.
6
6
  * returns {boolean} - `true` if the source is blacklisted and otherwise `false`.
@@ -1 +1 @@
1
- const{exec}=require("child_process");import{err_unknown}from"../commons";import shellExec from"shell-exec";export async function do_exec(a,b,c,d){const e=Array.isArray(a)?a.join(" "):a;if(!e||0>=e.length)return Promise.reject(new Error);const f=shellExec(e);return f.then(a=>{a.error&&err_unknown("Error : "+a.error.message),b&&a.stdout&&b(a.stdout),c&&a.stderr&&c(a.stderr)}),d&&f.finally(d),f.catch(()=>{err_unknown("Error on execution")}),await f}
1
+ "use strict";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)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.do_exec=do_exec;var _commons=require("../commons"),_shellExec=_interopRequireDefault(require("shell-exec"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default: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(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}var _require=require("child_process"),exec=_require.exec;function do_exec(){return _do_exec.apply(this,arguments)}function _do_exec(){return _do_exec=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function e(a,b,c,d){var f,g;return _regeneratorRuntime().wrap(function h(e){for(;1;)switch(e.prev=e.next){case 0:if(f=Array.isArray(a)?a.join(" "):a,f&&!(0>=f.length)){e.next=3;break}return e.abrupt("return",Promise.reject(new Error));case 3:return g=(0,_shellExec["default"])(f),g.then(function(a){a.error&&(0,_commons.err_unknown)("Error : "+a.error.message),b&&a.stdout&&b(a.stdout),c&&a.stderr&&c(a.stderr)}),d&&g["finally"](d),g["catch"](function(a){(0,_commons.err_unknown)("Error on execution")}),e.next=9,g;case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}},e)})),_do_exec.apply(this,arguments)}
@@ -1 +1 @@
1
- import chalk from"chalk";const prefix_text="[az-cli]";export function show_div(){return show_msg("--------------------------------------------------------------------------","text",!1)}export function show_msg(a,b="",c=!0){Array.isArray(a)&&(a=a.flat().map(a=>a+"").join(" "));/* -------------------------------------------------------------------------- */var d="";switch(b){case"text":case"none":case"default":c&&(d=chalk.bgGreen(prefix_text)),console.info(d+" "+chalk.gray(a));break;case"":default:c&&(d=chalk.bgGreen(prefix_text)),console.info(d+" "+a);break;case"error":d=chalk.bgRed(prefix_text),console.error(d+" "+chalk.gray(a))}}export function show_error(a){return a instanceof Error&&(a=a.message),show_msg([chalk.red.bold("error : "),a],"error"),Error(a)}export function err_unknown_action(a){let b="";b="string"==typeof a?a:JSON.stringify(a),show_msg(chalk.red.bold("Unknown command : ")+" "+chalk.gray(b),"error")}export function err_unknown(a){let b="";b="string"==typeof a?a:JSON.stringify(a),show_msg(chalk.red.bold("Unknown error : ")+" "+chalk.gray(b),"error")}
1
+ "use strict";var _chalk=_interopRequireDefault(require("chalk"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.err_unknown=err_unknown,exports.err_unknown_action=err_unknown_action,exports.show_div=show_div,exports.show_error=show_error,exports.show_msg=show_msg;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var prefix_text="[az-cli]";function show_div(){return show_msg("--------------------------------------------------------------------------","text",!1)}function show_msg(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"",c=!(2<arguments.length&&arguments[2]!==void 0)||arguments[2];Array.isArray(a)&&(a=a.flat().map(function(a){return a+""}).join(" "));/* -------------------------------------------------------------------------- */var d="";switch(b){case"text":case"none":case"default":c&&(d=_chalk["default"].bgGreen(prefix_text)),console.info(d+" "+_chalk["default"].gray(a));break;case"":default:c&&(d=_chalk["default"].bgGreen(prefix_text)),console.info(d+" "+a);break;case"error":d=_chalk["default"].bgRed(prefix_text),console.error(d+" "+_chalk["default"].gray(a))}}function show_error(a){return a instanceof Error&&(a=a.message),show_msg([_chalk["default"].red.bold("error : "),a],"error"),Error(a)}function err_unknown_action(a){var b="";b="string"==typeof a?a:JSON.stringify(a),show_msg(_chalk["default"].red.bold("Unknown command : ")+" "+_chalk["default"].gray(b),"error")}function err_unknown(a){var b="";b="string"==typeof a?a:JSON.stringify(a),show_msg(_chalk["default"].red.bold("Unknown error : ")+" "+_chalk["default"].gray(b),"error")}
@@ -1 +1 @@
1
- export function custom_trim(a,...b){return"string"==typeof a&&a?(b.map(b=>{if(!a||!b)return"";for(;a.startsWith(b);)a=a.substring(b.length);for(;a.endsWith(b);)a=a.substring(0,a.length-b.length)}),a):a}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.custom_trim=custom_trim;function custom_trim(a){if("string"!=typeof a||!a)return a;for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];return c.map(function(b){if(!a||!b)return"";for(;a.startsWith(b);)a=a.substring(b.length);for(;a.endsWith(b);)a=a.substring(0,a.length-b.length)}),a}
@@ -1 +1 @@
1
- export*from"./helper_interface";export*from"./helper_string";export*from"./helper_exec";export*from"./filehandler";// export { err_unknown_action, err_unknown, show_msg, show_loading, do_exec };
1
+ "use strict";var _helper_interface=require("./helper_interface");var _helper_string=require("./helper_string");var _helper_exec=require("./helper_exec");var _filehandler=require("./filehandler");Object.defineProperty(exports,"__esModule",{value:!0});Object.keys(_helper_interface).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_helper_interface[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _helper_interface[a]}})});Object.keys(_helper_string).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_helper_string[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _helper_string[a]}})});Object.keys(_helper_exec).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_helper_exec[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _helper_exec[a]}})});Object.keys(_filehandler).forEach(function(a){"default"===a||"__esModule"===a||a in exports&&exports[a]===_filehandler[a]||Object.defineProperty(exports,a,{enumerable:!0,get:function get(){return _filehandler[a]}})});
@@ -1 +1 @@
1
- /* Automatically integrates tools */export function handle(){console.info("IntegHelper")}export default handle;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;/* Automatically integrates tools */function handle(){console.info("IntegHelper")}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- /* Automatically integrates version history for current project */export function handle(){console.info("Building WP Plugin")}export default handle;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;/* Automatically integrates version history for current project */function handle(){console.info("Building WP Plugin")}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- /* Automatically integrates tools */import{err_unknown}from"../commons";import packager from"./packager";export function handle(a){try{packager(a)}catch(a){err_unknown("unknown error")}}export default["package <mode>","convert each folder in ./packages dir into its own package. modes: prepare|finalize|run",()=>{},handle];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),_packager=_interopRequireDefault(require("./packager"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}/* Automatically integrates tools */function handle(a){try{(0,_packager["default"])(a)}catch(a){(0,_commons.err_unknown)("unknown error")}}var _default=exports["default"]=["package <mode>","convert each folder in ./packages dir into its own package. modes: prepare|finalize|run",function(){},handle];
@@ -1,13 +1,13 @@
1
- /* This lib helps you build a wordpress plugin */import{custom_trim,do_exec,err_unknown_action,readIfExists,show_div,show_error,show_msg}from"../commons";import fs from"fs";import path from"path";/**
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),_fs=_interopRequireDefault(require("fs")),_path=_interopRequireDefault(require("path"));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 _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c["return"]||c["return"]()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}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 ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}/* This lib helps you build a wordpress plugin */ /**
2
2
  * get path of current active `dist` or `build`
3
3
  * @returns
4
- */function getDistPath(){if(fs.existsSync("./dist"))return"./dist";if(fs.existsSync("./build"))return"./build";if(fs.existsSync("./temp"))return"./temp";throw"no dist/build found. make sure to run this after building your files normally"}/**
4
+ */function getDistPath(){if(_fs["default"].existsSync("./dist"))return"./dist";if(_fs["default"].existsSync("./build"))return"./build";if(_fs["default"].existsSync("./temp"))return"./temp";throw"no dist/build found. make sure to run this after building your files normally"}/**
5
5
  * get a list of all folders in the ./packages directory
6
6
  * @param dist
7
7
  * @returns
8
- */function getPackagePaths(a=!1){const b=a?path.join(getDistPath(),`./packages`):`./packages`,c=fs.readdirSync(b).filter(a=>!a.startsWith("_")&&!a.startsWith(".")).map(a=>path.join(b,a));return c}function getPackagesData(a=!1){return getPackagePaths(a).map(a=>{const b=path.join(a,"package.json"),c=JSON.parse(readIfExists(b)),d=(c.name+"").split("/").pop()?.split(".").pop();return{fullname:c.name,name:d,path:a,fullpath:path.resolve(a),jsonData:c}})}function copydeps(a,b,c=""){["peerDependencies","dependencies"].forEach(d=>{let e=a[d]??{},f={};//make sure the key exists
9
- for(const a in Array.isArray(e)?e.forEach(a=>{f[a]="latest"}):f=e,f)b[d]||(b[d]={}),b[d][a]=c||f[a]})}function getBasePackageName(a){return a||(a=JSON.parse(readIfExists("package.json"))),custom_trim((a.name+"").replaceAll("workspace",""),"."," ","/")}/**
8
+ */function getPackagePaths(){var a=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0],b=a?_path["default"].join(getDistPath(),"./packages"):"./packages",c=_fs["default"].readdirSync(b).filter(function(a){return!a.startsWith("_")&&!a.startsWith(".")}).map(function(a){return _path["default"].join(b,a)});return c}function getPackagesData(){var a=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0],b=getBasePackageName();return getPackagePaths(a).map(function(a){var c,d=_path["default"].join(a,"package.json"),e=JSON.parse((0,_commons.readIfExists)(d)),f=a.split(_path["default"].sep).pop(),g=e.name?null===(c=(e.name+"").split("/").pop())||void 0===c?void 0:c.split(".").pop():f;return{fullname:b+"."+g,name:g,path:a,fullpath:_path["default"].resolve(a),jsonData:e}})}function copydeps(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:"";["peerDependencies","dependencies"].forEach(function(d){var e,f=null!==(e=a[d])&&void 0!==e?e:{},g={};//make sure the key exists
9
+ for(var h in Array.isArray(f)?f.forEach(function(a){g[a]="latest"}):g=f,g)b[d]||(b[d]={}),b[d][h]=c||g[h]})}function getBasePackageName(a){return a||(a=JSON.parse((0,_commons.readIfExists)("package.json"))),(0,_commons.custom_trim)((a.name+"").replaceAll("workspace",""),"."," ","/")}/**
10
10
  * prepare the core package
11
- */async function prepare(){const a=JSON.parse(readIfExists("package.json")),b="./packages/core";/* -------------------------- make the core package ------------------------- */fs.existsSync(b)&&fs.rmSync(b,{recursive:!0,force:!0});const c={...a};c.name=getBasePackageName(a),c.private=!1,c.main="./index",c.homepage=".",delete c.scripts,delete c.soucre,delete c.workspaces,delete c.files,delete c.devDependencies,delete c.dependencies,delete c.peerDependencies;const d=getPackagesData();/* ------ core package must include all deps from all children packages ----- */copydeps({dependencies:d.map(a=>a.jsonData.name),peerDependencies:d.map(a=>a.jsonData.name)},c,c.version),fs.mkdirSync(b),fs.writeFileSync(path.join(b,"package.json"),JSON.stringify(c,void 0,2)),fs.writeFileSync(path.join(b,"index.ts"),d.map(a=>`export * from "${a.fullname}";`).join("\n")),show_msg("created the core package")}/**
11
+ */function prepare(){return _prepare.apply(this,arguments)}/**
12
12
  * set version of all packages in the dist path
13
- */async function finalize(){const a=JSON.parse(readIfExists("package.json")),b=getBasePackageName(a),c=getPackagesData(!0);let d=0;show_msg(`working on ${c.length} packages for ${b}`,"text");for(const e of c){const c=e.jsonData,f=path.join(e.path,"package.json");/* ------------------------------- fix version ------------------------------ */c.name=b+"."+e.name,c.version=a.version,c.description="module of "+c.name,c.private=!1,copydeps(a,c,""),fs.writeFileSync(f,JSON.stringify(c,void 0,2));const g=await do_exec([`cd ${e.fullpath}/ & npm pkg fix;`]);0===g.code?(show_msg([` -> fix:`,e.name],"text"),d++):show_error([` -> fix failed:`,e.name,`error code:`,g.code])}show_msg(`finalized ${d} packages. you can publish them now :)`)}async function publish(){show_msg(`publishing ...`);let a=0;const b=getPackagePaths(!0).map(a=>path.resolve(a));await Promise.all(b.map(async b=>{const c=await do_exec([`cd ${b}/ & npm publish --access public --tag latest;`]);0===c.code?(show_msg(["published:",b]),a++):show_error(["publish failed with code:",c.code,"error:",c.stderr])})),show_msg(`published ${a} packages`)}async function build(){show_msg(`building ...`);const a=await do_exec("yarn run build");return 0===a.code?(show_msg(`build command was run sucessfully`),!0):(show_error(["build failed code:",a.code]),!1)}export async function handle(a){try{"run"===a.mode?(show_div(),await prepare(),(await build())&&(await finalize(),await publish()),show_div()):"publish"===a.mode?await publish():"prepare"===a.mode?await prepare():"finalize"===a.mode?await finalize():err_unknown_action(a)}catch(a){return show_error(a)}}export default handle;
13
+ */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.jsonData.name}),peerDependencies:e.map(function(a){return a.jsonData.name})},d,d.version),_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;return _regeneratorRuntime().wrap(function l(a){for(;1;)switch(a.prev=a.next){case 0:b=JSON.parse((0,_commons.readIfExists)("package.json")),c=getBasePackageName(b),d=getPackagesData(!0),e=0,(0,_commons.show_msg)("working on ".concat(d.length," packages for ").concat(c),"text"),f=_createForOfIteratorHelper(d),a.prev=6,f.s();case 8:if((g=f.n()).done){a.next=24;break}return h=g.value,i=h.jsonData,j=_path["default"].join(h.path,"package.json"),i.name=c+"."+h.name,i.version=b.version,i.description="module of "+i.name,i["private"]=!1,copydeps(b,i,""),_fs["default"].writeFileSync(j,JSON.stringify(i,void 0,2)),a.next=20,(0,_commons.do_exec)(["cd ".concat(h.fullpath,"/ & npm pkg fix")]);case 20:k=a.sent,0===k.code?((0,_commons.show_msg)([" -> fix:",h.name],"text"),e++):(0,_commons.show_error)([" -> fix failed:",h.name,"error:",k.stderr]);case 22:a.next=8;break;case 24:a.next=29;break;case 26:a.prev=26,a.t0=a["catch"](6),f.e(a.t0);case 29:return a.prev=29,f.f(),a.finish(29);case 32:(0,_commons.show_msg)("finalized ".concat(e," packages. you can publish them now :)"));case 33:case"end":return a.stop()}},a,null,[[6,26,29,32]])})),_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).map(function(a){return _path["default"].resolve(a)}),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,"/ & npm publish --access public --tag latest;")]);case 2:d=c.sent,0===d.code?((0,_commons.show_msg)(["published:",a]),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,"run"!==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
- import yarnb from"./yarnb";import yarni from"./yarni";import yarnt from"./yarnt";export default[["yarni","YarnInstall",()=>{},yarni],["yarnb","YarnBuild",()=>{},yarnb],["yarnt","YarnTest",()=>{},yarnt]];
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0;var _yarnb=_interopRequireDefault(require("./yarnb")),_yarni=_interopRequireDefault(require("./yarni")),_yarnt=_interopRequireDefault(require("./yarnt"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}var _default=exports["default"]=[["yarni","YarnInstall",function(){},_yarni["default"]],["yarnb","YarnBuild",function(){},_yarnb["default"]],["yarnt","YarnTest",function(){},_yarnt["default"]]];
@@ -1 +1 @@
1
- import{do_exec,err_unknown,show_msg}from"../commons";const cmd1=["yarn run build"];export function handle(a){show_msg("YarnBuild","text");const b=a.q?void 0:console.log;return do_exec(cmd1,b).finally(()=>{show_msg("YarnBuild done","text")}).catch(()=>{err_unknown("YarnBuild failed")})}export default handle;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),cmd1=["yarn run build"];function handle(a){(0,_commons.show_msg)("YarnBuild","text");var b=a.q?void 0:console.log;return(0,_commons.do_exec)(cmd1,b)["finally"](function(){(0,_commons.show_msg)("YarnBuild done","text")})["catch"](function(){(0,_commons.err_unknown)("YarnBuild failed")})}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- import{do_exec,err_unknown,show_msg}from"../commons";const cmd1=["yarn install"];export function handle(a){show_msg("YarnInstall","text");const b=a.q?void 0:console.log;return do_exec(cmd1,b).finally(()=>{show_msg("YarnInstall done","text")}).catch(()=>{err_unknown("YarnInstall failed")})}export default handle;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),cmd1=["yarn install"];function handle(a){(0,_commons.show_msg)("YarnInstall","text");var b=a.q?void 0:console.log;return(0,_commons.do_exec)(cmd1,b)["finally"](function(){(0,_commons.show_msg)("YarnInstall done","text")})["catch"](function(){(0,_commons.err_unknown)("YarnInstall failed")})}var _default=exports["default"]=handle;
@@ -1 +1 @@
1
- import{do_exec,err_unknown,show_msg}from"../commons";const cmd1=["yarn run test"];export function handle(a){show_msg("YarnTest","text");const b=a.q?void 0:console.log;return do_exec(cmd1,b).finally(()=>{show_msg("YarnTest done","text")}).catch(()=>{err_unknown("YarnTest failed")})}export default handle;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),cmd1=["yarn run test"];function handle(a){(0,_commons.show_msg)("YarnTest","text");var b=a.q?void 0:console.log;return(0,_commons.do_exec)(cmd1,b)["finally"](function(){(0,_commons.show_msg)("YarnTest done","text")})["catch"](function(){(0,_commons.err_unknown)("YarnTest failed")})}var _default=exports["default"]=handle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/azcli",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cli.js",
@@ -1,51 +0,0 @@
1
- {
2
- "name": "@azrico/azcli",
3
- "version": "1.0.11",
4
- "description": "",
5
- "type": "commonjs",
6
- "main": "dist/cli.js",
7
- "scripts": {
8
- "build": "rimraf dist && tsc && babel dist --out-dir dist --presets minify",
9
- "start": "nodemon -e ts,json --exec yarn run build"
10
- },
11
- "bin": "./dist/cli.js",
12
- "files": [
13
- "dist"
14
- ],
15
- "keywords": [],
16
- "author": "Azrideus",
17
- "license": "MIT",
18
- "devDependencies": {
19
- "@babel/cli": "^7.17.10",
20
- "@babel/core": "^7.18.5",
21
- "@babel/eslint-parser": "^7.18.2",
22
- "@babel/node": "^7.18.5",
23
- "@babel/plugin-proposal-class-properties": "^7.17.12",
24
- "@babel/preset-env": "^7.18.2",
25
- "@babel/preset-typescript": "^7.17.12",
26
- "@types/chalk": "^2.2.0",
27
- "@types/clear": "^0.1.2",
28
- "@types/figlet": "^1.5.4",
29
- "@types/fs-extra": "^9.0.13",
30
- "@types/node": "^18.0.0",
31
- "babel-preset-minify": "^0.5.2",
32
- "nodemon": "^2.0.16",
33
- "tsc": "^2.0.4",
34
- "typescript": "^4.7.4"
35
- },
36
- "dependencies": {
37
- "@types/yargs": "^17.0.10",
38
- "chalk": "^4.1.2",
39
- "clear": "^0.1.0",
40
- "figlet": "^1.5.2",
41
- "fs": "^0.0.1-security",
42
- "fs-extra": "^10.1.0",
43
- "ora-classic": "^5.4.2",
44
- "os": "^0.1.2",
45
- "path": "^0.12.7",
46
- "shell-exec": "^1.1.2",
47
- "yargs": "^17.5.1",
48
- "zip-lib": "^0.7.3"
49
- },
50
- "packageManager": "yarn@3.4.1"
51
- }
@@ -1,6 +0,0 @@
1
- {
2
- "name": "@azrico/test",
3
- "devDependencies": {
4
- "adasdasd": "^7.17.10"
5
- }
6
- }
File without changes
@@ -1,6 +0,0 @@
1
- {
2
- "name": "@azrico/test",
3
- "devDependencies": {
4
- "adasdasd": "^7.17.10"
5
- }
6
- }
package/dist/package.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "name": "@azcms/core.workspace",
3
- "version": "1.10.3",
4
- "devDependencies": {
5
- "@babel/cli": "^7.17.10",
6
- "@babel/core": "^7.18.5",
7
- "@babel/eslint-parser": "^7.18.2",
8
- "@babel/node": "^7.18.5",
9
- "@babel/plugin-proposal-class-properties": "^7.17.12",
10
- "@babel/preset-env": "^7.18.2",
11
- "@babel/preset-typescript": "^7.17.12",
12
- "@types/chalk": "^2.2.0",
13
- "@types/clear": "^0.1.2",
14
- "@types/figlet": "^1.5.4",
15
- "@types/fs-extra": "^9.0.13",
16
- "@types/node": "^18.0.0",
17
- "babel-preset-minify": "^0.5.2",
18
- "nodemon": "^2.0.16",
19
- "tsc": "^2.0.4",
20
- "typescript": "^4.7.4"
21
- },
22
- "dependencies": {
23
- "@types/yargs": "^17.0.10",
24
- "chalk": "^4.1.2",
25
- "clear": "^0.1.0",
26
- "figlet": "^1.5.2",
27
- "fs": "^0.0.1-security",
28
- "fs-extra": "^10.1.0",
29
- "ora-classic": "^5.4.2",
30
- "os": "^0.1.2",
31
- "path": "^0.12.7",
32
- "shell-exec": "^1.1.2",
33
- "yargs": "^17.5.1",
34
- "zip-lib": "^0.7.3"
35
- },
36
- "packageManager": "yarn@3.4.1"
37
- }
File without changes
@@ -1,9 +0,0 @@
1
- {
2
- "name": "@azrico/test",
3
- "devDependencies": {
4
- "@babel/cli": "^7.17.10"
5
- },
6
- "dependencies": {
7
- "@types/yargs": "^17.0.10"
8
- }
9
- }