qcobjects-cli 2.5.103-beta → 2.5.105-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.
Files changed (89) hide show
  1. package/VERSION +1 -1
  2. package/build-esbuild.js +65 -12
  3. package/package.json +55 -21
  4. package/public/browser/com.qcobjects.cli.commands.jira.client_services.js +66 -55
  5. package/public/browser/com.qcobjects.cli.commands.jira.client_services.js.map +2 -2
  6. package/public/browser/com.qcobjects.cli.commands.jira.js +138 -93
  7. package/public/browser/com.qcobjects.cli.commands.jira.js.map +4 -4
  8. package/public/browser/com.qcobjects.cli.commands.js +371 -14
  9. package/public/browser/com.qcobjects.cli.commands.js.map +4 -4
  10. package/public/browser/com.qcobjects.cli.commands.version.js +220 -214
  11. package/public/browser/com.qcobjects.cli.commands.version.js.map +2 -2
  12. package/public/browser/index.js +4042 -13
  13. package/public/browser/index.js.map +4 -4
  14. package/public/browser/org.qcobjects.common.pipelog.js +37 -24
  15. package/public/browser/org.qcobjects.common.pipelog.js.map +2 -2
  16. package/public/browser/org.qcobjects.enterprise.commands.js +108 -117
  17. package/public/browser/org.qcobjects.enterprise.commands.js.map +3 -3
  18. package/public/browser/org.quickcorp.qcobjects.api.client_services.js +64 -55
  19. package/public/browser/org.quickcorp.qcobjects.api.client_services.js.map +2 -2
  20. package/public/browser/org.quickcorp.qcobjects.cli.js +1280 -379
  21. package/public/browser/org.quickcorp.qcobjects.cli.js.map +4 -4
  22. package/public/browser/org.quickcorp.qcobjects.defaultsettings.js +373 -359
  23. package/public/browser/org.quickcorp.qcobjects.defaultsettings.js.map +2 -2
  24. package/public/browser/qcobjects-cli.js +4042 -13
  25. package/public/browser/qcobjects-cli.js.map +4 -4
  26. package/public/browser/templates/apps/spa-local.html +28 -0
  27. package/public/browser/templates/apps/spa-local.js +65 -0
  28. package/public/browser/templates/pwa/sw.js +112 -0
  29. package/public/cjs/com.qcobjects.cli.commands.cjs +377 -6
  30. package/public/cjs/com.qcobjects.cli.commands.cjs.map +4 -4
  31. package/public/cjs/com.qcobjects.cli.commands.jira.cjs +82 -24
  32. package/public/cjs/com.qcobjects.cli.commands.jira.cjs.map +4 -4
  33. package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs +25 -1
  34. package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs.map +2 -2
  35. package/public/cjs/com.qcobjects.cli.commands.version.cjs +25 -6
  36. package/public/cjs/com.qcobjects.cli.commands.version.cjs.map +2 -2
  37. package/public/cjs/index.cjs +4042 -13
  38. package/public/cjs/index.cjs.map +4 -4
  39. package/public/cjs/org.qcobjects.common.pipelog.cjs +40 -14
  40. package/public/cjs/org.qcobjects.common.pipelog.cjs.map +2 -2
  41. package/public/cjs/org.qcobjects.enterprise.commands.cjs +38 -34
  42. package/public/cjs/org.qcobjects.enterprise.commands.cjs.map +3 -3
  43. package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs +24 -2
  44. package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs.map +2 -2
  45. package/public/cjs/org.quickcorp.qcobjects.cli.cjs +1032 -118
  46. package/public/cjs/org.quickcorp.qcobjects.cli.cjs.map +4 -4
  47. package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs +362 -334
  48. package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs.map +2 -2
  49. package/public/cjs/qcobjects-cli.cjs +4047 -13
  50. package/public/cjs/qcobjects-cli.cjs.map +4 -4
  51. package/public/cjs/templates/apps/spa-local.html +28 -0
  52. package/public/cjs/templates/apps/spa-local.js +65 -0
  53. package/public/cjs/templates/pwa/sw.js +112 -0
  54. package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs +50 -57
  55. package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs.map +2 -2
  56. package/public/esm/com.qcobjects.cli.commands.jira.mjs +119 -94
  57. package/public/esm/com.qcobjects.cli.commands.jira.mjs.map +4 -4
  58. package/public/esm/com.qcobjects.cli.commands.mjs +357 -16
  59. package/public/esm/com.qcobjects.cli.commands.mjs.map +4 -4
  60. package/public/esm/com.qcobjects.cli.commands.version.mjs +204 -216
  61. package/public/esm/com.qcobjects.cli.commands.version.mjs.map +2 -2
  62. package/public/esm/index.mjs +4043 -13
  63. package/public/esm/index.mjs.map +4 -4
  64. package/public/esm/org.qcobjects.common.pipelog.mjs +21 -26
  65. package/public/esm/org.qcobjects.common.pipelog.mjs.map +2 -2
  66. package/public/esm/org.qcobjects.enterprise.commands.mjs +92 -119
  67. package/public/esm/org.qcobjects.enterprise.commands.mjs.map +3 -3
  68. package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs +48 -57
  69. package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs.map +2 -2
  70. package/public/esm/org.quickcorp.qcobjects.cli.mjs +1266 -380
  71. package/public/esm/org.quickcorp.qcobjects.cli.mjs.map +4 -4
  72. package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs +357 -361
  73. package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs.map +2 -2
  74. package/public/esm/qcobjects-cli.mjs +4046 -14
  75. package/public/esm/qcobjects-cli.mjs.map +4 -4
  76. package/public/esm/templates/apps/spa-local.html +28 -0
  77. package/public/esm/templates/apps/spa-local.js +65 -0
  78. package/public/esm/templates/pwa/sw.js +112 -0
  79. package/public/index.d.ts +140 -10
  80. package/src/com.qcobjects.cli.commands.jira.client_services.ts +19 -21
  81. package/src/com.qcobjects.cli.commands.jira.ts +11 -34
  82. package/src/com.qcobjects.cli.commands.ts +3 -9
  83. package/src/com.qcobjects.cli.commands.version.ts +1 -9
  84. package/src/org.qcobjects.common.pipelog.ts +18 -15
  85. package/src/org.qcobjects.enterprise.commands.ts +29 -50
  86. package/src/org.quickcorp.qcobjects.api.client_services.ts +1 -4
  87. package/src/org.quickcorp.qcobjects.cli.ts +28 -57
  88. package/src/org.quickcorp.qcobjects.defaultsettings.ts +359 -355
  89. package/src/qcobjects-cli.ts +4 -5
