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