@azrico/azcli 1.1.45 → 1.1.46
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 +2 -54
- package/dist/libs/builder/build_wp.js +1 -113
- package/dist/libs/builder/build_yarn.js +1 -11
- package/dist/libs/builder/index.js +1 -21
- package/dist/libs/cleaner/cleanbuild.js +1 -12
- package/dist/libs/cleaner/cleannext.js +1 -12
- package/dist/libs/cleaner/cleannode.js +1 -21
- package/dist/libs/cleaner/index.js +1 -37
- package/dist/libs/commons/filehandler.js +4 -60
- package/dist/libs/commons/helper_exec.js +2 -48
- package/dist/libs/commons/helper_interface.js +4 -96
- package/dist/libs/commons/helper_string.js +1 -15
- package/dist/libs/commons/index.js +1 -5
- package/dist/libs/integ/index.js +1 -7
- package/dist/libs/integ/integ_readme.js +1 -6
- package/dist/libs/packager/index.js +1 -18
- package/dist/libs/packager/packager.js +9 -236
- package/dist/libs/up/filterOptionsByAcceptable.js +2 -16
- package/dist/libs/up/index.js +1 -35
- package/dist/libs/up/update_composer.js +1 -53
- package/dist/libs/up/update_py.js +1 -10
- package/dist/libs/up/update_yarn.js +2 -78
- package/dist/libs/yarnhelp/index.js +1 -8
- package/dist/libs/yarnhelp/yarnb.js +1 -14
- package/dist/libs/yarnhelp/yarni.js +1 -14
- package/dist/libs/yarnhelp/yarnt.js +1 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* -------------------------------------------------------------------------- */
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import figlet from 'figlet';
|
|
5
|
-
import { hideBin } from 'yargs/helpers';
|
|
6
|
-
import yargs from 'yargs';
|
|
7
|
-
/* -------------------------------------------------------------------------- */
|
|
8
|
-
/* Consts */
|
|
9
|
-
/* -------------------------------------------------------------------------- */
|
|
10
|
-
const header = chalk.red(figlet.textSync('Az-cli', { font: 'Cyberlarge', horizontalLayout: 'full' }));
|
|
11
|
-
/* -------------------------------------------------------------------------- */
|
|
12
|
-
/* Helper functions */
|
|
13
|
-
/* -------------------------------------------------------------------------- */
|
|
14
|
-
function loadCommands(yinstance, commandList) {
|
|
15
|
-
if (!yinstance)
|
|
16
|
-
return;
|
|
17
|
-
if (Array.isArray(commandList)) {
|
|
18
|
-
if (Array.isArray(commandList[0])) {
|
|
19
|
-
//2D Command
|
|
20
|
-
commandList.forEach((sub_cmd) => {
|
|
21
|
-
loadCommands(yinstance, sub_cmd);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
yinstance.command(commandList[0], commandList[1], commandList[2], commandList[3]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/* -------------------------------------------------------------------------- */
|
|
30
|
-
/* Start */
|
|
31
|
-
/* -------------------------------------------------------------------------- */
|
|
32
|
-
const yg = yargs(hideBin(process.argv));
|
|
33
|
-
yg.usage(header);
|
|
34
|
-
/* -------------------------------------------------------------------------- */
|
|
35
|
-
import builder from './libs/builder';
|
|
36
|
-
import cleaner from './libs/cleaner';
|
|
37
|
-
import yarnhelp from './libs/yarnhelp';
|
|
38
|
-
import packager from './libs/packager';
|
|
39
|
-
import updater from './libs/up';
|
|
40
|
-
loadCommands(yg, builder);
|
|
41
|
-
loadCommands(yg, cleaner);
|
|
42
|
-
loadCommands(yg, yarnhelp);
|
|
43
|
-
loadCommands(yg, packager);
|
|
44
|
-
loadCommands(yg, updater);
|
|
45
|
-
/* -------------------------------------------------------------------------- */
|
|
46
|
-
yg.demandCommand(1).options({
|
|
47
|
-
quiet: {
|
|
48
|
-
alias: ['q', 's'],
|
|
49
|
-
describe: 'quiet mode',
|
|
50
|
-
demandOption: false,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
/* -------------------------------------------------------------------------- */
|
|
54
|
-
const ygresult = yg.parse();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* -------------------------------------------------------------------------- */"use strict";var _chalk=_interopRequireDefault(require("chalk")),_figlet=_interopRequireDefault(require("figlet")),_helpers=require("yargs/helpers"),_yargs=_interopRequireDefault(require("yargs")),_builder=_interopRequireDefault(require("./libs/builder")),_cleaner=_interopRequireDefault(require("./libs/cleaner")),_yarnhelp=_interopRequireDefault(require("./libs/yarnhelp")),_packager=_interopRequireDefault(require("./libs/packager")),_up=_interopRequireDefault(require("./libs/up"));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,_builder["default"]),loadCommands(yg,_cleaner["default"]),loadCommands(yg,_yarnhelp["default"]),loadCommands(yg,_packager["default"]),loadCommands(yg,_up["default"]),yg.demandCommand(1).options({quiet:{alias:["q","s"],describe:"quiet mode",demandOption:!1}});/* -------------------------------------------------------------------------- */var ygresult=yg.parse();
|
|
@@ -1,113 +1 @@
|
|
|
1
|
-
/* This lib helps you build a wordpress plugin */
|
|
2
|
-
import { cpfile, mkdirIfNotExists, rmIfExists, run_fn_on_dir, search_delete, show_div, show_error, show_msg, } from '../commons';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import os from 'os';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import { update_composer } from '../up/update_composer';
|
|
8
|
-
const zl = require('zip-lib');
|
|
9
|
-
const ignored_files = [
|
|
10
|
-
'wp-content',
|
|
11
|
-
'node_modules',
|
|
12
|
-
'package.json',
|
|
13
|
-
'.gitignore',
|
|
14
|
-
'.git',
|
|
15
|
-
'tsconfig.json',
|
|
16
|
-
'yarn.lock',
|
|
17
|
-
'yarn-error.log',
|
|
18
|
-
'cache',
|
|
19
|
-
'temp',
|
|
20
|
-
'build',
|
|
21
|
-
'dist',
|
|
22
|
-
'doc',
|
|
23
|
-
'docs',
|
|
24
|
-
'documents',
|
|
25
|
-
'documentation',
|
|
26
|
-
];
|
|
27
|
-
const files_to_delete = [
|
|
28
|
-
'vendor/**/.git',
|
|
29
|
-
'vendor/**/doxygen.config',
|
|
30
|
-
'vendor/**/doxygen',
|
|
31
|
-
];
|
|
32
|
-
export async function handle(args) {
|
|
33
|
-
show_msg('Building WP Plugin', 'text');
|
|
34
|
-
const windows_tmpdir = os.tmpdir(); // /tmp
|
|
35
|
-
const homeDir = os.homedir(); // See: https://www.npmjs.com/package/os
|
|
36
|
-
const currentDir = path.resolve('./');
|
|
37
|
-
const currentFolderName = path.basename(currentDir);
|
|
38
|
-
/* -------------------------------------------------------------------------- */
|
|
39
|
-
const localBuildDir = path.resolve(currentDir, `build`);
|
|
40
|
-
const tempDir = path.resolve(windows_tmpdir, currentFolderName);
|
|
41
|
-
const desktopDir = path.resolve(homeDir, 'Desktop');
|
|
42
|
-
const destinationPath = path.resolve(desktopDir, 'Build');
|
|
43
|
-
const resultFile = path.resolve(destinationPath, currentFolderName + '.zip');
|
|
44
|
-
show_div();
|
|
45
|
-
show_msg(chalk.gray('Plugin Name :') + ' ' + chalk.blue(currentFolderName));
|
|
46
|
-
show_msg(chalk.gray('Temp Dir :') + ' ' + chalk.gray(tempDir));
|
|
47
|
-
show_msg(chalk.gray('Temp Dir :') + ' ' + chalk.gray(tempDir));
|
|
48
|
-
show_msg(chalk.gray('Local Build :') + ' ' + chalk.gray(localBuildDir));
|
|
49
|
-
show_div();
|
|
50
|
-
try {
|
|
51
|
-
show_msg(chalk.gray('Removing old build files...'));
|
|
52
|
-
rmIfExists(localBuildDir);
|
|
53
|
-
rmIfExists(tempDir);
|
|
54
|
-
show_msg(chalk.gray('Creating folders...'));
|
|
55
|
-
mkdirIfNotExists(destinationPath);
|
|
56
|
-
mkdirIfNotExists(tempDir);
|
|
57
|
-
mkdirIfNotExists(localBuildDir);
|
|
58
|
-
const currentFiles = fs.readdirSync(currentDir);
|
|
59
|
-
show_msg(chalk.white('Copy all local files to temp path') +
|
|
60
|
-
' ' +
|
|
61
|
-
chalk.gray('[') +
|
|
62
|
-
chalk.blue(currentFiles.length) +
|
|
63
|
-
chalk.gray(']'));
|
|
64
|
-
const ignored_files_list = ignored_files.map((r) => path.resolve(currentDir, r));
|
|
65
|
-
const currentFilesList = currentFiles.map((r) => path.resolve(currentDir, r));
|
|
66
|
-
for (let index = 0; index < currentFilesList.length; index++) {
|
|
67
|
-
const cf = currentFilesList[index];
|
|
68
|
-
const file_name = path.basename(cf).trim();
|
|
69
|
-
if (ignored_files_list.includes(cf) || ignored_files.includes(file_name)) {
|
|
70
|
-
show_msg(chalk.red('ignore: ' + cf), 'text', false);
|
|
71
|
-
}
|
|
72
|
-
else if (cpfile(cf, tempDir)) {
|
|
73
|
-
show_msg(chalk.gray('copy: ' + cf), 'text', false);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
show_msg(chalk.red('error: ' + cf), 'text', false);
|
|
77
|
-
show_msg(`cant copy the file: ${file_name}`, 'text', false);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/* -------------------------- delete all git files -------------------------- */
|
|
81
|
-
show_msg(chalk.white('delete git files:'));
|
|
82
|
-
for (let index = 0; index < files_to_delete.length; index++) {
|
|
83
|
-
const fdel = path.join(tempDir, files_to_delete[index]);
|
|
84
|
-
const res = await search_delete(fdel);
|
|
85
|
-
show_msg(chalk.gray(`del: ${fdel} -> ${res}`), 'text', false);
|
|
86
|
-
}
|
|
87
|
-
/* ----------------------------- Update Packages ---------------------------- */
|
|
88
|
-
if (!args.noupdate) {
|
|
89
|
-
await run_fn_on_dir(tempDir, async () => {
|
|
90
|
-
await update_composer({ ...args, prod: true });
|
|
91
|
-
});
|
|
92
|
-
show_msg(chalk.white('Update Composer packages...'));
|
|
93
|
-
}
|
|
94
|
-
/* ------------------------------ Create Zip ------------------------------- */
|
|
95
|
-
show_msg(chalk.white('Zip files and copy to destination'));
|
|
96
|
-
show_msg(chalk.white(`copy:`), 'none', false);
|
|
97
|
-
show_msg(chalk.gray(tempDir), 'none', false);
|
|
98
|
-
show_msg(chalk.white(' -> '), 'none', false);
|
|
99
|
-
show_msg(chalk.gray(resultFile), 'none', false);
|
|
100
|
-
await zl.archiveFolder(tempDir, resultFile);
|
|
101
|
-
show_msg(chalk.white('Zip done'));
|
|
102
|
-
if (args.cleanup != 'false') {
|
|
103
|
-
show_msg(chalk.white('Clean up'));
|
|
104
|
-
rmIfExists(tempDir);
|
|
105
|
-
}
|
|
106
|
-
cpfile(resultFile, localBuildDir);
|
|
107
|
-
}
|
|
108
|
-
catch (ex) {
|
|
109
|
-
show_error(ex);
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
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")),_update_composer=require("../up/update_composer");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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(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))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(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/* This lib helps you build a wordpress plugin */var zl=require("zip-lib"),ignored_files=["wp-content","node_modules","package.json",".gitignore",".git","tsconfig.json","yarn.lock","yarn-error.log","cache","temp","build","dist","doc","docs","documents","documentation"],files_to_delete=["vendor/**/.git","vendor/**/doxygen.config","vendor/**/doxygen"];function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;return _regeneratorRuntime().wrap(function u(b){for(;1;)switch(b.prev=b.next){case 0:for((0,_commons.show_msg)("Building WP Plugin","text"),c=_os["default"].tmpdir(),d=_os["default"].homedir(),e=_path["default"].resolve("./"),f=_path["default"].basename(e),g=_path["default"].resolve(e,"build"),h=_path["default"].resolve(c,f),i=_path["default"].resolve(d,"Desktop"),j=_path["default"].resolve(i,"Build"),k=_path["default"].resolve(j,f+".zip"),(0,_commons.show_div)(),(0,_commons.show_msg)(_chalk["default"].gray("Plugin Name :")+" "+_chalk["default"].blue(f)),(0,_commons.show_msg)(_chalk["default"].gray("Temp Dir :")+" "+_chalk["default"].gray(h)),(0,_commons.show_msg)(_chalk["default"].gray("Temp Dir :")+" "+_chalk["default"].gray(h)),(0,_commons.show_msg)(_chalk["default"].gray("Local Build :")+" "+_chalk["default"].gray(g)),(0,_commons.show_div)(),b.prev=16,(0,_commons.show_msg)(_chalk["default"].gray("Removing old build files...")),(0,_commons.rmIfExists)(g),(0,_commons.rmIfExists)(h),(0,_commons.show_msg)(_chalk["default"].gray("Creating folders...")),(0,_commons.mkdirIfNotExists)(j),(0,_commons.mkdirIfNotExists)(h),(0,_commons.mkdirIfNotExists)(g),l=_fs["default"].readdirSync(e),(0,_commons.show_msg)(_chalk["default"].white("Copy all local files to temp path")+" "+_chalk["default"].gray("[")+_chalk["default"].blue(l.length)+_chalk["default"].gray("]")),m=ignored_files.map(function(a){return _path["default"].resolve(e,a)}),n=l.map(function(a){return _path["default"].resolve(e,a)}),o=0;o<n.length;o++)p=n[o],q=_path["default"].basename(p).trim(),m.includes(p)||ignored_files.includes(q)?(0,_commons.show_msg)(_chalk["default"].red("ignore: "+p),"text",!1):(0,_commons.cpfile)(p,h)?(0,_commons.show_msg)(_chalk["default"].gray("copy: "+p),"text",!1):((0,_commons.show_msg)(_chalk["default"].red("error: "+p),"text",!1),(0,_commons.show_msg)("cant copy the file: ".concat(q),"text",!1));/* -------------------------- delete all git files -------------------------- */(0,_commons.show_msg)(_chalk["default"].white("delete git files:")),r=0;case 31:if(!(r<files_to_delete.length)){b.next=40;break}return s=_path["default"].join(h,files_to_delete[r]),b.next=35,(0,_commons.search_delete)(s);case 35:t=b.sent,(0,_commons.show_msg)(_chalk["default"].gray("del: ".concat(s," -> ").concat(t)),"text",!1);case 37:r++,b.next=31;break;case 40:if(a.noupdate){b.next=44;break}return b.next=43,(0,_commons.run_fn_on_dir)(h,/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(){return _regeneratorRuntime().wrap(function c(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,(0,_update_composer.update_composer)(_objectSpread(_objectSpread({},a),{},{prod:!0}));case 2:case"end":return b.stop()}},b)})));case 43:(0,_commons.show_msg)(_chalk["default"].white("Update Composer packages..."));case 44:return(0,_commons.show_msg)(_chalk["default"].white("Zip files and copy to destination")),(0,_commons.show_msg)(_chalk["default"].white("copy:"),"none",!1),(0,_commons.show_msg)(_chalk["default"].gray(h),"none",!1),(0,_commons.show_msg)(_chalk["default"].white(" -> "),"none",!1),(0,_commons.show_msg)(_chalk["default"].gray(k),"none",!1),b.next=51,zl.archiveFolder(h,k);case 51:(0,_commons.show_msg)(_chalk["default"].white("Zip done")),"false"!=a.cleanup&&((0,_commons.show_msg)(_chalk["default"].white("Clean up")),(0,_commons.rmIfExists)(h)),(0,_commons.cpfile)(k,g),b.next=60;break;case 56:return b.prev=56,b.t0=b["catch"](16),(0,_commons.show_error)(b.t0),b.abrupt("return",!1);case 60:case"end":return b.stop()}},b,null,[[16,56]])})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
/* This lib helps you build a wordpress plugin */
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { do_exec, show_msg } from '../commons';
|
|
4
|
-
export async function handle(args) {
|
|
5
|
-
show_msg(chalk.gray(`Building Yarn`), 'text', false);
|
|
6
|
-
const res = await do_exec([`yarn run build`]);
|
|
7
|
-
show_msg(res.stdout, 'text', false);
|
|
8
|
-
show_msg(chalk.gray(`Done`), 'text', false);
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
export default handle;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _chalk=_interopRequireDefault(require("chalk")),_commons=require("../commons");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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/* This lib helps you build a wordpress plugin */function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_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)(_chalk["default"].gray("Building Yarn"),"text",!1),a.next=3,(0,_commons.do_exec)(["yarn run build"]);case 3:return b=a.sent,(0,_commons.show_msg)(b.stdout,"text",!1),(0,_commons.show_msg)(_chalk["default"].gray("Done"),"text",!1),a.abrupt("return",!0);case 7:case"end":return a.stop()}},a)})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
/* Automatically integrates tools */
|
|
2
|
-
import { getProjectType, loadProjectType, show_error, show_msg, } from '../commons';
|
|
3
|
-
import build_wp from './build_wp';
|
|
4
|
-
import build_yarn from './build_yarn';
|
|
5
|
-
export async function handle(args) {
|
|
6
|
-
try {
|
|
7
|
-
loadProjectType(args);
|
|
8
|
-
switch (getProjectType(args)) {
|
|
9
|
-
case 'php':
|
|
10
|
-
return await build_wp(args);
|
|
11
|
-
case 'yarn':
|
|
12
|
-
return await build_yarn(args);
|
|
13
|
-
default:
|
|
14
|
-
return show_msg('no build steps for this project type', 'text');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
catch (ex) {
|
|
18
|
-
return show_error(ex);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export default [['build <mode>', 'Build helper', () => { }, handle]];
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _commons=require("../commons"),_build_wp=_interopRequireDefault(require("./build_wp")),_build_yarn=_interopRequireDefault(require("./build_yarn"));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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/* Automatically integrates tools */function handle(){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:b.prev=0,(0,_commons.loadProjectType)(a),b.t0=(0,_commons.getProjectType)(a),b.next="php"===b.t0?5:"yarn"===b.t0?8:11;break;case 5:return b.next=7,(0,_build_wp["default"])(a);case 7:return b.abrupt("return",b.sent);case 8:return b.next=10,(0,_build_yarn["default"])(a);case 10:return b.abrupt("return",b.sent);case 11:return b.abrupt("return",(0,_commons.show_msg)("no build steps for this project type","text"));case 12:b.next=17;break;case 14:return b.prev=14,b.t1=b["catch"](0),b.abrupt("return",(0,_commons.show_error)(b.t1));case 17:case"end":return b.stop()}},b,null,[[0,14]])})),_handle.apply(this,arguments)}var _default=exports["default"]=[["build <mode>","Build helper",function(){},handle]];
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
/* This lib helps you build a wordpress plugin */
|
|
2
|
-
import { rimraf } from 'rimraf';
|
|
3
|
-
import { show_error, show_msg } from '../commons';
|
|
4
|
-
export async function handle(args) {
|
|
5
|
-
show_msg('Cleaning up build & dist files', 'text');
|
|
6
|
-
if ((await rimraf('build')) && (await rimraf('dist'))) {
|
|
7
|
-
show_msg('Build cleanup done', 'text');
|
|
8
|
-
}
|
|
9
|
-
else
|
|
10
|
-
show_error('Build cleanup failed');
|
|
11
|
-
}
|
|
12
|
-
export default handle;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _rimraf=require("rimraf"),_commons=require("../commons");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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/* This lib helps you build a wordpress plugin */function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:return(0,_commons.show_msg)("Cleaning up build & dist files","text"),a.next=3,(0,_rimraf.rimraf)("build");case 3:if(a.t0=a.sent,!a.t0){a.next=8;break}return a.next=7,(0,_rimraf.rimraf)("dist");case 7:a.t0=a.sent;case 8:if(!a.t0){a.next=12;break}(0,_commons.show_msg)("Build cleanup done","text"),a.next=13;break;case 12:(0,_commons.show_error)("Build cleanup failed");case 13:case"end":return a.stop()}},a)})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
/* This lib helps you build a wordpress plugin */
|
|
2
|
-
import { rimraf } from 'rimraf';
|
|
3
|
-
import { show_error, show_msg } from '../commons';
|
|
4
|
-
export async function handle(args) {
|
|
5
|
-
show_msg('Cleaning up next files', 'text');
|
|
6
|
-
if (await rimraf('.next')) {
|
|
7
|
-
show_msg('next cleanup done', 'text');
|
|
8
|
-
}
|
|
9
|
-
else
|
|
10
|
-
show_error('next cleanup failed');
|
|
11
|
-
}
|
|
12
|
-
export default handle;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=void 0,exports.handle=handle;var _rimraf=require("rimraf"),_commons=require("../commons");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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/* This lib helps you build a wordpress plugin */function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:return(0,_commons.show_msg)("Cleaning up next files","text"),a.next=3,(0,_rimraf.rimraf)(".next");case 3:if(!a.sent){a.next=7;break}(0,_commons.show_msg)("next cleanup done","text"),a.next=8;break;case 7:(0,_commons.show_error)("next cleanup failed");case 8:case"end":return a.stop()}},a)})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
/* This lib helps you build a wordpress plugin */
|
|
2
|
-
import { err_unknown, search_delete, show_msg } from '../commons';
|
|
3
|
-
export async function handle(args) {
|
|
4
|
-
try {
|
|
5
|
-
show_msg('Cleaning up node_module', 'text');
|
|
6
|
-
await search_delete('./node_modules');
|
|
7
|
-
await search_delete(' ./**/node_modules');
|
|
8
|
-
show_msg('Cleaning up cache files', 'text');
|
|
9
|
-
await search_delete('.yarn/cache');
|
|
10
|
-
await search_delete('./**/.yarn/cache');
|
|
11
|
-
await search_delete('./**/.jest/cache');
|
|
12
|
-
show_msg('Cleaning up lock files', 'text');
|
|
13
|
-
await search_delete('./**/yarn.lock');
|
|
14
|
-
await search_delete('./**/package-lock.json');
|
|
15
|
-
show_msg('Node cleanup done', 'text');
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
err_unknown('cleanup failed');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/* This lib helps you build a wordpress plugin */function handle(){return _handle.apply(this,arguments)}function _handle(){return _handle=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function a(){return _regeneratorRuntime().wrap(function b(a){for(;1;)switch(a.prev=a.next){case 0:return a.prev=0,(0,_commons.show_msg)("Cleaning up node_module","text"),a.next=4,(0,_commons.search_delete)("./node_modules");case 4:return a.next=6,(0,_commons.search_delete)(" ./**/node_modules");case 6:return(0,_commons.show_msg)("Cleaning up cache files","text"),a.next=9,(0,_commons.search_delete)(".yarn/cache");case 9:return a.next=11,(0,_commons.search_delete)("./**/.yarn/cache");case 11:return a.next=13,(0,_commons.search_delete)("./**/.jest/cache");case 13:return(0,_commons.show_msg)("Cleaning up lock files","text"),a.next=16,(0,_commons.search_delete)("./**/yarn.lock");case 16:return a.next=18,(0,_commons.search_delete)("./**/package-lock.json");case 18:(0,_commons.show_msg)("Node cleanup done","text"),a.next=24;break;case 21:a.prev=21,a.t0=a["catch"](0),(0,_commons.err_unknown)("cleanup failed");case 24:case"end":return a.stop()}},a,null,[[0,21]])})),_handle.apply(this,arguments)}var _default=exports["default"]=handle;
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
/* Automatically integrates tools */
|
|
2
|
-
import { err_unknown, err_unknown_action, loadProjectType, show_div } from '../commons';
|
|
3
|
-
import cleanbuild from './cleanbuild';
|
|
4
|
-
import cleannode from './cleannode';
|
|
5
|
-
import cleannext from './cleannext';
|
|
6
|
-
export async function handle(args) {
|
|
7
|
-
loadProjectType();
|
|
8
|
-
try {
|
|
9
|
-
const mode = args.mode ?? '';
|
|
10
|
-
switch (mode) {
|
|
11
|
-
case 'build':
|
|
12
|
-
await cleanbuild(args);
|
|
13
|
-
break;
|
|
14
|
-
case 'node':
|
|
15
|
-
await cleannode(args);
|
|
16
|
-
break;
|
|
17
|
-
case 'next':
|
|
18
|
-
cleannext(args);
|
|
19
|
-
break;
|
|
20
|
-
case 'all':
|
|
21
|
-
await cleanbuild(args);
|
|
22
|
-
show_div();
|
|
23
|
-
await cleannode(args);
|
|
24
|
-
show_div();
|
|
25
|
-
await cleannext(args);
|
|
26
|
-
break;
|
|
27
|
-
case '':
|
|
28
|
-
default:
|
|
29
|
-
err_unknown_action(args);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (ex) {
|
|
34
|
-
err_unknown('unknown error');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/* 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:(0,_commons.loadProjectType)(),b.prev=1,d=null!==(c=a.mode)&&void 0!==c?c:"",b.t0=d,b.next="build"===b.t0?6:"node"===b.t0?9:"next"===b.t0?12:"all"===b.t0?14:""===b.t0?23:23;break;case 6:return b.next=8,(0,_cleanbuild["default"])(a);case 8:return b.abrupt("break",25);case 9:return b.next=11,(0,_cleannode["default"])(a);case 11:return b.abrupt("break",25);case 12:return(0,_cleannext["default"])(a),b.abrupt("break",25);case 14:return b.next=16,(0,_cleanbuild["default"])(a);case 16:return(0,_commons.show_div)(),b.next=19,(0,_cleannode["default"])(a);case 19:return(0,_commons.show_div)(),b.next=22,(0,_cleannext["default"])(a);case 22:return b.abrupt("break",25);case 23:return(0,_commons.err_unknown_action)(a),b.abrupt("break",25);case 25:b.next=30;break;case 27:b.prev=27,b.t1=b["catch"](1),(0,_commons.err_unknown)("unknown error");case 30:case"end":return b.stop()}},b,null,[[1,27]])})),_handle.apply(this,arguments)}var _default=exports["default"]=[["clean <mode>","Modes: node,build,next,all",function(){},handle]];
|
|
@@ -1,61 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import fsextra from 'fs-extra';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { show_error, show_msg } from './helper_interface';
|
|
5
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.cpfile=cpfile,exports.mkdirIfNotExists=mkdirIfNotExists,exports.path_resolve_args=path_resolve_args,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 _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)}/**
|
|
6
2
|
* Resolve path with args.path if exists
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return '';
|
|
11
|
-
if (typeof args === 'object' && args != null && args.path && args.path.length > 0)
|
|
12
|
-
return path.resolve(args.path, p);
|
|
13
|
-
return p;
|
|
14
|
-
}
|
|
15
|
-
export function rmIfExists(rm_path, log = false) {
|
|
16
|
-
if (!fs.existsSync(rm_path))
|
|
17
|
-
return false;
|
|
18
|
-
const fullpath = path.resolve(rm_path);
|
|
19
|
-
const isDir = fs.lstatSync(fullpath).isDirectory();
|
|
20
|
-
if (!isDir)
|
|
21
|
-
fs.unlinkSync(fullpath);
|
|
22
|
-
else
|
|
23
|
-
fs.rmSync(fullpath, { recursive: true, force: true });
|
|
24
|
-
if (log)
|
|
25
|
-
show_msg('rm: ' + fullpath, 'danger');
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
export function mkdirIfNotExists(rm_path, log = false) {
|
|
29
|
-
const fullpath = path.resolve(rm_path);
|
|
30
|
-
if (!fs.existsSync(fullpath)) {
|
|
31
|
-
fs.mkdirSync(fullpath);
|
|
32
|
-
if (log)
|
|
33
|
-
show_msg('rm: ' + fullpath, 'danger');
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
export function readIfExists(dir = './package.json') {
|
|
39
|
-
if (!fs.existsSync(dir)) {
|
|
40
|
-
throw show_error('file does not exists: ' + dir);
|
|
41
|
-
}
|
|
42
|
-
return fs.readFileSync(dir);
|
|
43
|
-
}
|
|
44
|
-
export function cpfile(fromPath, toPath) {
|
|
45
|
-
if (!fs.existsSync(fromPath))
|
|
46
|
-
return false;
|
|
47
|
-
if (path.basename(fromPath).startsWith('.'))
|
|
48
|
-
return false; //cant copy hiddens
|
|
49
|
-
if (fs.existsSync(toPath)) {
|
|
50
|
-
const isDir = fs.lstatSync(toPath).isDirectory();
|
|
51
|
-
if (isDir) {
|
|
52
|
-
//targetPath is a directory
|
|
53
|
-
const mfileName = path.basename(fromPath);
|
|
54
|
-
toPath = path.resolve(toPath, mfileName);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (fromPath === toPath)
|
|
58
|
-
return false;
|
|
59
|
-
fsextra.copySync(fromPath, toPath);
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
3
|
+
*/function path_resolve_args(a,b){return a?"object"===_typeof(b)&&null!=b&&b.path&&0<b.path.length?_path["default"].resolve(b.path,a):a:""}function rmIfExists(a){var b=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];if(!_fs["default"].existsSync(a))return!1;var c=_path["default"].resolve(a),d=_fs["default"].lstatSync(c).isDirectory();return d?_fs["default"].rmSync(c,{recursive:!0,force:!0}):_fs["default"].unlinkSync(c),b&&(0,_helper_interface.show_msg)("rm: "+c,"danger"),!0}function mkdirIfNotExists(a){var b=!!(1<arguments.length&&arguments[1]!==void 0)&&arguments[1],c=_path["default"].resolve(a);return!_fs["default"].existsSync(c)&&(_fs["default"].mkdirSync(c),b&&(0,_helper_interface.show_msg)("rm: "+c,"danger"),!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
|
|
4
|
+
if(_fs["default"].existsSync(b)){var c=_fs["default"].lstatSync(b).isDirectory();if(c){//targetPath is a directory
|
|
5
|
+
var d=_path["default"].basename(a);b=_path["default"].resolve(b,d)}}return a!==b&&(_fsExtra["default"].copySync(a,b),!0)}
|
|
@@ -1,49 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import { rimraf } from 'rimraf';
|
|
3
|
-
import { err_unknown, show_msg } from '../commons';
|
|
4
|
-
import shellExec from 'shell-exec';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.do_exec=do_exec,exports.run_fn_on_dir=run_fn_on_dir,exports.search_delete=search_delete;var _rimraf=require("rimraf"),_commons=require("../commons"),_shellExec=_interopRequireDefault(require("shell-exec")),_chalk=_interopRequireDefault(require("chalk"));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(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(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(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function(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(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(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(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(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(a,b,c){return this.delegate={iterator:C(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=D),G}},h}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}/**
|
|
7
2
|
* Run a function in a specific directory and return to the old directory
|
|
8
|
-
*/
|
|
9
|
-
export async function run_fn_on_dir(ch_dir, fn, ...args) {
|
|
10
|
-
let old_dir = process.cwd();
|
|
11
|
-
if (ch_dir) {
|
|
12
|
-
show_msg(chalk.white('switch dir: ') + chalk.gray(ch_dir));
|
|
13
|
-
process.chdir(ch_dir);
|
|
14
|
-
}
|
|
15
|
-
const res = await fn(...args);
|
|
16
|
-
if (old_dir) {
|
|
17
|
-
process.chdir(old_dir);
|
|
18
|
-
show_msg(chalk.white('switch dir: ') + chalk.gray(old_dir));
|
|
19
|
-
}
|
|
20
|
-
return res;
|
|
21
|
-
}
|
|
22
|
-
export async function do_exec(cmd, ch_dir = '') {
|
|
23
|
-
const str_cmd = Array.isArray(cmd) ? cmd.join(' ') : cmd;
|
|
24
|
-
if (!str_cmd || str_cmd.length <= 0)
|
|
25
|
-
return Promise.reject(new Error());
|
|
26
|
-
const shellcmd = shellExec(str_cmd);
|
|
27
|
-
shellcmd.then((r) => {
|
|
28
|
-
if (r.error) {
|
|
29
|
-
err_unknown('Error : ' + r.error.message);
|
|
30
|
-
}
|
|
31
|
-
// if (stdout && r.stdout) {
|
|
32
|
-
// stdout(r.stdout);
|
|
33
|
-
// }
|
|
34
|
-
// if (stderr && r.stderr) {
|
|
35
|
-
// stderr(r.stderr);
|
|
36
|
-
// }
|
|
37
|
-
});
|
|
38
|
-
// if (onclose) shellcmd.finally(onclose);
|
|
39
|
-
shellcmd.catch((err) => {
|
|
40
|
-
err_unknown('Error on execution');
|
|
41
|
-
});
|
|
42
|
-
return await shellcmd;
|
|
43
|
-
}
|
|
44
|
-
export async function search_delete(folder, search = '') {
|
|
45
|
-
// const cmd = `Get-ChildItem -Path "${folder}" -Recurse -Directory -Force -Filter "${search}" | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue`;
|
|
46
|
-
const delfile = search.length > 0 ? `/**/${search}` : '';
|
|
47
|
-
const final_path = String(`${folder}${delfile}`).replaceAll('\\', '/');
|
|
48
|
-
return await rimraf(final_path, { glob: true });
|
|
49
|
-
}
|
|
3
|
+
*/function run_fn_on_dir(){return _run_fn_on_dir.apply(this,arguments)}function _run_fn_on_dir(){return _run_fn_on_dir=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function c(a,b){var d,e,f,g,h,i=arguments;return _regeneratorRuntime().wrap(function j(c){for(;1;)switch(c.prev=c.next){case 0:for(d=process.cwd(),a&&((0,_commons.show_msg)(_chalk["default"].white("\uD83D\uDCC2 switch dir: ")+_chalk["default"].gray(a)),process.chdir(a)),e=i.length,f=Array(2<e?e-2:0),g=2;g<e;g++)f[g-2]=i[g];return c.next=5,b.apply(void 0,f);case 5:return h=c.sent,d&&(process.chdir(d),(0,_commons.show_msg)(_chalk["default"].white("\uD83D\uDCC2 switch dir: ")+_chalk["default"].gray(d))),c.abrupt("return",h);case 8:case"end":return c.stop()}},c)})),_run_fn_on_dir.apply(this,arguments)}function do_exec(a,b,c,d){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)}function search_delete(a){return _search_delete.apply(this,arguments)}function _search_delete(){return _search_delete=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function b(a){var c,d,e,f=arguments;return _regeneratorRuntime().wrap(function g(b){for(;1;)switch(b.prev=b.next){case 0:return c=1<f.length&&void 0!==f[1]?f[1]:"",d=0<c.length?"/**/".concat(c):"",e=("".concat(a).concat(d)+"").replaceAll("\\","/"),b.next=5,(0,_rimraf.rimraf)(e,{glob:!0});case 5:return b.abrupt("return",b.sent);case 6:case"end":return b.stop()}},b)})),_search_delete.apply(this,arguments)}
|