@@ -0,0 +1,28 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width" />
8
+ <!-- This is a wide open CSP declaration. To lock this down for production, see below. -->
9
+ <meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval' data: gap: https://ssl.gstatic.com; img-src * 'self' data:; child-src *; style-src * 'self' 'unsafe-inline' 'unsafe-eval'; script-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * 'self' 'unsafe-inline' 'unsafe-eval';media-src *">
10
+ <title>{{title}}</title>
11
+ <script type="text/javascript" src="./node_modules/qcobjects/QCObjects.js"></script>
12
+ </head>
13
+
14
+ <body>
15
+
16
+ <component name="main">
17
+ <routing path="/" name="main" />
18
+ <routing path="#" name="main" />
19
+ <routing path="" name="main" />
20
+ <routing path="page1" name="page1" />
21
+ <routing path="page2" name="page2" />
22
+ </component>
23
+
24
+ <script type="text/javascript" src="js/init.js"></script>
25
+
26
+ </body>
27
+
28
+ </html>
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ const path = require("path");
3
+ const absolutePath = path.resolve( __dirname, "./" );
4
+
5
+ const http2 = require("http2");
6
+ const fs = require("fs");
7
+ const mime = require("mime");
8
+
9
+ Import("org.quickcorp.qcobjects.main.file");
10
+
11
+ Package("org.quickcorp.cli.templates.app.spa_local",[
12
+ Class("AppTemplate",{
13
+ name:"app/index.html",
14
+ template:"",
15
+ templateURI:"spa-local.html",
16
+ body:"",
17
+ compileAndSave:false,
18
+ save:function (){
19
+ var appTemplateInstance = this;
20
+ fs.mkdir("app/",()=>{
21
+ fs.writeFile(appTemplateInstance.name, appTemplateInstance.body, err => {
22
+ if (err) {
23
+ return console.error(`Autsch! Failed to store template: ${err.message}.`);
24
+ }
25
+ logger.info("Saved template!");
26
+ });
27
+ });
28
+ },
29
+ done:function (){
30
+ var appTemplateInstance = this;
31
+ const source = appTemplateInstance.template;
32
+
33
+ (New(Component, {
34
+ name: "static_source",
35
+ template: source,
36
+ cached:false,
37
+ tplsource: "inline",
38
+ data: {
39
+ title: "QCObjects"
40
+ },
41
+ done ({request, component}) {
42
+ appTemplateInstance.body = component.parsedAssignmentText;
43
+ return Promise.resolve({request, component});
44
+ }
45
+ }));
46
+
47
+ if (appTemplateInstance.compileAndSave){
48
+ appTemplateInstance.save();
49
+ }
50
+
51
+ },
52
+ _new_:function (){
53
+
54
+ var appTemplateInstance = this;
55
+ const absolutePath = path.resolve( __dirname, "./" );
56
+
57
+ fs.readFile(absolutePath+"/"+appTemplateInstance.templateURI, function(err, data) {
58
+ appTemplateInstance.template = data.toString();
59
+ appTemplateInstance.done.call(appTemplateInstance);
60
+ });
61
+
62
+ logger.info("App Template Manager Initialized");
63
+ }
64
+ })
65
+ ]);
@@ -0,0 +1,112 @@
1
+ /**
2
+ * QCObjects Framework
3
+ * ____________________________________
4
+ *
5
+ * Author: Jean Machuca <correojean@gmail.com>
6
+ *
7
+ * Cross Browser Javascript Framework for MVC Patterns
8
+ * QuickCorp/QCObjects is licensed under the
9
+ * GNU Lesser General Public License v3.0
10
+ * [LICENSE] (https://github.com/QuickCorp/QCObjects/blob/master/LICENSE.txt)
11
+ *
12
+ * Permissions of this copyleft license are conditioned on making available
13
+ * complete source code of licensed works and modifications under the same
14
+ * license or the GNU GPLv3. Copyright and license notices must be preserved.
15
+ * Contributors provide an express grant of patent rights. However, a larger
16
+ * work using the licensed work through interfaces provided by the licensed
17
+ * work may be distributed under different terms and without source code for
18
+ * the larger work.
19
+ *
20
+ * Copyright (C) 2015 Jean Machuca,<correojean@gmail.com>
21
+ *
22
+ * Everyone is permitted to copy and distribute verbatim copies of this
23
+ * license document, but changing it is not allowed.
24
+ */
25
+ "use strict";
26
+ // eslint-disable-next-line no-undef
27
+
28
+ /* eslint-disable no-undef */
29
+ // This is the service worker with the combined offline experience (Offline page + Offline copy of pages)
30
+
31
+ const CACHE = "{{appName}}-offline-page";
32
+
33
+ importScripts("https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js");
34
+
35
+ const offlineFallbackPage = "index-fallback.html";
36
+
37
+ self.addEventListener("message", (event) => {
38
+ if (event.data && event.data.type === "SKIP_WAITING") {
39
+ self.skipWaiting();
40
+ }
41
+ });
42
+
43
+ self.addEventListener("install", async (event) => {
44
+ event.waitUntil(
45
+ caches.open(CACHE)
46
+ .then((cache) => cache.add(offlineFallbackPage))
47
+ );
48
+ });
49
+
50
+ if (workbox.navigationPreload.isSupported()) {
51
+ workbox.navigationPreload.enable();
52
+ }
53
+
54
+ workbox.routing.registerRoute(
55
+ // eslint-disable-next-line prefer-regex-literals
56
+ new RegExp("/*"),
57
+ new workbox.strategies.StaleWhileRevalidate({
58
+ cacheName: CACHE
59
+ })
60
+ );
61
+
62
+ self.addEventListener("fetch", (event) => {
63
+ if (event.request.mode === "navigate") {
64
+ event.respondWith((async () => {
65
+ try {
66
+ const preloadResp = await event.preloadResponse;
67
+
68
+ if (preloadResp) {
69
+ return preloadResp;
70
+ }
71
+
72
+ const networkResp = await fetch(event.request);
73
+ return networkResp;
74
+ } catch (error) {
75
+
76
+ const cache = await caches.open(CACHE);
77
+ const cachedResp = await cache.match(offlineFallbackPage);
78
+ return cachedResp;
79
+ }
80
+ })());
81
+ }
82
+ });
83
+
84
+
85
+ const version = "{{appVersion}}";
86
+ const appName = "{{appName}}";
87
+ const cacheSufix = (Math.round(Date.now()/(1000*3600))).toString(); // 1 hour
88
+ const cacheName = `qcobjects-app-${appName}-${version}-${cacheSufix}`;
89
+ const startUrl = "/?homescreen=1";
90
+ caches.delete(cacheName); // force to reload cache for the first time the sw is loaded
91
+ self.addEventListener("install", e => {
92
+ e.waitUntil(
93
+ caches.open(cacheName).then(cache => {
94
+ return cache.addAll([`${startUrl}`,{{filelist}}])
95
+ .then(() => self.skipWaiting());
96
+ })
97
+ );
98
+ });
99
+
100
+ self.addEventListener("activate", event => {
101
+ event.waitUntil(self.clients.claim());
102
+ });
103
+
104
+ self.addEventListener("fetch", event => {
105
+ event.respondWith(
106
+ caches.open(cacheName)
107
+ .then(cache => cache.match(event.request, { ignoreSearch: true }))
108
+ .then(response => {
109
+ return response || fetch(event.request);
110
+ })
111
+ );
112
+ });
@@ -1,13 +1,384 @@
1
1
  "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
