qcobjects-cli 2.5.103-beta → 2.5.104-beta
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/VERSION +1 -1
- package/build-esbuild.js +4 -3
- package/package.json +55 -21
- package/public/browser/com.qcobjects.cli.commands.jira.client_services.js +66 -55
- package/public/browser/com.qcobjects.cli.commands.jira.client_services.js.map +2 -2
- package/public/browser/com.qcobjects.cli.commands.jira.js +138 -93
- package/public/browser/com.qcobjects.cli.commands.jira.js.map +4 -4
- package/public/browser/com.qcobjects.cli.commands.js +371 -14
- package/public/browser/com.qcobjects.cli.commands.js.map +4 -4
- package/public/browser/com.qcobjects.cli.commands.version.js +220 -214
- package/public/browser/com.qcobjects.cli.commands.version.js.map +2 -2
- package/public/browser/index.js +4042 -13
- package/public/browser/index.js.map +4 -4
- package/public/browser/org.qcobjects.common.pipelog.js +37 -24
- package/public/browser/org.qcobjects.common.pipelog.js.map +2 -2
- package/public/browser/org.qcobjects.enterprise.commands.js +108 -117
- package/public/browser/org.qcobjects.enterprise.commands.js.map +3 -3
- package/public/browser/org.quickcorp.qcobjects.api.client_services.js +64 -55
- package/public/browser/org.quickcorp.qcobjects.api.client_services.js.map +2 -2
- package/public/browser/org.quickcorp.qcobjects.cli.js +1280 -379
- package/public/browser/org.quickcorp.qcobjects.cli.js.map +4 -4
- package/public/browser/org.quickcorp.qcobjects.defaultsettings.js +373 -359
- package/public/browser/org.quickcorp.qcobjects.defaultsettings.js.map +2 -2
- package/public/browser/qcobjects-cli.js +4042 -13
- package/public/browser/qcobjects-cli.js.map +4 -4
- package/public/cjs/com.qcobjects.cli.commands.cjs +377 -6
- package/public/cjs/com.qcobjects.cli.commands.cjs.map +4 -4
- package/public/cjs/com.qcobjects.cli.commands.jira.cjs +82 -24
- package/public/cjs/com.qcobjects.cli.commands.jira.cjs.map +4 -4
- package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs +25 -1
- package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs.map +2 -2
- package/public/cjs/com.qcobjects.cli.commands.version.cjs +25 -6
- package/public/cjs/com.qcobjects.cli.commands.version.cjs.map +2 -2
- package/public/cjs/index.cjs +4042 -13
- package/public/cjs/index.cjs.map +4 -4
- package/public/cjs/org.qcobjects.common.pipelog.cjs +40 -14
- package/public/cjs/org.qcobjects.common.pipelog.cjs.map +2 -2
- package/public/cjs/org.qcobjects.enterprise.commands.cjs +38 -34
- package/public/cjs/org.qcobjects.enterprise.commands.cjs.map +3 -3
- package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs +24 -2
- package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs.map +2 -2
- package/public/cjs/org.quickcorp.qcobjects.cli.cjs +1032 -118
- package/public/cjs/org.quickcorp.qcobjects.cli.cjs.map +4 -4
- package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs +362 -334
- package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs.map +2 -2
- package/public/cjs/qcobjects-cli.cjs +4047 -13
- package/public/cjs/qcobjects-cli.cjs.map +4 -4
- package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs +50 -57
- package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs.map +2 -2
- package/public/esm/com.qcobjects.cli.commands.jira.mjs +119 -94
- package/public/esm/com.qcobjects.cli.commands.jira.mjs.map +4 -4
- package/public/esm/com.qcobjects.cli.commands.mjs +357 -16
- package/public/esm/com.qcobjects.cli.commands.mjs.map +4 -4
- package/public/esm/com.qcobjects.cli.commands.version.mjs +204 -216
- package/public/esm/com.qcobjects.cli.commands.version.mjs.map +2 -2
- package/public/esm/index.mjs +4043 -13
- package/public/esm/index.mjs.map +4 -4
- package/public/esm/org.qcobjects.common.pipelog.mjs +21 -26
- package/public/esm/org.qcobjects.common.pipelog.mjs.map +2 -2
- package/public/esm/org.qcobjects.enterprise.commands.mjs +92 -119
- package/public/esm/org.qcobjects.enterprise.commands.mjs.map +3 -3
- package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs +48 -57
- package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs.map +2 -2
- package/public/esm/org.quickcorp.qcobjects.cli.mjs +1266 -380
- package/public/esm/org.quickcorp.qcobjects.cli.mjs.map +4 -4
- package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs +357 -361
- package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs.map +2 -2
- package/public/esm/qcobjects-cli.mjs +4046 -14
- package/public/esm/qcobjects-cli.mjs.map +4 -4
- package/public/index.d.ts +140 -10
- package/src/com.qcobjects.cli.commands.jira.client_services.ts +19 -21
- package/src/com.qcobjects.cli.commands.jira.ts +11 -34
- package/src/com.qcobjects.cli.commands.ts +3 -9
- package/src/com.qcobjects.cli.commands.version.ts +1 -9
- package/src/org.qcobjects.common.pipelog.ts +18 -15
- package/src/org.qcobjects.enterprise.commands.ts +29 -50
- package/src/org.quickcorp.qcobjects.api.client_services.ts +1 -4
- package/src/org.quickcorp.qcobjects.cli.ts +28 -57
- package/src/org.quickcorp.qcobjects.defaultsettings.ts +359 -355
- package/src/qcobjects-cli.ts +4 -5
|
@@ -10,6 +10,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
10
10
|
var __commonJS = (cb, mod) => function __require2() {
|
|
11
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
12
|
};
|
|
13
|
+
var __export = (target, all) => {
|
|
14
|
+
for (var name in all)
|
|
15
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
16
|
+
};
|
|
13
17
|
|
|
14
18
|
// node_modules/commander/lib/error.js
|
|
15
19
|
var require_error = __commonJS({
|
|
@@ -937,8 +941,8 @@ var require_command = __commonJS({
|
|
|
937
941
|
"use strict";
|
|
938
942
|
var EventEmitter = __require("events").EventEmitter;
|
|
939
943
|
var childProcess = __require("child_process");
|
|
940
|
-
var
|
|
941
|
-
var
|
|
944
|
+
var path4 = __require("path");
|
|
945
|
+
var fs3 = __require("fs");
|
|
942
946
|
var process2 = __require("process");
|
|
943
947
|
var { Argument, humanReadableArgName } = require_argument();
|
|
944
948
|
var { CommanderError } = require_error();
|
|
@@ -1768,10 +1772,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1768
1772
|
let launchWithNode = false;
|
|
1769
1773
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1770
1774
|
function findFile(baseDir, baseName) {
|
|
1771
|
-
const localBin =
|
|
1772
|
-
if (
|
|
1773
|
-
if (sourceExt.includes(
|
|
1774
|
-
const foundExt = sourceExt.find((ext) =>
|
|
1775
|
+
const localBin = path4.resolve(baseDir, baseName);
|
|
1776
|
+
if (fs3.existsSync(localBin)) return localBin;
|
|
1777
|
+
if (sourceExt.includes(path4.extname(baseName))) return void 0;
|
|
1778
|
+
const foundExt = sourceExt.find((ext) => fs3.existsSync(`${localBin}${ext}`));
|
|
1775
1779
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1776
1780
|
return void 0;
|
|
1777
1781
|
}
|
|
@@ -1783,23 +1787,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1783
1787
|
if (this._scriptPath) {
|
|
1784
1788
|
let resolvedScriptPath;
|
|
1785
1789
|
try {
|
|
1786
|
-
resolvedScriptPath =
|
|
1790
|
+
resolvedScriptPath = fs3.realpathSync(this._scriptPath);
|
|
1787
1791
|
} catch (err) {
|
|
1788
1792
|
resolvedScriptPath = this._scriptPath;
|
|
1789
1793
|
}
|
|
1790
|
-
executableDir =
|
|
1794
|
+
executableDir = path4.resolve(path4.dirname(resolvedScriptPath), executableDir);
|
|
1791
1795
|
}
|
|
1792
1796
|
if (executableDir) {
|
|
1793
1797
|
let localFile = findFile(executableDir, executableFile);
|
|
1794
1798
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1795
|
-
const legacyName =
|
|
1799
|
+
const legacyName = path4.basename(this._scriptPath, path4.extname(this._scriptPath));
|
|
1796
1800
|
if (legacyName !== this._name) {
|
|
1797
1801
|
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
|
|
1798
1802
|
}
|
|
1799
1803
|
}
|
|
1800
1804
|
executableFile = localFile || executableFile;
|
|
1801
1805
|
}
|
|
1802
|
-
launchWithNode = sourceExt.includes(
|
|
1806
|
+
launchWithNode = sourceExt.includes(path4.extname(executableFile));
|
|
1803
1807
|
let proc;
|
|
1804
1808
|
if (process2.platform !== "win32") {
|
|
1805
1809
|
if (launchWithNode) {
|
|
@@ -2576,7 +2580,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2576
2580
|
* @return {Command}
|
|
2577
2581
|
*/
|
|
2578
2582
|
nameFromFilename(filename) {
|
|
2579
|
-
this._name =
|
|
2583
|
+
this._name = path4.basename(filename, path4.extname(filename));
|
|
2580
2584
|
return this;
|
|
2581
2585
|
}
|
|
2582
2586
|
/**
|
|
@@ -2590,9 +2594,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2590
2594
|
* @param {string} [path]
|
|
2591
2595
|
* @return {string|Command}
|
|
2592
2596
|
*/
|
|
2593
|
-
executableDir(
|
|
2594
|
-
if (
|
|
2595
|
-
this._executableDir =
|
|
2597
|
+
executableDir(path5) {
|
|
2598
|
+
if (path5 === void 0) return this._executableDir;
|
|
2599
|
+
this._executableDir = path5;
|
|
2596
2600
|
return this;
|
|
2597
2601
|
}
|
|
2598
2602
|
/**
|
|
@@ -2791,392 +2795,1274 @@ var require_commander = __commonJS({
|
|
|
2791
2795
|
}
|
|
2792
2796
|
});
|
|
2793
2797
|
|
|
2794
|
-
// src/org.
|
|
2795
|
-
var
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
});
|
|
2877
|
-
exec("npm cache verify && npm i ", (err2, stdout2, stderr2) => {
|
|
2878
|
-
if (err2) {
|
|
2879
|
-
throw Error(err2.message);
|
|
2880
|
-
process.exit(1);
|
|
2881
|
-
return;
|
|
2798
|
+
// src/org.qcobjects.enterprise.commands.ts
|
|
2799
|
+
var org_qcobjects_enterprise_commands_exports = {};
|
|
2800
|
+
__export(org_qcobjects_enterprise_commands_exports, {
|
|
2801
|
+
QCObjectsEnterprise: () => QCObjectsEnterprise
|
|
2802
|
+
});
|
|
2803
|
+
import { execSync } from "node:child_process";
|
|
2804
|
+
var { Package, InheritClass, CONFIG, logger } = __require("qcobjects");
|
|
2805
|
+
var license = CONFIG.get("enterprise-license", "1234");
|
|
2806
|
+
var email = CONFIG.get("enterprise-email", "a@b.com");
|
|
2807
|
+
var QCObjectsEnterprise = class extends InheritClass {
|
|
2808
|
+
static {
|
|
2809
|
+
__name(this, "QCObjectsEnterprise");
|
|
2810
|
+
}
|
|
2811
|
+
install() {
|
|
2812
|
+
const instance = this;
|
|
2813
|
+
return instance.installEnterprise(license, email);
|
|
2814
|
+
}
|
|
2815
|
+
upgrade(switchCommander) {
|
|
2816
|
+
const instance = this;
|
|
2817
|
+
const readline = __require("readline");
|
|
2818
|
+
const rl = readline.createInterface({
|
|
2819
|
+
input: process.stdin,
|
|
2820
|
+
output: process.stdout
|
|
2821
|
+
});
|
|
2822
|
+
var emailQuestion = /* @__PURE__ */ __name(function() {
|
|
2823
|
+
rl.question(`
|
|
2824
|
+
[NOTE: No information will be sent to a server until I got your consent]
|
|
2825
|
+
|
|
2826
|
+
Please tell me your e-Mail (\u{1F48C}):
|
|
2827
|
+
`, (email2) => {
|
|
2828
|
+
if (email2 !== "") {
|
|
2829
|
+
var phoneNumberQuestion = /* @__PURE__ */ __name(function() {
|
|
2830
|
+
rl.question("Please tell me your phone number (\u{1F919}): \n", (phonenumber) => {
|
|
2831
|
+
if (phonenumber !== "") {
|
|
2832
|
+
rl.question(`
|
|
2833
|
+
Please select one of the following options (type a number):
|
|
2834
|
+
|
|
2835
|
+
1.- \u{1F640} This is your first interaction \u{1F60D} with QCObjects Enterprise Edition \u{1F3E2},
|
|
2836
|
+
you want to send your email and phone number to one of our executives to process your
|
|
2837
|
+
inquiry, pay the license (when aplies) and receive a new fresh license number
|
|
2838
|
+
that will free up to you the most advanced features for large companies
|
|
2839
|
+
|
|
2840
|
+
2.- \u2714 Your assigned executive \u{1F9D1} has given to you a new fresh QCObjects Enterprise Edition License Number
|
|
2841
|
+
and you want to enter it to follow up with the next steps.
|
|
2842
|
+
|
|
2843
|
+
3.- \u{1F3C3} You want to quit this form, as you got here accidentally
|
|
2844
|
+
(You should think about it. It's not a coincidence, It's destiny \u{1F600}).
|
|
2845
|
+
|
|
2846
|
+
Please enter the number of the option and press [enter]: `, (interaction_option) => {
|
|
2847
|
+
logger.infoEnabled = true;
|
|
2848
|
+
switch (interaction_option) {
|
|
2849
|
+
case "1":
|
|
2850
|
+
switchCommander.register(email2, phonenumber).then(function() {
|
|
2851
|
+
logger.info(`\u{1F44F} Congrats! You have been successfully registered to the cloud! \u{1F44F}
|
|
2852
|
+
One of our executives will be in touch with you as soon as possible to give you the next steps
|
|
2853
|
+
to get a new License Number and start using QCObjects Entrprise Edition!
|
|
2854
|
+
|
|
2855
|
+
(In the meantime, you can continue using all the features of the QCObjects Community Edition)
|
|
2856
|
+
`);
|
|
2857
|
+
rl.close();
|
|
2858
|
+
}).catch(() => {
|
|
2859
|
+
rl.close();
|
|
2860
|
+
});
|
|
2861
|
+
break;
|
|
2862
|
+
case "2":
|
|
2863
|
+
rl.stdoutMuted = true;
|
|
2864
|
+
rl._writeToOutput = /* @__PURE__ */ __name(function _writeToOutput(stringToWrite) {
|
|
2865
|
+
if (rl.stdoutMuted)
|
|
2866
|
+
rl.output.write("*");
|
|
2867
|
+
else
|
|
2868
|
+
rl.output.write(stringToWrite);
|
|
2869
|
+
}, "_writeToOutput");
|
|
2870
|
+
rl.question("Please tell me the number of license that your executive has given to you: \n", (license2) => {
|
|
2871
|
+
rl.stdoutMuted = false;
|
|
2872
|
+
instance.installEnterprise(license2, email2);
|
|
2873
|
+
rl.close();
|
|
2874
|
+
});
|
|
2875
|
+
break;
|
|
2876
|
+
default:
|
|
2877
|
+
logger.info("\u{1F937} You can continue to use QCObjects Community Edition, see you! \u{1F64B} ");
|
|
2878
|
+
rl.close();
|
|
2879
|
+
break;
|
|
2882
2880
|
}
|
|
2883
|
-
logger.info("Good! Your application is done. You can play with QCObjects now!");
|
|
2884
|
-
logger.info("I will create the SSL certificates now. It may take some time...");
|
|
2885
|
-
exec("qcobjects-createcert", (err3, stdout3, stderr3) => {
|
|
2886
|
-
logger.info("Test certificates generated");
|
|
2887
|
-
const githubService = New(Service);
|
|
2888
|
-
githubService.url = "https://raw.githubusercontent.com/QuickCorp/QCObjects/main/.gitignore";
|
|
2889
|
-
githubService.headers = {
|
|
2890
|
-
Accept: "application/vnd.github+json",
|
|
2891
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
|
2892
|
-
"User-Agent": "qcobjects-cli"
|
|
2893
|
-
};
|
|
2894
|
-
githubService.done = () => {
|
|
2895
|
-
};
|
|
2896
|
-
serviceLoader(githubService).then(({ service }) => {
|
|
2897
|
-
fs.writeFileSync(path.resolve(CONFIG.get("projectPath"), "./.gitignore"), service.template);
|
|
2898
|
-
try {
|
|
2899
|
-
execSync("git init");
|
|
2900
|
-
logger.debug("Git initialized.");
|
|
2901
|
-
} catch (e) {
|
|
2902
|
-
logger.debug("Could not initialize git.");
|
|
2903
|
-
}
|
|
2904
|
-
});
|
|
2905
|
-
}).stdout.on("data", function(data) {
|
|
2906
|
-
console.log(data);
|
|
2907
|
-
});
|
|
2908
|
-
}).stdout.on("data", function(data) {
|
|
2909
|
-
console.log(data);
|
|
2910
2881
|
});
|
|
2911
|
-
}
|
|
2912
|
-
console.log(
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2882
|
+
} else {
|
|
2883
|
+
console.log(`You need to enter a Phone Number if you want to be contacted.
|
|
2884
|
+
If you want to quit, press Ctrl-C.
|
|
2885
|
+
`);
|
|
2886
|
+
phoneNumberQuestion();
|
|
2887
|
+
}
|
|
2916
2888
|
});
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
upgradeToEnterprise(_appName, _options) {
|
|
2925
|
-
const switchCommander = this;
|
|
2926
|
-
QCObjectsEnterprise.upgrade(switchCommander);
|
|
2889
|
+
}, "phoneNumberQuestion");
|
|
2890
|
+
phoneNumberQuestion();
|
|
2891
|
+
} else {
|
|
2892
|
+
console.log(`You need to enter a real e-Mail adress if you want to be contacted.
|
|
2893
|
+
If you want to quit, press Ctrl-C.
|
|
2894
|
+
`);
|
|
2895
|
+
emailQuestion();
|
|
2927
2896
|
}
|
|
2928
|
-
};
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2897
|
+
});
|
|
2898
|
+
}, "emailQuestion");
|
|
2899
|
+
emailQuestion();
|
|
2900
|
+
}
|
|
2901
|
+
installEnterprise(license2, email2) {
|
|
2902
|
+
const asterisk = "*";
|
|
2903
|
+
logger.info(`Your entered license number is ${asterisk.repeat(license2.length)} and the email that you have entered is ${email2}`);
|
|
2904
|
+
logger.info("Now, I'm installing QCObjects Enterprise Edition in your computer...");
|
|
2905
|
+
const cmdDownloadGit = `npm i --force -g git+https://license:${license2}@software.qcobjects.io/qcobjects-enterprise/qcobjects-enterprise.git`;
|
|
2906
|
+
execSync(cmdDownloadGit);
|
|
2907
|
+
const stdout = execSync("qcobjects --version");
|
|
2908
|
+
if (stdout.lastIndexOf("Enterprise Edition") !== -1) {
|
|
2909
|
+
logger.info("\u{1F44F} Congrats! Now you have installed QCObjects Entrprise Edition! \u{1F44F}");
|
|
2910
|
+
logger.info(`You can test it using:
|
|
2911
|
+
> qcobjects --version
|
|
2912
|
+
|
|
2913
|
+
To find more help, type the command:
|
|
2914
|
+
|
|
2915
|
+
> qcobjects --help
|
|
2916
|
+
|
|
2917
|
+
Enjoy!
|
|
2918
|
+
`);
|
|
2919
|
+
} else {
|
|
2920
|
+
console.log("\u{1F926} Something went wrong \u{1F926} when trying to update your license to QCObjects Enterprise Edition");
|
|
2921
|
+
console.log("Ask your executive to help");
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
};
|
|
2925
|
+
Package("org.qcobjects.enterprise.commands", [
|
|
2926
|
+
QCObjectsEnterprise
|
|
2927
|
+
]);
|
|
2928
|
+
|
|
2929
|
+
// src/org.quickcorp.qcobjects.api.client_services.ts
|
|
2930
|
+
var org_quickcorp_qcobjects_api_client_services_exports = {};
|
|
2931
|
+
__export(org_quickcorp_qcobjects_api_client_services_exports, {
|
|
2932
|
+
QuickCorpCloud: () => QuickCorpCloud
|
|
2933
|
+
});
|
|
2934
|
+
var { Package: Package2, Service, logger: logger2 } = __require("qcobjects");
|
|
2935
|
+
var QuickCorpCloud = class extends Service {
|
|
2936
|
+
static {
|
|
2937
|
+
__name(this, "QuickCorpCloud");
|
|
2938
|
+
}
|
|
2939
|
+
constructor({
|
|
2940
|
+
name = "quickcorp_cloud",
|
|
2941
|
+
external = true,
|
|
2942
|
+
useHTTP2 = true,
|
|
2943
|
+
cached = false,
|
|
2944
|
+
method = "post",
|
|
2945
|
+
headers = {
|
|
2946
|
+
"origin": "localhost",
|
|
2947
|
+
"content-type": "application/json"
|
|
2948
|
+
},
|
|
2949
|
+
basePath = "https://cloud.quickcorp.org/",
|
|
2950
|
+
url = "",
|
|
2951
|
+
withCredentials = false
|
|
2952
|
+
}) {
|
|
2953
|
+
super({
|
|
2954
|
+
name,
|
|
2955
|
+
external,
|
|
2956
|
+
useHTTP2,
|
|
2957
|
+
cached,
|
|
2958
|
+
method,
|
|
2959
|
+
headers,
|
|
2960
|
+
basePath,
|
|
2961
|
+
url,
|
|
2962
|
+
withCredentials
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
_new_(o) {
|
|
2966
|
+
this.headers["authorization"] = "Basic token";
|
|
2967
|
+
this.url = this.basePath + o.apiMethod;
|
|
2968
|
+
this.data = o.data;
|
|
2969
|
+
}
|
|
2970
|
+
done(service, standardResponse) {
|
|
2971
|
+
logger2.debug(standardResponse);
|
|
2972
|
+
}
|
|
2973
|
+
fail(e) {
|
|
2974
|
+
logger2.debug(e);
|
|
2975
|
+
}
|
|
2976
|
+
};
|
|
2977
|
+
Package2("org.quickcorp.qcobjects.api.client_services", [
|
|
2978
|
+
QuickCorpCloud
|
|
2979
|
+
]);
|
|
2980
|
+
|
|
2981
|
+
// src/com.qcobjects.cli.commands.ts
|
|
2982
|
+
var com_qcobjects_cli_commands_exports = {};
|
|
2983
|
+
__export(com_qcobjects_cli_commands_exports, {
|
|
2984
|
+
jiraCommand: () => com_qcobjects_cli_commands_jira_exports,
|
|
2985
|
+
versionCommand: () => com_qcobjects_cli_commands_version_exports
|
|
2986
|
+
});
|
|
2987
|
+
|
|
2988
|
+
// src/com.qcobjects.cli.commands.version.ts
|
|
2989
|
+
var com_qcobjects_cli_commands_version_exports = {};
|
|
2990
|
+
__export(com_qcobjects_cli_commands_version_exports, {
|
|
2991
|
+
CommandHandler: () => CommandHandler
|
|
2992
|
+
});
|
|
2993
|
+
var fs = __require("fs");
|
|
2994
|
+
var path = __require("path");
|
|
2995
|
+
var { exec, execSync: execSync2 } = __require("child_process");
|
|
2996
|
+
var { Package: Package3, InheritClass: InheritClass2, logger: logger3 } = __require("qcobjects");
|
|
2997
|
+
var CommandHandler = class extends InheritClass2 {
|
|
2998
|
+
static {
|
|
2999
|
+
__name(this, "CommandHandler");
|
|
3000
|
+
}
|
|
3001
|
+
constructor({ switchCommander }) {
|
|
3002
|
+
super({ switchCommander });
|
|
3003
|
+
const commandHandler = this;
|
|
3004
|
+
this.choiceOption = {
|
|
3005
|
+
v_major(filename, options) {
|
|
3006
|
+
filename = typeof filename === "undefined" ? "VERSION" : filename;
|
|
3007
|
+
const versionString = this.getVersionStringFromFile(filename);
|
|
3008
|
+
const versionSuffix = this.parseVersionSuffix(versionString);
|
|
3009
|
+
const versionObject = this.parseVersionString(versionString);
|
|
3010
|
+
const major = parseInt(versionObject.major);
|
|
3011
|
+
const minor = parseInt(versionObject.minor);
|
|
3012
|
+
const patch = parseInt(versionObject.patch);
|
|
3013
|
+
const newVersion = this.buildNewVersionString({ major: major + 1, minor, patch }, versionSuffix);
|
|
3014
|
+
this.saveNewVersionFile(filename, newVersion);
|
|
3015
|
+
if (options.syncGit) {
|
|
3016
|
+
var commitMsg = options.commitMsg || `New Version v${newVersion}`;
|
|
3017
|
+
this.syncGit(newVersion, commitMsg, options.syncNpm);
|
|
3018
|
+
}
|
|
3019
|
+
},
|
|
3020
|
+
v_minor(filename, options) {
|
|
3021
|
+
filename = typeof filename === "undefined" ? "VERSION" : filename;
|
|
3022
|
+
const versionString = this.getVersionStringFromFile(filename);
|
|
3023
|
+
const versionSuffix = this.parseVersionSuffix(versionString);
|
|
3024
|
+
const versionObject = this.parseVersionString(versionString);
|
|
3025
|
+
const major = parseInt(versionObject.major);
|
|
3026
|
+
const minor = parseInt(versionObject.minor);
|
|
3027
|
+
const patch = parseInt(versionObject.patch);
|
|
3028
|
+
const newVersion = this.buildNewVersionString({ major, minor: minor + 1, patch }, versionSuffix);
|
|
3029
|
+
this.saveNewVersionFile(filename, newVersion);
|
|
3030
|
+
if (options.syncGit) {
|
|
3031
|
+
var commitMsg = options.commitMsg || `New Version v${newVersion}`;
|
|
3032
|
+
this.syncGit(newVersion, commitMsg, options.syncNpm);
|
|
3033
|
+
}
|
|
3034
|
+
},
|
|
3035
|
+
v_patch(filename, options) {
|
|
3036
|
+
filename = typeof filename === "undefined" ? "VERSION" : filename;
|
|
3037
|
+
const versionString = this.getVersionStringFromFile(filename);
|
|
3038
|
+
const versionSuffix = this.parseVersionSuffix(versionString);
|
|
3039
|
+
const versionObject = this.parseVersionString(versionString);
|
|
3040
|
+
const major = parseInt(versionObject.major);
|
|
3041
|
+
const minor = parseInt(versionObject.minor);
|
|
3042
|
+
const patch = parseInt(versionObject.patch);
|
|
3043
|
+
const newVersion = this.buildNewVersionString({ major, minor, patch: patch + 1 }, versionSuffix);
|
|
3044
|
+
this.saveNewVersionFile(filename, newVersion);
|
|
3045
|
+
if (options.syncGit) {
|
|
3046
|
+
var commitMsg = options.commitMsg || `New Version v${newVersion}`;
|
|
3047
|
+
this.syncGit(newVersion, commitMsg, options.syncNpm);
|
|
3048
|
+
}
|
|
3049
|
+
},
|
|
3050
|
+
v_sync(filename, options) {
|
|
3051
|
+
filename = typeof filename === "undefined" ? "VERSION" : filename;
|
|
3052
|
+
var commandHandler2 = this;
|
|
3053
|
+
commandHandler2.switchCommander.shellCommands([
|
|
3054
|
+
"echo $(git describe)"
|
|
3055
|
+
]).then(function(response) {
|
|
3056
|
+
const versionString = response[0].split("-")[0].slice(1).replace("\n", "");
|
|
3057
|
+
console.log(versionString);
|
|
3058
|
+
const versionSuffix = commandHandler2.parseVersionSuffix(versionString);
|
|
3059
|
+
const versionObject = commandHandler2.parseVersionString(versionString);
|
|
3060
|
+
const major = parseInt(versionObject.major);
|
|
3061
|
+
const minor = parseInt(versionObject.minor);
|
|
3062
|
+
const patch = parseInt(versionObject.patch);
|
|
3063
|
+
const newVersion = commandHandler2.buildNewVersionString({ major, minor, patch }, versionSuffix);
|
|
3064
|
+
commandHandler2.saveNewVersionFile(filename, newVersion);
|
|
3065
|
+
var commitMsg = options.commitMsg || `Synced Version v${newVersion}`;
|
|
3066
|
+
commandHandler2.switchCommander.shellCommands(
|
|
3067
|
+
[
|
|
3068
|
+
"git fetch --tags -f",
|
|
3069
|
+
`git add . && git commit -am "${commitMsg}"`,
|
|
3070
|
+
"git fetch origin --tags",
|
|
3071
|
+
"git tag -ln",
|
|
3072
|
+
`npm version "${newVersion}" --allow-same-version -m "${commitMsg}"`,
|
|
3073
|
+
"git push && git push --tags"
|
|
3074
|
+
]
|
|
3075
|
+
).then(function(response2) {
|
|
3076
|
+
console.log(response2);
|
|
3077
|
+
});
|
|
3078
|
+
});
|
|
3079
|
+
},
|
|
3080
|
+
v_changelog() {
|
|
3081
|
+
const commandHandler2 = this;
|
|
3082
|
+
commandHandler2.switchCommander.shellCommands(
|
|
3083
|
+
[
|
|
3084
|
+
"git tag -ln"
|
|
3085
|
+
]
|
|
3086
|
+
).then(function(response) {
|
|
3087
|
+
var versionTags = response[0].split("\n").map((tag) => tag.split(" ").unique()).unique().map(
|
|
3088
|
+
(tag) => {
|
|
3089
|
+
return {
|
|
3090
|
+
"version": tag[0],
|
|
3091
|
+
"major": tag[0].split(".")[0],
|
|
3092
|
+
"minor": tag[0].split(".")[0] + "." + tag[0].split(".")[1],
|
|
3093
|
+
"description": tag.slice(1).join(" ").trim()
|
|
3094
|
+
};
|
|
2953
3095
|
}
|
|
2954
3096
|
);
|
|
2955
|
-
var
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
3097
|
+
var minorVersionTags = versionTags.filter((tag) => tag.version !== "").map((tag) => tag.version.split(".")[0] + "." + tag.version.split(".")[1]).unique();
|
|
3098
|
+
var history = minorVersionTags.map((minor) => {
|
|
3099
|
+
return {
|
|
3100
|
+
"major": minor.split(".")[0],
|
|
3101
|
+
"minor": minor,
|
|
3102
|
+
"history": "\n - " + versionTags.filter((tag) => tag.minor === minor).map(
|
|
3103
|
+
function(tag) {
|
|
3104
|
+
return tag.description;
|
|
3105
|
+
}
|
|
3106
|
+
).filter((desc) => !desc.startsWith(minor.slice(1))).sort().unique().join("\n - ")
|
|
3107
|
+
};
|
|
3108
|
+
}).map((hist) => {
|
|
3109
|
+
return `## ${hist.major} -> ${hist.minor}
|
|
3110
|
+
` + hist.history;
|
|
3111
|
+
}).join("\n");
|
|
3112
|
+
const subtitle = "This is an automatic Changelog history of versions generated using the command: **qcobjects v-changelog > CHANGELOG.md**";
|
|
3113
|
+
console.log("# Changelog \n\n" + subtitle + "\n\n" + history);
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
};
|
|
3117
|
+
switchCommander.program.command("v-major [filename]").option("--git, --sync-git", "Sync with Git").option("--npm, --sync-npm", "Sync with NPM").option("-m, --commit-msg [message]", "Commit Message").description("Semantic Versioning: Upgrade to a new major version").action(function(args, options) {
|
|
3118
|
+
commandHandler.choiceOption.v_major.call(commandHandler, args, options);
|
|
3119
|
+
});
|
|
3120
|
+
switchCommander.program.command("v-minor [filename]").option("--git, --sync-git", "Sync with Git").option("--npm, --sync-npm", "Sync with NPM").option("-m, --commit-msg [message]", "Commit Message").description("Semantic Versioning: Upgrade to a new minor version").action(function(args, options) {
|
|
3121
|
+
commandHandler.choiceOption.v_minor.call(commandHandler, args, options);
|
|
3122
|
+
});
|
|
3123
|
+
switchCommander.program.command("v-patch [filename]").option("--git, --sync-git", "Sync with Git").option("--npm, --sync-npm", "Sync with NPM").option("-m, --commit-msg [message]", "Commit Message").description("Semantic Versioning: Upgrade to a new patch version").action(function(args, options) {
|
|
3124
|
+
commandHandler.choiceOption.v_patch.call(commandHandler, args, options);
|
|
3125
|
+
});
|
|
3126
|
+
switchCommander.program.command("v-sync [filename]").option("-m, --commit-msg [message]", "Commit Message").description("Semantic Versioning: Sync the version of NPM with version of GIT").action(function(args, options) {
|
|
3127
|
+
commandHandler.choiceOption.v_sync.call(commandHandler, args, options);
|
|
3128
|
+
});
|
|
3129
|
+
switchCommander.program.command("v-changelog").description("Semantic Versioning: Shows a changelog using Semantic Versioning").action(function(args, options) {
|
|
3130
|
+
commandHandler.choiceOption.v_changelog.call(commandHandler, args, options);
|
|
3131
|
+
});
|
|
3132
|
+
}
|
|
3133
|
+
syncGit(versionString, commitMsg, syncNpm = false) {
|
|
3134
|
+
let _commands_ = [];
|
|
3135
|
+
if (syncNpm) {
|
|
3136
|
+
_commands_ = _commands_.concat(
|
|
3137
|
+
[
|
|
3138
|
+
"git fetch --tags -f",
|
|
3139
|
+
`npm version "${versionString}" -m "${commitMsg}"`
|
|
3140
|
+
]
|
|
3141
|
+
);
|
|
3142
|
+
}
|
|
3143
|
+
_commands_ = _commands_.concat(
|
|
3144
|
+
[
|
|
3145
|
+
`git add . && git commit -am "${commitMsg}"`,
|
|
3146
|
+
"git fetch origin --tags",
|
|
3147
|
+
"git tag -ln"
|
|
3148
|
+
]
|
|
3149
|
+
);
|
|
3150
|
+
if (!syncNpm) {
|
|
3151
|
+
_commands_ = _commands_.concat(
|
|
3152
|
+
[
|
|
3153
|
+
`git tag -a "v${versionString}" -m "${commitMsg}"`
|
|
3154
|
+
]
|
|
3155
|
+
);
|
|
3156
|
+
}
|
|
3157
|
+
_commands_ = _commands_.concat(
|
|
3158
|
+
[
|
|
3159
|
+
"git push && git push --tags"
|
|
3160
|
+
]
|
|
3161
|
+
);
|
|
3162
|
+
this.switchCommander.shellCommands(_commands_).then(function(response) {
|
|
3163
|
+
logger3.info("Synced to Git");
|
|
3164
|
+
logger3.debug(response);
|
|
3165
|
+
}).catch(function(e) {
|
|
3166
|
+
logger3.info("Something went wrong trying to sync to git");
|
|
3167
|
+
logger3.debug(e);
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
3170
|
+
parseVersionString(versionString) {
|
|
3171
|
+
versionString = versionString.replace("\n", "");
|
|
3172
|
+
const regexpVer = /^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
3173
|
+
const versionObject = { ...versionString.match(regexpVer)?.groups };
|
|
3174
|
+
return versionObject;
|
|
3175
|
+
}
|
|
3176
|
+
getVersionStringFromFile(filename) {
|
|
3177
|
+
let versionString;
|
|
3178
|
+
try {
|
|
3179
|
+
versionString = fs.readFileSync(filename).toString().replace("\n", "");
|
|
3180
|
+
} catch (e) {
|
|
3181
|
+
versionString = "0.0.1";
|
|
3182
|
+
}
|
|
3183
|
+
return versionString;
|
|
3184
|
+
}
|
|
3185
|
+
buildNewSemVersionString({ major, minor, patch }) {
|
|
3186
|
+
return `${major}.${minor}.${patch}`;
|
|
3187
|
+
}
|
|
3188
|
+
parseVersionSuffix(versionString) {
|
|
3189
|
+
versionString = versionString.replace("\n", "");
|
|
3190
|
+
const versionObject = this.parseVersionString(versionString);
|
|
3191
|
+
const semVersionString = this.buildNewSemVersionString(versionObject);
|
|
3192
|
+
return versionString.replace(semVersionString, "");
|
|
3193
|
+
}
|
|
3194
|
+
buildNewVersionString({ major, minor, patch }, suffix) {
|
|
3195
|
+
const semVersionString = this.buildNewSemVersionString({ major, minor, patch });
|
|
3196
|
+
return `${semVersionString}${suffix}`;
|
|
3197
|
+
}
|
|
3198
|
+
saveNewVersionFile(filename, versionString) {
|
|
3199
|
+
fs.writeFileSync(filename, versionString);
|
|
3200
|
+
}
|
|
3201
|
+
};
|
|
3202
|
+
Package3("com.qcobjects.cli.commands.version", [
|
|
3203
|
+
CommandHandler
|
|
3204
|
+
]);
|
|
3205
|
+
|
|
3206
|
+
// src/com.qcobjects.cli.commands.jira.ts
|
|
3207
|
+
var com_qcobjects_cli_commands_jira_exports = {};
|
|
3208
|
+
__export(com_qcobjects_cli_commands_jira_exports, {
|
|
3209
|
+
CommandHandler: () => CommandHandler2
|
|
3210
|
+
});
|
|
3211
|
+
|
|
3212
|
+
// src/com.qcobjects.cli.commands.jira.client_services.ts
|
|
3213
|
+
var { Package: Package4, Service: Service2, logger: logger4 } = __require("qcobjects");
|
|
3214
|
+
var JiraCloud = class extends Service2 {
|
|
3215
|
+
static {
|
|
3216
|
+
__name(this, "JiraCloud");
|
|
3217
|
+
}
|
|
3218
|
+
constructor({
|
|
3219
|
+
name = "jira_cloud",
|
|
3220
|
+
external = true,
|
|
3221
|
+
useHTTP2 = true,
|
|
3222
|
+
cached = false,
|
|
3223
|
+
method = "POST",
|
|
3224
|
+
headers = {
|
|
3225
|
+
"accept": "application/json",
|
|
3226
|
+
"content-type": "application/json"
|
|
3227
|
+
},
|
|
3228
|
+
basePath = "",
|
|
3229
|
+
url = "",
|
|
3230
|
+
withCredentials = false
|
|
3231
|
+
}) {
|
|
3232
|
+
super({
|
|
3233
|
+
name,
|
|
3234
|
+
external,
|
|
3235
|
+
useHTTP2,
|
|
3236
|
+
cached,
|
|
3237
|
+
method,
|
|
3238
|
+
headers,
|
|
3239
|
+
basePath,
|
|
3240
|
+
url,
|
|
3241
|
+
withCredentials
|
|
3242
|
+
});
|
|
3243
|
+
var o = this;
|
|
3244
|
+
this.domain = `${o.domain}`;
|
|
3245
|
+
this.basePath = `https://${this.domain}/`;
|
|
3246
|
+
this.username_password = `${o.username}:${o.password}`;
|
|
3247
|
+
this.headers["authorization"] = `Basic ${Buffer.from(this.username_password).toString("base64")}`;
|
|
3248
|
+
this.url = this.basePath + o.apiMethod;
|
|
3249
|
+
this.data = o.data;
|
|
3250
|
+
}
|
|
3251
|
+
done(service, standardResponse) {
|
|
3252
|
+
logger4.debug(standardResponse);
|
|
3253
|
+
}
|
|
3254
|
+
fail(e) {
|
|
3255
|
+
logger4.debug(e);
|
|
3256
|
+
}
|
|
3257
|
+
};
|
|
3258
|
+
Package4("com.qcobjects.cli.commands.jira.client_services", [
|
|
3259
|
+
JiraCloud
|
|
3260
|
+
]);
|
|
3261
|
+
|
|
3262
|
+
// src/com.qcobjects.cli.commands.jira.ts
|
|
3263
|
+
var path2 = __require("path");
|
|
3264
|
+
var absolutePath = path2.resolve(__dirname, "./");
|
|
3265
|
+
var {
|
|
3266
|
+
exec: exec2,
|
|
3267
|
+
execSync: execSync3
|
|
3268
|
+
} = __require("child_process");
|
|
3269
|
+
var { Package: Package5, InheritClass: InheritClass3, _DataStringify, New, CONFIG: CONFIG2, logger: logger5, serviceLoader } = __require("qcobjects");
|
|
3270
|
+
var CommandHandler2 = class extends InheritClass3 {
|
|
3271
|
+
static {
|
|
3272
|
+
__name(this, "CommandHandler");
|
|
3273
|
+
}
|
|
3274
|
+
constructor({
|
|
3275
|
+
switchCommander
|
|
3276
|
+
}) {
|
|
3277
|
+
super({ switchCommander });
|
|
3278
|
+
this.choiceOption = {
|
|
3279
|
+
issues: /* @__PURE__ */ __name(function() {
|
|
3280
|
+
this.getIssueList().then(function(response) {
|
|
3281
|
+
console.log(_DataStringify(response));
|
|
3282
|
+
}).catch((e) => {
|
|
3283
|
+
console.log(e);
|
|
3284
|
+
process.exit(1);
|
|
3285
|
+
});
|
|
3286
|
+
}, "issues")
|
|
3287
|
+
};
|
|
3288
|
+
const commandHandler = this;
|
|
3289
|
+
switchCommander.program.command("jira <subcommand>").option("-u, --from-user [username]", "User name").option("-fp,--from-project <projectName>", "Project name").option("-p, --pwd <password>", "Password").option("-f, --format <format>", "Format (json, table)").description(`Jira Integration:
|
|
3290
|
+
Sub-Commands can be:
|
|
3291
|
+
issues: To get the issues list from JIRA
|
|
3292
|
+
`).action(function(subcommand, options) {
|
|
3293
|
+
if (commandHandler.choiceOption.hasOwnProperty.call(commandHandler.choiceOption, subcommand)) {
|
|
3294
|
+
commandHandler.choiceOption[subcommand].call(commandHandler, subcommand, options);
|
|
3295
|
+
} else {
|
|
3296
|
+
console.error(`Sub-Command (jira ${subcommand}... ) is not available`);
|
|
3297
|
+
process.exit(1);
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
}
|
|
3301
|
+
getIssueList() {
|
|
3302
|
+
return new Promise(function(resolve, reject) {
|
|
3303
|
+
logger5.info("I'm going to get the issue list from the jira cloud...");
|
|
3304
|
+
const jira_config = CONFIG2.get("jira", null);
|
|
3305
|
+
if (jira_config !== null) {
|
|
3306
|
+
const jira_username = jira_config.username;
|
|
3307
|
+
const jira_password = jira_config.auth_token;
|
|
3308
|
+
const jira_project = jira_config.project;
|
|
3309
|
+
const jira_domain = jira_config.domain;
|
|
3310
|
+
const jira_issue_fields = ["id", "key", "summary", "timetracking"];
|
|
3311
|
+
const cloudClient = New(JiraCloud, {
|
|
3312
|
+
domain: `${jira_domain}`,
|
|
3313
|
+
username: `${jira_username}`,
|
|
3314
|
+
password: `${jira_password}`,
|
|
3315
|
+
apiMethod: "rest/api/latest/search",
|
|
3316
|
+
data: {
|
|
3317
|
+
"jql": `project = ${jira_project}`,
|
|
3318
|
+
"startAt": 0,
|
|
3319
|
+
"maxResults": 5e3,
|
|
3320
|
+
"fields": jira_issue_fields
|
|
2987
3321
|
}
|
|
2988
3322
|
});
|
|
3323
|
+
try {
|
|
3324
|
+
} catch (e) {
|
|
3325
|
+
console.error("\u{1F926} Something went wrong \u{1F926} when trying to get jira issues from the cloud");
|
|
3326
|
+
reject(e);
|
|
3327
|
+
}
|
|
3328
|
+
} else {
|
|
3329
|
+
console.error("\u{1F926} Something went wrong \u{1F926} You need to set the jira config settings");
|
|
3330
|
+
reject(new Error("\u{1F926} Something went wrong \u{1F926} You need to set the jira config settings"));
|
|
2989
3331
|
}
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
3332
|
+
});
|
|
3333
|
+
}
|
|
3334
|
+
};
|
|
3335
|
+
Package5("com.qcobjects.cli.commands.jira", [
|
|
3336
|
+
CommandHandler2
|
|
3337
|
+
]);
|
|
3338
|
+
|
|
3339
|
+
// src/org.quickcorp.qcobjects.defaultsettings.ts
|
|
3340
|
+
__require("qcobjects");
|
|
3341
|
+
var { CONFIG: CONFIG3, global, logger: logger6, _Crypt, findPackageNodePath, Export } = __require("qcobjects");
|
|
3342
|
+
var __get_version__ = /* @__PURE__ */ __name(() => {
|
|
3343
|
+
const path4 = __require("path");
|
|
3344
|
+
const absolutePath2 = path4.resolve(__dirname, "./");
|
|
3345
|
+
const package_config = __require(path4.resolve(process.cwd(), "package.json"));
|
|
3346
|
+
const qcobjects_pkg_config = __require("qcobjects/package.json");
|
|
3347
|
+
const qcobjects_sdk_pkg_config = __require("qcobjects-sdk/package.json");
|
|
3348
|
+
return {
|
|
3349
|
+
"qcobjects": qcobjects_pkg_config.version,
|
|
3350
|
+
"sdk": qcobjects_sdk_pkg_config.version,
|
|
3351
|
+
"cli": package_config.version
|
|
3352
|
+
};
|
|
3353
|
+
}, "__get_version__");
|
|
3354
|
+
var __get_version_string__ = /* @__PURE__ */ __name(() => {
|
|
3355
|
+
const version = __get_version__();
|
|
3356
|
+
return "QCObjects: v" + version.qcobjects + ", SDK: v" + version.sdk + ", CLI: v" + version.cli;
|
|
3357
|
+
}, "__get_version_string__");
|
|
3358
|
+
Export(__get_version__);
|
|
3359
|
+
Export(__get_version_string__);
|
|
3360
|
+
var __load_default_settings__ = /* @__PURE__ */ __name(() => {
|
|
3361
|
+
CONFIG3.set("documentRootFileIndex", "index.html");
|
|
3362
|
+
CONFIG3.set("projectPath", `${process.cwd()}/`);
|
|
3363
|
+
CONFIG3.set("useConfigService", false);
|
|
3364
|
+
CONFIG3.set("documentRoot", "./");
|
|
3365
|
+
CONFIG3.set("serverPortHTTP", 80);
|
|
3366
|
+
CONFIG3.set("serverPortHTTPS", 443);
|
|
3367
|
+
CONFIG3.set("private-key-pem", "localhost-privkey.pem");
|
|
3368
|
+
CONFIG3.set("private-cert-pem", "localhost-cert.pem");
|
|
3369
|
+
CONFIG3.set("allowHTTP1", true);
|
|
3370
|
+
CONFIG3.set("useTemplate", false);
|
|
3371
|
+
CONFIG3.set("domain", "localhost");
|
|
3372
|
+
const setDevMode = /* @__PURE__ */ __name((devmode) => {
|
|
3373
|
+
if (typeof devmode !== "undefined") {
|
|
3374
|
+
switch (true) {
|
|
3375
|
+
case devmode == "debug":
|
|
3376
|
+
logger6.debugEnabled = true;
|
|
3377
|
+
logger6.warnEnabled = true;
|
|
3378
|
+
logger6.infoEnabled = true;
|
|
3379
|
+
break;
|
|
3380
|
+
case devmode == "warn":
|
|
3381
|
+
logger6.debugEnabled = false;
|
|
3382
|
+
logger6.warnEnabled = true;
|
|
3383
|
+
logger6.infoEnabled = true;
|
|
3384
|
+
break;
|
|
3385
|
+
case devmode == "info":
|
|
3386
|
+
logger6.debugEnabled = false;
|
|
3387
|
+
logger6.warnEnabled = false;
|
|
3388
|
+
logger6.infoEnabled = true;
|
|
3389
|
+
break;
|
|
3390
|
+
default:
|
|
3391
|
+
logger6.debugEnabled = false;
|
|
3392
|
+
logger6.warnEnabled = false;
|
|
3393
|
+
logger6.infoEnabled = false;
|
|
3394
|
+
break;
|
|
3395
|
+
}
|
|
3396
|
+
} else {
|
|
3397
|
+
logger6.debugEnabled = false;
|
|
3398
|
+
logger6.warnEnabled = false;
|
|
3399
|
+
logger6.infoEnabled = false;
|
|
3400
|
+
}
|
|
3401
|
+
}, "setDevMode");
|
|
3402
|
+
try {
|
|
3403
|
+
var _config = __require(CONFIG3.get("projectPath") + "config.json");
|
|
3404
|
+
logger6.debug("Loading settings from your config.json");
|
|
3405
|
+
const _secretKey = Object.hasOwn(_config, "domain") ? _config["domain"] : "_secret_";
|
|
3406
|
+
if (Object.hasOwn(_config, "__encoded__")) {
|
|
3407
|
+
_config = JSON.parse(_Crypt.decrypt(_config.__encoded__, _secretKey));
|
|
3408
|
+
}
|
|
3409
|
+
for (var k in _config) {
|
|
3410
|
+
CONFIG3.set(k, _config[k]);
|
|
3411
|
+
}
|
|
3412
|
+
setDevMode(CONFIG3.get("devmode", ""));
|
|
3413
|
+
if (typeof CONFIG3.get("backend") !== "undefined") {
|
|
3414
|
+
global.set("backendAvailable", true);
|
|
3415
|
+
if (typeof CONFIG3.get("basePath") !== "undefined") {
|
|
3416
|
+
logger6.debug(`Changing the current directory: ${process.cwd()}`);
|
|
3417
|
+
try {
|
|
3418
|
+
process.chdir(CONFIG3.get("basePath"));
|
|
3419
|
+
logger6.debug(`New directory: ${process.cwd()}`);
|
|
3420
|
+
} catch (err) {
|
|
3421
|
+
logger6.warn(`It was impossible to change the current chdir: ${err}`);
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
} catch (e) {
|
|
3426
|
+
logger6.debug(e);
|
|
3427
|
+
logger6.debug("Something went wrong trying to load config.json file in your project");
|
|
3428
|
+
}
|
|
3429
|
+
(async function() {
|
|
3430
|
+
const path4 = __require("path");
|
|
3431
|
+
const projectPath = CONFIG3.get("projectPath", `${process.cwd()}/`);
|
|
3432
|
+
const loadDefaultRoutes = /* @__PURE__ */ __name(async () => {
|
|
3433
|
+
return await new Promise((resolve, reject) => {
|
|
3434
|
+
const sdkPath = path4.resolve(findPackageNodePath("qcobjects-sdk"), "qcobjects-sdk");
|
|
3435
|
+
const qcobjectsPath = path4.resolve(findPackageNodePath("qcobjects"), "qcobjects");
|
|
3436
|
+
let backend = CONFIG3.get("backend");
|
|
3437
|
+
if (typeof backend === "undefined") {
|
|
3438
|
+
backend = {};
|
|
3439
|
+
}
|
|
3440
|
+
if (typeof backend.routes === "undefined") {
|
|
3441
|
+
backend.routes = [];
|
|
3442
|
+
}
|
|
3443
|
+
backend.routes = backend.routes.concat([
|
|
3444
|
+
{
|
|
3445
|
+
"name": "QCObjects.js",
|
|
3446
|
+
"description": "Redirection of QCObjects.js",
|
|
3447
|
+
"path": "^/QCObjects.js$",
|
|
3448
|
+
"microservice": "com.qcobjects.backend.microservice.static",
|
|
3449
|
+
"redirect_to": path4.resolve(qcobjectsPath, "src", "QCObjects.js"),
|
|
3450
|
+
"responseHeaders": {},
|
|
3451
|
+
"cors": {
|
|
3452
|
+
"allow_origins": "*"
|
|
3453
|
+
}
|
|
3454
|
+
},
|
|
3455
|
+
{
|
|
3456
|
+
"name": "QCObjects-SDK.js",
|
|
3457
|
+
"description": "Redirection of QCObjects SDK",
|
|
3458
|
+
"path": "^/js/packages/QCObjects-SDK.js$",
|
|
3459
|
+
"microservice": "com.qcobjects.backend.microservice.static",
|
|
3460
|
+
"redirect_to": path4.resolve(sdkPath, "src/QCObjects-SDK.js"),
|
|
3461
|
+
"responseHeaders": {},
|
|
3462
|
+
"cors": {
|
|
3463
|
+
"allow_origins": "*"
|
|
3464
|
+
}
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
"name": "QCObjects-SDK Components",
|
|
3468
|
+
"description": "Redirection of QCObjects SDK",
|
|
3469
|
+
"path": "^/qcobjects-sdk/(.*)$",
|
|
3470
|
+
"microservice": "com.qcobjects.backend.microservice.static",
|
|
3471
|
+
"redirect_to": path4.resolve(sdkPath, "$1"),
|
|
3472
|
+
"responseHeaders": {},
|
|
3473
|
+
"cors": {
|
|
3474
|
+
"allow_origins": "*"
|
|
2997
3475
|
}
|
|
2998
|
-
logger.info("Service Worker Generated");
|
|
2999
|
-
console.log("");
|
|
3000
|
-
console.log("Now simply put:");
|
|
3001
|
-
console.log("CONFIG.set('serviceWorkerURI','/sw.js');");
|
|
3002
|
-
console.log(" In your init.js file ");
|
|
3003
|
-
console.log("");
|
|
3004
|
-
console.log("To start your app in a local server ");
|
|
3005
|
-
console.log("Execute the command: ");
|
|
3006
|
-
console.log("> qcobjects launch <appname>");
|
|
3007
|
-
console.log("");
|
|
3008
|
-
});
|
|
3009
|
-
}, "writeContent");
|
|
3010
|
-
class ServiceWorkerComponent extends Component {
|
|
3011
|
-
static {
|
|
3012
|
-
__name(this, "ServiceWorkerComponent");
|
|
3013
|
-
}
|
|
3014
|
-
cached = false;
|
|
3015
|
-
templateURI = "sw.js";
|
|
3016
|
-
basePath = templatePwaPath;
|
|
3017
|
-
name = "sw";
|
|
3018
|
-
tplsource = "default";
|
|
3019
|
-
template = "";
|
|
3020
|
-
constructor({ name, data }) {
|
|
3021
|
-
super({ name, data });
|
|
3022
3476
|
}
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3477
|
+
]);
|
|
3478
|
+
CONFIG3.set("backend", backend);
|
|
3479
|
+
resolve();
|
|
3480
|
+
});
|
|
3481
|
+
}, "loadDefaultRoutes");
|
|
3482
|
+
await loadDefaultRoutes();
|
|
3483
|
+
})().then(() => logger6.info("Default routes loaded")).catch((e) => {
|
|
3484
|
+
logger6.warn(`An error ocurred loading default settings: ${e}`);
|
|
3485
|
+
});
|
|
3486
|
+
(function() {
|
|
3487
|
+
const path4 = __require("path");
|
|
3488
|
+
const fs3 = __require("fs");
|
|
3489
|
+
const projectPath = CONFIG3.get("projectPath", `${process.cwd()}/`);
|
|
3490
|
+
logger6.debug(`CONFIG.projectPath is set to ${projectPath}`);
|
|
3491
|
+
const findPath = /* @__PURE__ */ __name((p) => {
|
|
3492
|
+
const packagePath = path4.resolve(findPackageNodePath(p), p);
|
|
3493
|
+
return packagePath;
|
|
3494
|
+
}, "findPath");
|
|
3495
|
+
const getPackageJSON = /* @__PURE__ */ __name((p) => {
|
|
3496
|
+
let _json;
|
|
3497
|
+
try {
|
|
3498
|
+
const packagePath = findPath(p);
|
|
3499
|
+
if (typeof packagePath !== "undefined") {
|
|
3500
|
+
_json = JSON.parse(fs3.readFileSync(path4.resolve(`${packagePath}`, "./package.json")).toString());
|
|
3501
|
+
} else {
|
|
3502
|
+
_json = {};
|
|
3503
|
+
}
|
|
3504
|
+
} catch (e) {
|
|
3505
|
+
logger6.debug(`It was impossible to get the package.json from ${p}: ${e}`);
|
|
3506
|
+
_json = {};
|
|
3507
|
+
}
|
|
3508
|
+
return _json;
|
|
3509
|
+
}, "getPackageJSON");
|
|
3510
|
+
const hasKeyword = /* @__PURE__ */ (() => {
|
|
3511
|
+
let keywords = {};
|
|
3512
|
+
return (p, keyword) => {
|
|
3513
|
+
if (typeof keywords === "undefined") {
|
|
3514
|
+
keywords = {};
|
|
3515
|
+
}
|
|
3516
|
+
try {
|
|
3517
|
+
if (typeof keywords[p] === "undefined") {
|
|
3518
|
+
keywords[p] = getPackageJSON(p).keywords;
|
|
3026
3519
|
}
|
|
3520
|
+
} catch (e) {
|
|
3521
|
+
throw Error(`Something went wrong when trying to get the keywords of ${p}`);
|
|
3027
3522
|
}
|
|
3028
|
-
return
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
return
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3523
|
+
return typeof keywords[p] !== "undefined" && keywords[p].includes(keyword);
|
|
3524
|
+
};
|
|
3525
|
+
})();
|
|
3526
|
+
const setBackendValue = /* @__PURE__ */ __name((name, value) => {
|
|
3527
|
+
const backend = CONFIG3.get("backend", {});
|
|
3528
|
+
if (typeof value !== "undefined") {
|
|
3529
|
+
backend[name] = value;
|
|
3530
|
+
}
|
|
3531
|
+
CONFIG3.set("backend", backend);
|
|
3532
|
+
}, "setBackendValue");
|
|
3533
|
+
const dependencies = /* @__PURE__ */ (() => {
|
|
3534
|
+
let deps = [];
|
|
3535
|
+
return () => {
|
|
3536
|
+
if (typeof deps === "undefined") {
|
|
3537
|
+
deps = Object.keys(JSON.parse(fs3.readFileSync(path4.resolve(`${projectPath}`, "./package.json")).toString()).dependencies);
|
|
3538
|
+
setBackendValue("dependencies", deps);
|
|
3539
|
+
}
|
|
3540
|
+
return deps;
|
|
3541
|
+
};
|
|
3542
|
+
})();
|
|
3543
|
+
const devDependencies = /* @__PURE__ */ (() => {
|
|
3544
|
+
let deps = [];
|
|
3545
|
+
return () => {
|
|
3546
|
+
if (typeof deps === "undefined") {
|
|
3547
|
+
deps = Object.keys(JSON.parse(fs3.readFileSync(path4.resolve(`${projectPath}`, "./package.json")).toString()).devDependencies);
|
|
3548
|
+
setBackendValue("devDependencies", deps);
|
|
3549
|
+
}
|
|
3550
|
+
return deps;
|
|
3551
|
+
};
|
|
3552
|
+
})();
|
|
3553
|
+
const loadLibs = /* @__PURE__ */ __name(() => {
|
|
3554
|
+
let _ret_;
|
|
3555
|
+
if (CONFIG3.get("autodiscover", false) || CONFIG3.get("autodiscover_libs", false)) {
|
|
3556
|
+
const libs = dependencies().filter((p) => hasKeyword(p, "qcobjects-lib"));
|
|
3557
|
+
setBackendValue("libs", libs);
|
|
3558
|
+
if (libs.length > 0) {
|
|
3559
|
+
logger6.debug(`Plugin Libs found: ${libs.join(",")}`);
|
|
3560
|
+
_ret_ = Promise.all(libs.map((p) => {
|
|
3561
|
+
return __require(findPath(p));
|
|
3562
|
+
})).then(() => logger6.info("Libs loaded"));
|
|
3563
|
+
} else {
|
|
3564
|
+
logger6.debug("No Plugin Libs found.");
|
|
3565
|
+
_ret_ = Promise.resolve();
|
|
3566
|
+
}
|
|
3567
|
+
} else {
|
|
3568
|
+
logger6.debug("To load libs, set autodiscover_libs to true in your config.json");
|
|
3569
|
+
_ret_ = Promise.resolve();
|
|
3570
|
+
}
|
|
3571
|
+
return _ret_;
|
|
3572
|
+
}, "loadLibs");
|
|
3573
|
+
const loadHandlers = /* @__PURE__ */ __name(() => {
|
|
3574
|
+
let _ret_;
|
|
3575
|
+
if (CONFIG3.get("autodiscover", false) || CONFIG3.get("autodiscover_handlers", false)) {
|
|
3576
|
+
const handlers = dependencies().filter((p) => hasKeyword(p, "qcobjects-handler"));
|
|
3577
|
+
setBackendValue("handlers", handlers);
|
|
3578
|
+
if (handlers.length > 0) {
|
|
3579
|
+
logger6.debug(`Plugin Handlers found: ${handlers.join(",")}`);
|
|
3580
|
+
_ret_ = Promise.all(handlers.map((p) => {
|
|
3581
|
+
return __require(findPath(p));
|
|
3582
|
+
})).then(() => logger6.info("Handlers loaded"));
|
|
3583
|
+
} else {
|
|
3584
|
+
logger6.debug("No Plugin Handlers found.");
|
|
3585
|
+
_ret_ = Promise.resolve();
|
|
3586
|
+
}
|
|
3587
|
+
} else {
|
|
3588
|
+
logger6.debug("To load handlers, set autodiscover_handlers to true in your config.json");
|
|
3589
|
+
_ret_ = Promise.resolve();
|
|
3590
|
+
}
|
|
3591
|
+
return _ret_;
|
|
3592
|
+
}, "loadHandlers");
|
|
3593
|
+
const loadCommands = /* @__PURE__ */ __name(() => {
|
|
3594
|
+
let _ret_;
|
|
3595
|
+
logger6.debug(`Looking for custom commands as dependencies in: ${projectPath}/package.json`);
|
|
3596
|
+
if (CONFIG3.get("autodiscover", false) || CONFIG3.get("autodiscover_commands", false)) {
|
|
3597
|
+
const commands = dependencies().filter((p) => hasKeyword(p, "qcobjects-command"));
|
|
3598
|
+
setBackendValue("commands", commands);
|
|
3599
|
+
if (commands.length > 0) {
|
|
3600
|
+
logger6.debug(`Plugin Commands found: ${commands.join(",")}`);
|
|
3601
|
+
_ret_ = Promise.all(commands.map((p) => {
|
|
3602
|
+
return __require(findPath(p));
|
|
3603
|
+
})).then(() => logger6.info("Commands loaded"));
|
|
3604
|
+
} else {
|
|
3605
|
+
logger6.debug("No Plugin Commands found.");
|
|
3606
|
+
_ret_ = Promise.resolve();
|
|
3607
|
+
}
|
|
3608
|
+
} else {
|
|
3609
|
+
logger6.debug("To load commands, set autodiscover_commands to true in your config.json");
|
|
3610
|
+
_ret_ = Promise.resolve();
|
|
3611
|
+
}
|
|
3612
|
+
return _ret_;
|
|
3613
|
+
}, "loadCommands");
|
|
3614
|
+
const loadDevCommands = /* @__PURE__ */ __name(() => {
|
|
3615
|
+
let _ret_;
|
|
3616
|
+
logger6.debug(`Looking for custom commands as dev dependencies in: ${projectPath}/package.json`);
|
|
3617
|
+
if (CONFIG3.get("autodiscover", false) || CONFIG3.get("autodiscover_commands", false)) {
|
|
3618
|
+
const commands = devDependencies().filter((p) => hasKeyword(p, "qcobjects-command"));
|
|
3619
|
+
setBackendValue("devCommands", commands);
|
|
3620
|
+
if (commands.length > 0) {
|
|
3621
|
+
logger6.debug(`Dev Plugin Commands found: ${commands.join(",")}`);
|
|
3622
|
+
_ret_ = Promise.all(commands.map((p) => {
|
|
3623
|
+
return __require(findPath(p));
|
|
3624
|
+
})).then(() => logger6.info("Commands loaded"));
|
|
3625
|
+
} else {
|
|
3626
|
+
logger6.debug("No Plugin Commands found in dev dependencies.");
|
|
3627
|
+
_ret_ = Promise.resolve();
|
|
3628
|
+
}
|
|
3629
|
+
} else {
|
|
3630
|
+
logger6.debug("To load commands, set autodiscover_commands to true in your config.json");
|
|
3631
|
+
_ret_ = Promise.resolve();
|
|
3632
|
+
}
|
|
3633
|
+
return _ret_;
|
|
3634
|
+
}, "loadDevCommands");
|
|
3635
|
+
if (CONFIG3.get("autodiscover", false) || CONFIG3.get("autodiscover_libs", false) || CONFIG3.get("autodiscover_handlers", false) || CONFIG3.get("autodiscover_commands", false)) {
|
|
3636
|
+
logger6.info("Auto discover is enabled");
|
|
3637
|
+
} else if (!CONFIG3.get("autodiscover", false)) {
|
|
3638
|
+
logger6.info("Auto discover is disabled");
|
|
3639
|
+
logger6.debug("To load all dependencies, set autodiscover to true in your config.json");
|
|
3640
|
+
} else {
|
|
3641
|
+
logger6.info("Auto discover is disabled");
|
|
3642
|
+
}
|
|
3643
|
+
try {
|
|
3644
|
+
logger6.debug("Loading Libs...");
|
|
3645
|
+
loadLibs().catch((e) => {
|
|
3646
|
+
logger6.warn(`An error ocurred loading libs: ${e}`);
|
|
3647
|
+
});
|
|
3648
|
+
} catch (e) {
|
|
3649
|
+
throw Error(`Something went wrong trying to load libs: ${e.message}`);
|
|
3650
|
+
}
|
|
3651
|
+
try {
|
|
3652
|
+
logger6.debug("Loading Handlers...");
|
|
3653
|
+
loadHandlers().catch((e) => {
|
|
3654
|
+
logger6.warn(`An error ocurred loading handlers: ${e}`);
|
|
3655
|
+
});
|
|
3656
|
+
} catch (e) {
|
|
3657
|
+
throw Error(`Something went wrong trying to load handler: ${e.message}`);
|
|
3658
|
+
}
|
|
3659
|
+
try {
|
|
3660
|
+
logger6.debug("Loading Commands...");
|
|
3661
|
+
loadCommands().catch((e) => {
|
|
3662
|
+
logger6.warn(`An error ocurred loading commands: ${e}`);
|
|
3663
|
+
});
|
|
3664
|
+
} catch (e) {
|
|
3665
|
+
throw Error(`Something went wrong trying to load commands: ${e.message}`);
|
|
3666
|
+
}
|
|
3667
|
+
try {
|
|
3668
|
+
logger6.debug("Loading Dev Commands...");
|
|
3669
|
+
loadDevCommands().catch((e) => {
|
|
3670
|
+
logger6.warn(`An error ocurred loading dev commands: ${e}`);
|
|
3671
|
+
});
|
|
3672
|
+
} catch (e) {
|
|
3673
|
+
throw Error(`Something went wrong trying to load Dev commands: ${e.message}`);
|
|
3674
|
+
}
|
|
3675
|
+
try {
|
|
3676
|
+
const commands = CONFIG3.get("backend", { commands: [] }).commands || [];
|
|
3677
|
+
const devCommands = CONFIG3.get("backend", { devCommands: [] }).devCommands || [];
|
|
3678
|
+
setBackendValue("plugins", commands.concat(devCommands));
|
|
3679
|
+
} catch (e) {
|
|
3680
|
+
throw Error(`Something went wrong trying to load plugins list: ${e.message}`);
|
|
3681
|
+
}
|
|
3682
|
+
logger6.info("Dependencies loaded");
|
|
3683
|
+
process.once("SIGTERM", () => {
|
|
3684
|
+
console.log("\x1B[33m%s\x1B[0m", "Bye bye!");
|
|
3685
|
+
process.exit();
|
|
3686
|
+
});
|
|
3687
|
+
})();
|
|
3688
|
+
}, "__load_default_settings__");
|
|
3689
|
+
global.__load_default_settings__ = __load_default_settings__;
|
|
3690
|
+
global.__load_default_settings__();
|
|
3691
|
+
var cleanCache = /* @__PURE__ */ __name(() => {
|
|
3692
|
+
Object.keys(__require.cache).forEach((key) => {
|
|
3693
|
+
delete __require.cache[key];
|
|
3694
|
+
});
|
|
3695
|
+
}, "cleanCache");
|
|
3696
|
+
var __reset_settings__ = /* @__PURE__ */ __name(() => {
|
|
3697
|
+
cleanCache();
|
|
3698
|
+
global.__load_default_settings__();
|
|
3699
|
+
}, "__reset_settings__");
|
|
3700
|
+
global.__reset_settings__ = __reset_settings__;
|
|
3701
|
+
|
|
3702
|
+
// src/org.quickcorp.qcobjects.cli.ts
|
|
3703
|
+
var fs2 = __require("fs");
|
|
3704
|
+
var path3 = __require("path");
|
|
3705
|
+
var templatePwaPath = path3.resolve(__dirname, "./templates/pwa/") + "/";
|
|
3706
|
+
var { exec: exec3, execSync: execSync4 } = __require("child_process");
|
|
3707
|
+
__require("qcobjects");
|
|
3708
|
+
var { CONFIG: CONFIG4, findPackageNodePath: findPackageNodePath2, logger: logger7, Package: Package6, InheritClass: InheritClass4, New: New2, serviceLoader: serviceLoader2, global: global2, Service: Service3, Component } = __require("qcobjects");
|
|
3709
|
+
CONFIG4.set("node_modules_path", "./node_modules/");
|
|
3710
|
+
CONFIG4.set("qcobjectsnewapp_path", CONFIG4.get("node_modules_path") + "/qcobjectsnewapp");
|
|
3711
|
+
var getPluginCommandsList = /* @__PURE__ */ __name(() => {
|
|
3712
|
+
return global2.ClassesList.filter((c) => c.packageName.startsWith("com.qcobjects.cli.commands.")).filter((p) => p.classFactory.name.endsWith("CommandHandler"));
|
|
3713
|
+
}, "getPluginCommandsList");
|
|
3714
|
+
var SwitchCommander = class extends InheritClass4 {
|
|
3715
|
+
static {
|
|
3716
|
+
__name(this, "SwitchCommander");
|
|
3717
|
+
}
|
|
3718
|
+
choiceOption = {
|
|
3719
|
+
generateSw: /* @__PURE__ */ __name((_appName, options) => {
|
|
3720
|
+
const dirPrefix = options.dir;
|
|
3721
|
+
const switchCommander = this;
|
|
3722
|
+
const appName = typeof _appName === "undefined" || _appName === true ? "MyAppName" : _appName;
|
|
3723
|
+
switchCommander.generateServiceWorker(appName, dirPrefix).catch((e) => {
|
|
3724
|
+
logger7.warn(`An error ocurred while creating service worker: ${e}`);
|
|
3725
|
+
});
|
|
3726
|
+
}, "generateSw"),
|
|
3727
|
+
create: /* @__PURE__ */ __name((_appName, options) => {
|
|
3728
|
+
const version = __get_version__();
|
|
3729
|
+
const switchCommander = this;
|
|
3730
|
+
const appName = typeof _appName === "undefined" || _appName === true ? "MyAppName" : _appName;
|
|
3731
|
+
let appTemplateName;
|
|
3732
|
+
if (options.createAmp) {
|
|
3733
|
+
appTemplateName = "qcobjects-ecommerce-amp";
|
|
3734
|
+
} else if (options.createPwa) {
|
|
3735
|
+
appTemplateName = "qcobjectsnewapp";
|
|
3736
|
+
} else if (options.createPhp) {
|
|
3737
|
+
appTemplateName = "qcobjectsnewphp";
|
|
3738
|
+
} else if (options.createCustom) {
|
|
3739
|
+
appTemplateName = options.createCustom;
|
|
3740
|
+
} else {
|
|
3741
|
+
appTemplateName = "qcobjectsnewapp";
|
|
3742
|
+
}
|
|
3743
|
+
CONFIG4.set("qcobjectsnewapp_path", CONFIG4.get("node_modules_path") + "/" + appTemplateName);
|
|
3744
|
+
const _package_json_template_fname = path3.resolve(CONFIG4.get("qcobjectsnewapp_path", "qcobjectsnewapp"), "./package.json");
|
|
3745
|
+
const createAppCommand = "npm init -y";
|
|
3746
|
+
const _package_json_file = path3.resolve(CONFIG4.get("projectPath"), "./package.json");
|
|
3747
|
+
logger7.debug("_package_json_file: " + _package_json_file);
|
|
3748
|
+
logger7.debug(createAppCommand);
|
|
3749
|
+
exec3(createAppCommand, (err) => {
|
|
3750
|
+
if (err) {
|
|
3751
|
+
throw Error(err.message);
|
|
3752
|
+
process.exit(1);
|
|
3753
|
+
return;
|
|
3754
|
+
}
|
|
3755
|
+
exec3(`npm i --save-dev ${appTemplateName}`, () => {
|
|
3756
|
+
const _package_json_template_file = __require(_package_json_template_fname);
|
|
3757
|
+
_package_json_template_file.name = appName;
|
|
3758
|
+
_package_json_template_file.version = "1.0.0";
|
|
3759
|
+
_package_json_template_file.repository = {};
|
|
3760
|
+
fs2.writeFileSync(_package_json_file, JSON.stringify(_package_json_template_file, null, 4));
|
|
3761
|
+
logger7.info("Good! App Templates was installed!");
|
|
3762
|
+
console.log(`Starting to copy files from app template ${appTemplateName} to your project...`);
|
|
3763
|
+
switchCommander.copyTemplate(path3.resolve(findPackageNodePath2(appTemplateName), appTemplateName), path3.resolve(CONFIG4.get("projectPath"), "./")).then(() => {
|
|
3764
|
+
exec3("npm uninstall " + appTemplateName + " --save && npm cache verify", (err2) => {
|
|
3765
|
+
if (err2) {
|
|
3766
|
+
throw Error(err2.message);
|
|
3767
|
+
process.exit(1);
|
|
3768
|
+
return;
|
|
3769
|
+
}
|
|
3770
|
+
execSync4("npm install --save-dev qcobjects-cli ");
|
|
3771
|
+
});
|
|
3772
|
+
exec3("npm cache verify && npm i ", (err2) => {
|
|
3773
|
+
if (err2) {
|
|
3774
|
+
throw Error(err2.message);
|
|
3775
|
+
process.exit(1);
|
|
3776
|
+
return;
|
|
3777
|
+
}
|
|
3778
|
+
logger7.info("Good! Your application is done. You can play with QCObjects now!");
|
|
3779
|
+
logger7.info("I will create the SSL certificates now. It may take some time...");
|
|
3780
|
+
exec3("qcobjects-createcert", () => {
|
|
3781
|
+
logger7.info("Test certificates generated");
|
|
3782
|
+
const githubService = New2(Service3);
|
|
3783
|
+
githubService.url = "https://raw.githubusercontent.com/QuickCorp/QCObjects/main/.gitignore";
|
|
3784
|
+
githubService.headers = {
|
|
3785
|
+
Accept: "application/vnd.github+json",
|
|
3786
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
3787
|
+
"User-Agent": "qcobjects-cli"
|
|
3788
|
+
};
|
|
3789
|
+
githubService.done = () => {
|
|
3790
|
+
};
|
|
3791
|
+
serviceLoader2(githubService).then(({ service }) => {
|
|
3792
|
+
fs2.writeFileSync(path3.resolve(CONFIG4.get("projectPath"), "./.gitignore"), service.template);
|
|
3793
|
+
try {
|
|
3794
|
+
execSync4("git init");
|
|
3795
|
+
logger7.debug("Git initialized.");
|
|
3796
|
+
} catch (e) {
|
|
3797
|
+
logger7.debug("Could not initialize git.");
|
|
3081
3798
|
}
|
|
3082
3799
|
});
|
|
3083
|
-
dirs2.map((d) => {
|
|
3084
|
-
const sourceDir = path.resolve(source2, d.name);
|
|
3085
|
-
const destDir = path.resolve(dest2, d.name);
|
|
3086
|
-
copyDir(sourceDir, destDir, exclude2);
|
|
3087
|
-
});
|
|
3088
|
-
})(paths, dirs, files, exclude);
|
|
3089
|
-
}
|
|
3090
|
-
}, "copyDir");
|
|
3091
|
-
try {
|
|
3092
|
-
const exclude = [
|
|
3093
|
-
"package.json",
|
|
3094
|
-
"node_modules",
|
|
3095
|
-
".DS_Store"
|
|
3096
|
-
];
|
|
3097
|
-
logger.info(`[create] Copying files from ${source} to ${dest} excluding ${exclude.join(",")}...`);
|
|
3098
|
-
copyDir(source, dest, typeof exclude !== "undefined" ? exclude : []);
|
|
3099
|
-
resolve();
|
|
3100
|
-
} catch (e) {
|
|
3101
|
-
logger.warn(`Something went wrong trying to publish static files: ${e.message}`);
|
|
3102
|
-
reject(e);
|
|
3103
|
-
}
|
|
3104
|
-
});
|
|
3105
|
-
}
|
|
3106
|
-
initCommand() {
|
|
3107
|
-
const switchCommander = this;
|
|
3108
|
-
if (process.argv.length > 1) {
|
|
3109
|
-
logger.debug("Installing Commands...");
|
|
3110
|
-
switchCommander.program.version(global.__get_version_string__());
|
|
3111
|
-
switchCommander.program.command("create <appname>").description("Creates an app with <appname>").option("--pwa, --create-pwa", "Creates the progressive web app assets").option("--amp, --create-amp", "Creates the accelerated mobile pages assets").option("--php, --create-php", "Creates the PWA PHP assets").option("--custom, --create-custom <templateappname>", "Creates an App from any NPM package template").option("--tests, --create-tests", "Creates the test suite").action(function(args, options) {
|
|
3112
|
-
switchCommander.choiceOption.create.call(switchCommander, args, options);
|
|
3113
|
-
});
|
|
3114
|
-
try {
|
|
3115
|
-
logger.debug("Loading Plugin Commands...");
|
|
3116
|
-
const importPluginCommands = /* @__PURE__ */ __name(function(switchCommander2) {
|
|
3117
|
-
return global.ClassesList.filter((c) => c.packageName.startsWith("com.qcobjects.cli.commands.")).filter((p) => p.classFactory.name.endsWith("CommandHandler")).map((pluginCommand) => {
|
|
3118
|
-
try {
|
|
3119
|
-
logger.debug(`Loading plugin ${pluginCommand.packageName}`);
|
|
3120
|
-
const classFactory = pluginCommand.classFactory;
|
|
3121
|
-
pluginCommand.plugin = New(classFactory, { switchCommander: switchCommander2 });
|
|
3122
|
-
} catch (e) {
|
|
3123
|
-
throw Error(`Something went wrong loading ${pluginCommand.packageName}`);
|
|
3124
|
-
}
|
|
3125
|
-
return pluginCommand;
|
|
3126
|
-
});
|
|
3127
|
-
}, "importPluginCommands");
|
|
3128
|
-
importPluginCommands(switchCommander);
|
|
3129
|
-
} catch (e) {
|
|
3130
|
-
throw Error(`Something went wrong loading plugins: ${e.message}`);
|
|
3131
|
-
}
|
|
3132
|
-
switchCommander.program.command("publish <appname>").description("Publishes an app with <appname>").option("--pwa, --create-pwa", "Publishes the progressive web app assets").option("--amp, --create-amp", "Publishes the accelerated mobile pages assets").option("--php, --create-php", "Creates the PWA PHP assets").option("--custom, --create-custom", "Creates an App from any NPM package template").option("--tests, --create-tests", "Publishes the test suite").action((args, options) => {
|
|
3133
|
-
switchCommander.choiceOption.publish.bind(switchCommander)(args, options);
|
|
3134
|
-
});
|
|
3135
|
-
switchCommander.program.command("upgrade-to-enterprise").description("Upgrades to QCObjects Enterprise Edition").action(function(args, options) {
|
|
3136
|
-
switchCommander.choiceOption.upgradeToEnterprise.call(switchCommander, args, options);
|
|
3137
|
-
});
|
|
3138
|
-
switchCommander.program.command("generate-sw <appname>").option("-d, --dir <dirPrefix> ", "creates the service worker in a specific dir <dirPrefix>").description("Generates the service worker <appname>").action(function(args, options) {
|
|
3139
|
-
switchCommander.choiceOption.generateSw.call(switchCommander, args, options);
|
|
3140
|
-
});
|
|
3141
|
-
switchCommander.program.command("launch <appname>").description("Launches the application").action(function(args, options) {
|
|
3142
|
-
logger.info("Launching...");
|
|
3143
|
-
setTimeout(() => {
|
|
3144
|
-
logger.info("Go to the browser and open https://localhost ");
|
|
3145
|
-
logger.info("Press Ctrl-C to stop serving ");
|
|
3146
|
-
exec("qcobjects-server", (err, stdout, stderr) => {
|
|
3147
3800
|
}).stdout.on("data", function(data) {
|
|
3148
3801
|
console.log(data);
|
|
3149
3802
|
});
|
|
3150
|
-
},
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
console.log(
|
|
3155
|
-
console.log(" $ qcobjects-cli [command] --help");
|
|
3156
|
-
console.log(" For detailed information of a command ");
|
|
3157
|
-
console.log("");
|
|
3158
|
-
process.exit(0);
|
|
3159
|
-
});
|
|
3160
|
-
switchCommander.program.on("command:*", function() {
|
|
3161
|
-
console.error("Invalid command: %s\nSee --help for a list of available commands.", switchCommander.program.args.join(" "));
|
|
3162
|
-
process.exit(1);
|
|
3803
|
+
}).stdout.on("data", function(data) {
|
|
3804
|
+
console.log(data);
|
|
3805
|
+
});
|
|
3806
|
+
}).catch((e) => {
|
|
3807
|
+
console.log(e);
|
|
3163
3808
|
});
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3809
|
+
}).stdout.on("data", function(data) {
|
|
3810
|
+
console.log(data);
|
|
3811
|
+
});
|
|
3812
|
+
}).stdout.on("data", function() {
|
|
3813
|
+
console.log("App generation started...");
|
|
3814
|
+
});
|
|
3815
|
+
}, "create"),
|
|
3816
|
+
publish(_appName, _options) {
|
|
3817
|
+
logger7.debug("publish is not yet implemented");
|
|
3818
|
+
},
|
|
3819
|
+
upgradeToEnterprise(_appName, _options) {
|
|
3820
|
+
const switchCommander = this;
|
|
3821
|
+
QCObjectsEnterprise.upgrade(switchCommander);
|
|
3822
|
+
}
|
|
3823
|
+
};
|
|
3824
|
+
constructor() {
|
|
3825
|
+
super();
|
|
3826
|
+
this.program = require_commander();
|
|
3827
|
+
}
|
|
3828
|
+
shellCommands(_shell_commands) {
|
|
3829
|
+
return new Promise(function(resolve_all, reject_all) {
|
|
3830
|
+
var _promises_set = _shell_commands.map(
|
|
3831
|
+
function(shell_command) {
|
|
3832
|
+
return new Promise(
|
|
3833
|
+
function(resolve, reject) {
|
|
3834
|
+
logger7.debug(shell_command);
|
|
3835
|
+
exec3(shell_command, (err, stdout, stderr) => {
|
|
3836
|
+
if (!err) {
|
|
3837
|
+
resolve(stdout);
|
|
3838
|
+
} else {
|
|
3839
|
+
logger7.debug(`[FAILED]: ${shell_command}`);
|
|
3840
|
+
logger7.debug(`${stderr}`);
|
|
3841
|
+
reject(stderr);
|
|
3842
|
+
}
|
|
3843
|
+
}).stdout.on("data", function(data) {
|
|
3844
|
+
logger7.info(data);
|
|
3845
|
+
});
|
|
3846
|
+
}
|
|
3847
|
+
).catch((e) => reject_all(e));
|
|
3172
3848
|
}
|
|
3849
|
+
);
|
|
3850
|
+
}).catch((e) => console.log(e));
|
|
3851
|
+
}
|
|
3852
|
+
fileListRecursive(dir) {
|
|
3853
|
+
var instance = this;
|
|
3854
|
+
return fs2.statSync(dir).isDirectory() ? Array.prototype.concat(...fs2.readdirSync(dir).map((f) => instance.fileListRecursive(path3.join(dir, f)))).filter((f) => {
|
|
3855
|
+
return !f.startsWith(".git") && f.lastIndexOf(".DS_Store") == -1;
|
|
3856
|
+
}) : dir;
|
|
3857
|
+
}
|
|
3858
|
+
register(email2, phonenumber) {
|
|
3859
|
+
return new Promise(function(resolve, reject) {
|
|
3860
|
+
logger7.info("I'm going to register your profile on the cloud...");
|
|
3861
|
+
const cloudClient = New2(QuickCorpCloud, {
|
|
3862
|
+
apiMethod: "register",
|
|
3863
|
+
data: { email: email2, phonenumber }
|
|
3864
|
+
});
|
|
3865
|
+
try {
|
|
3866
|
+
} catch (e) {
|
|
3867
|
+
console.log("\u{1F926} Something went wrong \u{1F926} when trying to register you in the cloud");
|
|
3868
|
+
reject(e);
|
|
3173
3869
|
}
|
|
3174
|
-
};
|
|
3175
|
-
Package("org.quickcorp.qcobjects.cli", [
|
|
3176
|
-
SwitchCommander
|
|
3177
|
-
]);
|
|
3178
|
-
exports = { SwitchCommander };
|
|
3870
|
+
});
|
|
3179
3871
|
}
|
|
3180
|
-
|
|
3181
|
-
|
|
3872
|
+
generateServiceWorker(appName, dirPrefix = "./") {
|
|
3873
|
+
const writeContent = /* @__PURE__ */ __name((component) => {
|
|
3874
|
+
const parsedText = component.parseTemplate(component.template);
|
|
3875
|
+
logger7.debug("Starting to write the sw file...");
|
|
3876
|
+
fs2.writeFile(`${dirPrefix}/sw.js`, parsedText, (err) => {
|
|
3877
|
+
if (err) {
|
|
3878
|
+
throw Error(err);
|
|
3879
|
+
}
|
|
3880
|
+
logger7.info("Service Worker Generated");
|
|
3881
|
+
console.log("");
|
|
3882
|
+
console.log("Now simply put:");
|
|
3883
|
+
console.log("CONFIG.set('serviceWorkerURI','/sw.js');");
|
|
3884
|
+
console.log(" In your init.js file ");
|
|
3885
|
+
console.log("");
|
|
3886
|
+
console.log("To start your app in a local server ");
|
|
3887
|
+
console.log("Execute the command: ");
|
|
3888
|
+
console.log("> qcobjects launch <appname>");
|
|
3889
|
+
console.log("");
|
|
3890
|
+
});
|
|
3891
|
+
}, "writeContent");
|
|
3892
|
+
class ServiceWorkerComponent extends Component {
|
|
3893
|
+
static {
|
|
3894
|
+
__name(this, "ServiceWorkerComponent");
|
|
3895
|
+
}
|
|
3896
|
+
cached = false;
|
|
3897
|
+
templateURI = "sw.js";
|
|
3898
|
+
basePath = templatePwaPath;
|
|
3899
|
+
name = "sw";
|
|
3900
|
+
tplsource = "default";
|
|
3901
|
+
template = "";
|
|
3902
|
+
constructor({ name, data }) {
|
|
3903
|
+
super({ name, data });
|
|
3904
|
+
}
|
|
3905
|
+
done({ request, component }) {
|
|
3906
|
+
super.done({ request, component });
|
|
3907
|
+
writeContent(component);
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
return new Promise(() => {
|
|
3911
|
+
var filelist = ["/"].concat(this.fileListRecursive(`${dirPrefix}`));
|
|
3912
|
+
if (typeof dirPrefix !== "undefined" && dirPrefix !== "./" && dirPrefix !== ".") {
|
|
3913
|
+
filelist = filelist.map((f) => f.replace(new RegExp(`${dirPrefix}/`), ""));
|
|
3914
|
+
}
|
|
3915
|
+
filelist = filelist.filter(function(fl) {
|
|
3916
|
+
return fl !== "sw.js" && !fl.startsWith("node_modules/");
|
|
3917
|
+
});
|
|
3918
|
+
filelist = filelist.filter((fname) => !fname.endsWith(".pem"));
|
|
3919
|
+
filelist = filelist.filter((fname) => !fname.endsWith(".sh"));
|
|
3920
|
+
filelist = filelist.filter((fname) => !new RegExp("^package(.*).json$").test(fname));
|
|
3921
|
+
filelist = filelist.filter((fname) => !fname.startsWith("."));
|
|
3922
|
+
var fileListString = '\n "' + filelist.join('",\n "') + '"';
|
|
3923
|
+
const component = new ServiceWorkerComponent({
|
|
3924
|
+
name: "sw",
|
|
3925
|
+
data: {
|
|
3926
|
+
appName,
|
|
3927
|
+
appVersion: "1.0.0",
|
|
3928
|
+
filelist: fileListString
|
|
3929
|
+
}
|
|
3930
|
+
});
|
|
3931
|
+
setTimeout(() => {
|
|
3932
|
+
component.done({ request: null, component });
|
|
3933
|
+
}, 1e3);
|
|
3934
|
+
});
|
|
3935
|
+
}
|
|
3936
|
+
copyTemplate(source, dest) {
|
|
3937
|
+
return new Promise((resolve, reject) => {
|
|
3938
|
+
const copyDir = /* @__PURE__ */ __name((source2, dest2, exclude) => {
|
|
3939
|
+
source2 = path3.resolve(source2);
|
|
3940
|
+
dest2 = path3.resolve(dest2);
|
|
3941
|
+
const dname = path3.basename(source2);
|
|
3942
|
+
const dirExcluded = exclude.includes(dname);
|
|
3943
|
+
const isDir = /* @__PURE__ */ __name((d) => {
|
|
3944
|
+
return fs2.existsSync(d) && fs2.statSync(d).isDirectory() ? true : false;
|
|
3945
|
+
}, "isDir");
|
|
3946
|
+
const isFile = /* @__PURE__ */ __name((d) => {
|
|
3947
|
+
return fs2.existsSync(d) && fs2.statSync(d).isFile() ? true : false;
|
|
3948
|
+
}, "isFile");
|
|
3949
|
+
if (isDir(source2) && !dirExcluded) {
|
|
3950
|
+
fs2.mkdirSync(dest2, { recursive: true });
|
|
3951
|
+
const paths = fs2.readdirSync(source2, { withFileTypes: true });
|
|
3952
|
+
const dirs = paths.filter((d) => d.isDirectory());
|
|
3953
|
+
const files = paths.filter((f) => f.isFile());
|
|
3954
|
+
((paths2, dirs2, files2, exclude2) => {
|
|
3955
|
+
files2.map((f) => {
|
|
3956
|
+
const sourceFile = path3.resolve(source2, f.name);
|
|
3957
|
+
const destFile = path3.resolve(dest2, f.name);
|
|
3958
|
+
const fileExcluded = exclude2.includes(f.name);
|
|
3959
|
+
if (isFile(sourceFile) && !fileExcluded) {
|
|
3960
|
+
logger7.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude2.join(",")}...`);
|
|
3961
|
+
fs2.copyFileSync(sourceFile, destFile);
|
|
3962
|
+
logger7.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude2.join(",")}...DONE!`);
|
|
3963
|
+
}
|
|
3964
|
+
});
|
|
3965
|
+
dirs2.map((d) => {
|
|
3966
|
+
const sourceDir = path3.resolve(source2, d.name);
|
|
3967
|
+
const destDir = path3.resolve(dest2, d.name);
|
|
3968
|
+
copyDir(sourceDir, destDir, exclude2);
|
|
3969
|
+
});
|
|
3970
|
+
})(paths, dirs, files, exclude);
|
|
3971
|
+
}
|
|
3972
|
+
}, "copyDir");
|
|
3973
|
+
try {
|
|
3974
|
+
const exclude = [
|
|
3975
|
+
"package.json",
|
|
3976
|
+
"node_modules",
|
|
3977
|
+
".DS_Store"
|
|
3978
|
+
];
|
|
3979
|
+
logger7.info(`[create] Copying files from ${source} to ${dest} excluding ${exclude.join(",")}...`);
|
|
3980
|
+
copyDir(source, dest, typeof exclude !== "undefined" ? exclude : []);
|
|
3981
|
+
resolve();
|
|
3982
|
+
} catch (e) {
|
|
3983
|
+
logger7.warn(`Something went wrong trying to publish static files: ${e.message}`);
|
|
3984
|
+
reject(e);
|
|
3985
|
+
}
|
|
3986
|
+
});
|
|
3987
|
+
}
|
|
3988
|
+
initCommand() {
|
|
3989
|
+
const switchCommander = this;
|
|
3990
|
+
if (process.argv.length > 1) {
|
|
3991
|
+
logger7.debug("Installing Commands...");
|
|
3992
|
+
switchCommander.program.version(__get_version_string__());
|
|
3993
|
+
switchCommander.program.command("create <appname>").description("Creates an app with <appname>").option("--pwa, --create-pwa", "Creates the progressive web app assets").option("--amp, --create-amp", "Creates the accelerated mobile pages assets").option("--php, --create-php", "Creates the PWA PHP assets").option("--custom, --create-custom <templateappname>", "Creates an App from any NPM package template").option("--tests, --create-tests", "Creates the test suite").action(function(args, options) {
|
|
3994
|
+
switchCommander.choiceOption.create.call(switchCommander, args, options);
|
|
3995
|
+
});
|
|
3996
|
+
try {
|
|
3997
|
+
logger7.debug("Loading Plugin Commands...");
|
|
3998
|
+
const importPluginCommands = /* @__PURE__ */ __name(function(switchCommander2) {
|
|
3999
|
+
return getPluginCommandsList().map((pluginCommand) => {
|
|
4000
|
+
try {
|
|
4001
|
+
logger7.debug(`Loading plugin ${pluginCommand.packageName}`);
|
|
4002
|
+
const classFactory = pluginCommand.classFactory;
|
|
4003
|
+
pluginCommand.plugin = new classFactory({ switchCommander: switchCommander2 });
|
|
4004
|
+
} catch (e) {
|
|
4005
|
+
throw Error(`Something went wrong loading ${pluginCommand.packageName}`);
|
|
4006
|
+
}
|
|
4007
|
+
return pluginCommand;
|
|
4008
|
+
});
|
|
4009
|
+
}, "importPluginCommands");
|
|
4010
|
+
importPluginCommands(switchCommander);
|
|
4011
|
+
} catch (e) {
|
|
4012
|
+
throw Error(`Something went wrong loading plugins: ${e.message}`);
|
|
4013
|
+
}
|
|
4014
|
+
switchCommander.program.command("publish <appname>").description("Publishes an app with <appname>").option("--pwa, --create-pwa", "Publishes the progressive web app assets").option("--amp, --create-amp", "Publishes the accelerated mobile pages assets").option("--php, --create-php", "Creates the PWA PHP assets").option("--custom, --create-custom", "Creates an App from any NPM package template").option("--tests, --create-tests", "Publishes the test suite").action((args, options) => {
|
|
4015
|
+
switchCommander.choiceOption.publish.bind(switchCommander)(args, options);
|
|
4016
|
+
});
|
|
4017
|
+
switchCommander.program.command("upgrade-to-enterprise").description("Upgrades to QCObjects Enterprise Edition").action(function(args, options) {
|
|
4018
|
+
switchCommander.choiceOption.upgradeToEnterprise.call(switchCommander, args, options);
|
|
4019
|
+
});
|
|
4020
|
+
switchCommander.program.command("generate-sw <appname>").option("-d, --dir <dirPrefix> ", "creates the service worker in a specific dir <dirPrefix>").description("Generates the service worker <appname>").action(function(args, options) {
|
|
4021
|
+
switchCommander.choiceOption.generateSw.call(switchCommander, args, options);
|
|
4022
|
+
});
|
|
4023
|
+
switchCommander.program.command("launch <appname>").description("Launches the application").action(function() {
|
|
4024
|
+
logger7.info("Launching...");
|
|
4025
|
+
setTimeout(() => {
|
|
4026
|
+
logger7.info("Go to the browser and open https://localhost ");
|
|
4027
|
+
logger7.info("Press Ctrl-C to stop serving ");
|
|
4028
|
+
exec3("qcobjects-server", () => {
|
|
4029
|
+
}).stdout.on("data", function(data) {
|
|
4030
|
+
console.log(data);
|
|
4031
|
+
});
|
|
4032
|
+
}, 5e3);
|
|
4033
|
+
});
|
|
4034
|
+
switchCommander.program.on("--help", function() {
|
|
4035
|
+
console.log("");
|
|
4036
|
+
console.log("Use:");
|
|
4037
|
+
console.log(" $ qcobjects-cli [command] --help");
|
|
4038
|
+
console.log(" For detailed information of a command ");
|
|
4039
|
+
console.log("");
|
|
4040
|
+
process.exit(0);
|
|
4041
|
+
});
|
|
4042
|
+
switchCommander.program.on("command:*", function() {
|
|
4043
|
+
console.error("Invalid command: %s\nSee --help for a list of available commands.", switchCommander.program.args.join(" "));
|
|
4044
|
+
process.exit(1);
|
|
4045
|
+
});
|
|
4046
|
+
switchCommander.program.parse(process.argv);
|
|
4047
|
+
} else {
|
|
4048
|
+
console.log("");
|
|
4049
|
+
console.log("Use:");
|
|
4050
|
+
console.log(" $ qcobjects-cli [command] --help");
|
|
4051
|
+
console.log(" For detailed information of a command ");
|
|
4052
|
+
console.log("");
|
|
4053
|
+
process.exit(0);
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
};
|
|
4057
|
+
Package6("org.quickcorp.qcobjects.cli", [
|
|
4058
|
+
SwitchCommander
|
|
4059
|
+
]);
|
|
4060
|
+
global2.SwitchCommander = SwitchCommander;
|
|
4061
|
+
export {
|
|
4062
|
+
org_qcobjects_enterprise_commands_exports as EnterpriseCommands,
|
|
4063
|
+
org_quickcorp_qcobjects_api_client_services_exports as QuickCorpServices,
|
|
4064
|
+
SwitchCommander,
|
|
4065
|
+
com_qcobjects_cli_commands_exports as customCommands,
|
|
4066
|
+
getPluginCommandsList
|
|
4067
|
+
};
|
|
3182
4068
|
//# sourceMappingURL=org.quickcorp.qcobjects.cli.mjs.map
|