20
 
3
21
  // src/com.qcobjects.cli.commands.ts
22
+ var com_qcobjects_cli_commands_exports = {};
23
+ __export(com_qcobjects_cli_commands_exports, {
24
+ jiraCommand: () => com_qcobjects_cli_commands_jira_exports,
25
+ versionCommand: () => com_qcobjects_cli_commands_version_exports
26
+ });
27
+ module.exports = __toCommonJS(com_qcobjects_cli_commands_exports);
28
+
29
+ // src/com.qcobjects.cli.commands.version.ts
30
+ var com_qcobjects_cli_commands_version_exports = {};
31
+ __export(com_qcobjects_cli_commands_version_exports, {
32
+ CommandHandler: () => CommandHandler
33
+ });
4
34
  var fs = require("fs");
5
35
  var path = require("path");
6
- var absolutePath = path.resolve(__dirname, "./");
7
- var templatePath = path.resolve(__dirname, "./templates/apps/") + "/";
8
- var templatePwaPath = path.resolve(__dirname, "./templates/pwa/") + "/";
9
- var package_config = require(absolutePath + "/../package.json");
10
36
  var { exec, execSync } = require("child_process");
11
- require(absolutePath + "/com.qcobjects.cli.commands.version");
12
- require(absolutePath + "/com.qcobjects.cli.commands.jira");
37
+ var { Package, InheritClass, logger } = require("qcobjects");
38
+ var CommandHandler = class extends InheritClass {
39
+ static {
40
+ __name(this, "CommandHandler");
41
+ }
42
+ constructor({ switchCommander }) {
43
+ super({ switchCommander });
44
+ const commandHandler = this;
45
+ this.choiceOption = {
46
+ v_major(filename, options) {
47
+ filename = typeof filename === "undefined" ? "VERSION" : filename;
48
+ const versionString = this.getVersionStringFromFile(filename);
49
+ const versionSuffix = this.parseVersionSuffix(versionString);
50
+ const versionObject = this.parseVersionString(versionString);
51
+ const major = parseInt(versionObject.major);
52
+ const minor = parseInt(versionObject.minor);
53
+ const patch = parseInt(versionObject.patch);
54
+ const newVersion = this.buildNewVersionString({ major: major + 1, minor, patch }, versionSuffix);
55
+ this.saveNewVersionFile(filename, newVersion);
56
+ if (options.syncGit) {
57
+ var commitMsg = options.commitMsg || `New Version v${newVersion}`;
58
+ this.syncGit(newVersion, commitMsg, options.syncNpm);
59
+ }
60
+ },
61
+ v_minor(filename, options) {
62
+ filename = typeof filename === "undefined" ? "VERSION" : filename;
63
+ const versionString = this.getVersionStringFromFile(filename);
64
+ const versionSuffix = this.parseVersionSuffix(versionString);
65
+ const versionObject = this.parseVersionString(versionString);
66
+ const major = parseInt(versionObject.major);
67
+ const minor = parseInt(versionObject.minor);
68
+ const patch = parseInt(versionObject.patch);
69
+ const newVersion = this.buildNewVersionString({ major, minor: minor + 1, patch }, versionSuffix);
70
+ this.saveNewVersionFile(filename, newVersion);
71
+ if (options.syncGit) {
72
+ var commitMsg = options.commitMsg || `New Version v${newVersion}`;
73
+ this.syncGit(newVersion, commitMsg, options.syncNpm);
74
+ }
75
+ },
76
+ v_patch(filename, options) {
77
+ filename = typeof filename === "undefined" ? "VERSION" : filename;
78
+ const versionString = this.getVersionStringFromFile(filename);
79
+ const versionSuffix = this.parseVersionSuffix(versionString);
80
+ const versionObject = this.parseVersionString(versionString);
81
+ const major = parseInt(versionObject.major);
82
+ const minor = parseInt(versionObject.minor);
83
+ const patch = parseInt(versionObject.patch);
84
+ const newVersion = this.buildNewVersionString({ major, minor, patch: patch + 1 }, versionSuffix);
85
+ this.saveNewVersionFile(filename, newVersion);
86
+ if (options.syncGit) {
87
+ var commitMsg = options.commitMsg || `New Version v${newVersion}`;
88
+ this.syncGit(newVersion, commitMsg, options.syncNpm);
89
+ }
90
+ },
91
+ v_sync(filename, options) {
92
+ filename = typeof filename === "undefined" ? "VERSION" : filename;
93
+ var commandHandler2 = this;
94
+ commandHandler2.switchCommander.shellCommands([
95
+ "echo $(git describe)"
96
+ ]).then(function(response) {
97
+ const versionString = response[0].split("-")[0].slice(1).replace("\n", "");
98
+ console.log(versionString);
99
+ const versionSuffix = commandHandler2.parseVersionSuffix(versionString);
100
+ const versionObject = commandHandler2.parseVersionString(versionString);
101
+ const major = parseInt(versionObject.major);
102
+ const minor = parseInt(versionObject.minor);
103
+ const patch = parseInt(versionObject.patch);
104
+ const newVersion = commandHandler2.buildNewVersionString({ major, minor, patch }, versionSuffix);
105
+ commandHandler2.saveNewVersionFile(filename, newVersion);
106
+ var commitMsg = options.commitMsg || `Synced Version v${newVersion}`;
107
+ commandHandler2.switchCommander.shellCommands(
108
+ [
109
+ "git fetch --tags -f",
110
+ `git add . && git commit -am "${commitMsg}"`,
111
+ "git fetch origin --tags",
112
+ "git tag -ln",
113
+ `npm version "${newVersion}" --allow-same-version -m "${commitMsg}"`,
114
+ "git push && git push --tags"
115
+ ]
116
+ ).then(function(response2) {
117
+ console.log(response2);
118
+ });
119
+ });
120
+ },
121
+ v_changelog() {
122
+ const commandHandler2 = this;
123
+ commandHandler2.switchCommander.shellCommands(
124
+ [
125
+ "git tag -ln"
126
+ ]
127
+ ).then(function(response) {
128
+ var versionTags = response[0].split("\n").map((tag) => tag.split(" ").unique()).unique().map(
129
+ (tag) => {
130
+ return {
131
+ "version": tag[0],
132
+ "major": tag[0].split(".")[0],
133
+ "minor": tag[0].split(".")[0] + "." + tag[0].split(".")[1],
134
+ "description": tag.slice(1).join(" ").trim()
135
+ };
136
+ }
137
+ );
138
+ var minorVersionTags = versionTags.filter((tag) => tag.version !== "").map((tag) => tag.version.split(".")[0] + "." + tag.version.split(".")[1]).unique();
139
+ var history = minorVersionTags.map((minor) => {
140
+ return {
141
+ "major": minor.split(".")[0],
142
+ "minor": minor,
143
+ "history": "\n - " + versionTags.filter((tag) => tag.minor === minor).map(
144
+ function(tag) {
145
+ return tag.description;
146
+ }
147
+ ).filter((desc) => !desc.startsWith(minor.slice(1))).sort().unique().join("\n - ")
148
+ };
149
+ }).map((hist) => {
150
+ return `## ${hist.major} -> ${hist.minor}
151
+ ` + hist.history;
152
+ }).join("\n");
153
+ const subtitle = "This is an automatic Changelog history of versions generated using the command: **qcobjects v-changelog > CHANGELOG.md**";
154
+ console.log("# Changelog \n\n" + subtitle + "\n\n" + history);
155
+ });
156
+ }
157
+ };
158
+ 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) {
159
+ commandHandler.choiceOption.v_major.call(commandHandler, args, options);
160
+ });
161
+ 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) {
162
+ commandHandler.choiceOption.v_minor.call(commandHandler, args, options);
163
+ });
164
+ 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) {
165
+ commandHandler.choiceOption.v_patch.call(commandHandler, args, options);
166
+ });
167
+ 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) {
168
+ commandHandler.choiceOption.v_sync.call(commandHandler, args, options);
169
+ });
170
+ switchCommander.program.command("v-changelog").description("Semantic Versioning: Shows a changelog using Semantic Versioning").action(function(args, options) {
171
+ commandHandler.choiceOption.v_changelog.call(commandHandler, args, options);
172
+ });
173
+ }
174
+ syncGit(versionString, commitMsg, syncNpm = false) {
175
+ let _commands_ = [];
176
+ if (syncNpm) {
177
+ _commands_ = _commands_.concat(
178
+ [
179
+ "git fetch --tags -f",
180
+ `npm version "${versionString}" -m "${commitMsg}"`
181
+ ]
182
+ );
183
+ }
184
+ _commands_ = _commands_.concat(
185
+ [
186
+ `git add . && git commit -am "${commitMsg}"`,
187
+ "git fetch origin --tags",
188
+ "git tag -ln"
189
+ ]
190
+ );
191
+ if (!syncNpm) {
192
+ _commands_ = _commands_.concat(
193
+ [
194
+ `git tag -a "v${versionString}" -m "${commitMsg}"`
195
+ ]
196
+ );
197
+ }
198
+ _commands_ = _commands_.concat(
199
+ [
200
+ "git push && git push --tags"
201
+ ]
202
+ );
203
+ this.switchCommander.shellCommands(_commands_).then(function(response) {
204
+ logger.info("Synced to Git");
205
+ logger.debug(response);
206
+ }).catch(function(e) {
207
+ logger.info("Something went wrong trying to sync to git");
208
+ logger.debug(e);
209
+ });
210
+ }
211
+ parseVersionString(versionString) {
212
+ versionString = versionString.replace("\n", "");
213
+ 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-]+)*))?$/;
214
+ const versionObject = { ...versionString.match(regexpVer)?.groups };
215
+ return versionObject;
216
+ }
217
+ getVersionStringFromFile(filename) {
218
+ let versionString;
219
+ try {
220
+ versionString = fs.readFileSync(filename).toString().replace("\n", "");
221
+ } catch (e) {
222
+ versionString = "0.0.1";
223
+ }
224
+ return versionString;
225
+ }
226
+ buildNewSemVersionString({ major, minor, patch }) {
227
+ return `${major}.${minor}.${patch}`;
228
+ }
229
+ parseVersionSuffix(versionString) {
230
+ versionString = versionString.replace("\n", "");
231
+ const versionObject = this.parseVersionString(versionString);
232
+ const semVersionString = this.buildNewSemVersionString(versionObject);
233
+ return versionString.replace(semVersionString, "");
234
+ }
235
+ buildNewVersionString({ major, minor, patch }, suffix) {
236
+ const semVersionString = this.buildNewSemVersionString({ major, minor, patch });
237
+ return `${semVersionString}${suffix}`;
238
+ }
239
+ saveNewVersionFile(filename, versionString) {
240
+ fs.writeFileSync(filename, versionString);
241
+ }
242
+ };
243
+ Package("com.qcobjects.cli.commands.version", [
244
+ CommandHandler
245
+ ]);
246
+
247
+ // src/com.qcobjects.cli.commands.jira.ts
248
+ var com_qcobjects_cli_commands_jira_exports = {};
249
+ __export(com_qcobjects_cli_commands_jira_exports, {
250
+ CommandHandler: () => CommandHandler2
251
+ });
252
+
253
+ // src/com.qcobjects.cli.commands.jira.client_services.ts
254
+ var { Package: Package2, Service, logger: logger2 } = require("qcobjects");
255
+ var JiraCloud = class extends Service {
256
+ static {
257
+ __name(this, "JiraCloud");
258
+ }
259
+ constructor({
260
+ name = "jira_cloud",
261
+ external = true,
262
+ useHTTP2 = true,
263
+ cached = false,
264
+ method = "POST",
265
+ headers = {
266
+ "accept": "application/json",
267
+ "content-type": "application/json"
268
+ },
269
+ basePath = "",
270
+ url = "",
271
+ withCredentials = false
272
+ }) {
273
+ super({
274
+ name,
275
+ external,
276
+ useHTTP2,
277
+ cached,
278
+ method,
279
+ headers,
280
+ basePath,
281
+ url,
282
+ withCredentials
283
+ });
284
+ var o = this;
285
+ this.domain = `${o.domain}`;
286
+ this.basePath = `https://${this.domain}/`;
287
+ this.username_password = `${o.username}:${o.password}`;
288
+ this.headers["authorization"] = `Basic ${Buffer.from(this.username_password).toString("base64")}`;
289
+ this.url = this.basePath + o.apiMethod;
290
+ this.data = o.data;
291
+ }
292
+ done(service, standardResponse) {
293
+ logger2.debug(standardResponse);
294
+ }
295
+ fail(e) {
296
+ logger2.debug(e);
297
+ }
298
+ };
299
+ Package2("com.qcobjects.cli.commands.jira.client_services", [
300
+ JiraCloud
301
+ ]);
302
+
303
+ // src/com.qcobjects.cli.commands.jira.ts
304
+ var path2 = require("path");
305
+ var absolutePath = path2.resolve(__dirname, "./");
306
+ var {
307
+ exec: exec2,
308
+ execSync: execSync2
309
+ } = require("child_process");
310
+ var { Package: Package3, InheritClass: InheritClass2, _DataStringify, New, CONFIG, logger: logger3, serviceLoader } = require("qcobjects");
311
+ var CommandHandler2 = class extends InheritClass2 {
312
+ static {
313
+ __name(this, "CommandHandler");
314
+ }
315
+ constructor({
316
+ switchCommander
317
+ }) {
318
+ super({ switchCommander });
319
+ this.choiceOption = {
320
+ issues: /* @__PURE__ */ __name(function() {
321
+ this.getIssueList().then(function(response) {
322
+ console.log(_DataStringify(response));
323
+ }).catch((e) => {
324
+ console.log(e);
325
+ process.exit(1);
326
+ });
327
+ }, "issues")
328
+ };
329
+ const commandHandler = this;
330
+ 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:
331
+ Sub-Commands can be:
332
+ issues: To get the issues list from JIRA
333
+ `).action(function(subcommand, options) {
334
+ if (commandHandler.choiceOption.hasOwnProperty.call(commandHandler.choiceOption, subcommand)) {
335
+ commandHandler.choiceOption[subcommand].call(commandHandler, subcommand, options);
336
+ } else {
337
+ console.error(`Sub-Command (jira ${subcommand}... ) is not available`);
338
+ process.exit(1);
339
+ }
340
+ });
341
+ }
342
+ getIssueList() {
343
+ return new Promise(function(resolve, reject) {
344
+ logger3.info("I'm going to get the issue list from the jira cloud...");
345
+ const jira_config = CONFIG.get("jira", null);
346
+ if (jira_config !== null) {
347
+ const jira_username = jira_config.username;
348
+ const jira_password = jira_config.auth_token;
349
+ const jira_project = jira_config.project;
350
+ const jira_domain = jira_config.domain;
351
+ const jira_issue_fields = ["id", "key", "summary", "timetracking"];
352
+ const cloudClient = New(JiraCloud, {
353
+ domain: `${jira_domain}`,
354
+ username: `${jira_username}`,
355
+ password: `${jira_password}`,
356
+ apiMethod: "rest/api/latest/search",
357
+ data: {
358
+ "jql": `project = ${jira_project}`,
359
+ "startAt": 0,
360
+ "maxResults": 5e3,
361
+ "fields": jira_issue_fields
362
+ }
363
+ });
364
+ try {
365
+ } catch (e) {
366
+ console.error("\u{1F926} Something went wrong \u{1F926} when trying to get jira issues from the cloud");
367
+ reject(e);
368
+ }
369
+ } else {
370
+ console.error("\u{1F926} Something went wrong \u{1F926} You need to set the jira config settings");
371
+ reject(new Error("\u{1F926} Something went wrong \u{1F926} You need to set the jira config settings"));
372
+ }
373
+ });
374
+ }
375
+ };
376
+ Package3("com.qcobjects.cli.commands.jira", [
377
+ CommandHandler2
378
+ ]);
379
+ // Annotate the CommonJS export names for ESM import in node:
380
+ 0 && (module.exports = {
381
+ jiraCommand,
382
+ versionCommand
383
+ });
13
384
  //# sourceMappingURL=com.qcobjects.cli.commands.cjs.map