qcobjects-cli 2.4.66 → 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.
Files changed (205) hide show
  1. package/.github/workflows/npmpublish-beta.yml +4 -4
  2. package/.github/workflows/npmpublish-lts.yml +4 -4
  3. package/.github/workflows/npmpublish-main.yml +4 -4
  4. package/VERSION +1 -1
  5. package/build-esbuild.js +70 -0
  6. package/eslint.config.mjs +88 -0
  7. package/package.json +118 -56
  8. package/public/browser/backend/com.qcobjects.backend.microservice.static.js +318 -0
  9. package/public/browser/backend/com.qcobjects.backend.microservice.static.js.map +7 -0
  10. package/public/browser/backend/org.qcobjects.backend.php.js +290 -0
  11. package/public/browser/backend/org.qcobjects.backend.php.js.map +7 -0
  12. package/public/browser/com.qcobjects.cli.commands.jira.client_services.js +83 -0
  13. package/public/browser/com.qcobjects.cli.commands.jira.client_services.js.map +7 -0
  14. package/public/browser/com.qcobjects.cli.commands.jira.js +162 -0
  15. package/public/browser/com.qcobjects.cli.commands.jira.js.map +7 -0
  16. package/public/browser/com.qcobjects.cli.commands.js +387 -0
  17. package/public/browser/com.qcobjects.cli.commands.js.map +7 -0
  18. package/public/browser/com.qcobjects.cli.commands.version.js +247 -0
  19. package/public/browser/com.qcobjects.cli.commands.version.js.map +7 -0
  20. package/public/browser/index.js +4126 -0
  21. package/public/browser/index.js.map +7 -0
  22. package/public/browser/org.qcobjects.common.pipelog.js +56 -0
  23. package/public/browser/org.qcobjects.common.pipelog.js.map +7 -0
  24. package/public/browser/org.qcobjects.enterprise.commands.js +160 -0
  25. package/public/browser/org.qcobjects.enterprise.commands.js.map +7 -0
  26. package/public/browser/org.quickcorp.qcobjects.api.client_services.js +81 -0
  27. package/public/browser/org.quickcorp.qcobjects.api.client_services.js.map +7 -0
  28. package/public/browser/org.quickcorp.qcobjects.cli.js +4086 -0
  29. package/public/browser/org.quickcorp.qcobjects.cli.js.map +7 -0
  30. package/public/browser/org.quickcorp.qcobjects.collab.server.js +422 -0
  31. package/public/browser/org.quickcorp.qcobjects.collab.server.js.map +7 -0
  32. package/public/browser/org.quickcorp.qcobjects.defaultsettings.js +397 -0
  33. package/public/browser/org.quickcorp.qcobjects.defaultsettings.js.map +7 -0
  34. package/public/browser/org.quickcorp.qcobjects.main.file.js +248 -0
  35. package/public/browser/org.quickcorp.qcobjects.main.file.js.map +7 -0
  36. package/public/browser/org.quickcorp.qcobjects.main.http.gae.server.js +538 -0
  37. package/public/browser/org.quickcorp.qcobjects.main.http.gae.server.js.map +7 -0
  38. package/public/browser/org.quickcorp.qcobjects.main.http.server.js +600 -0
  39. package/public/browser/org.quickcorp.qcobjects.main.http.server.js.map +7 -0
  40. package/public/browser/org.quickcorp.qcobjects.main.http2.server.js +465 -0
  41. package/public/browser/org.quickcorp.qcobjects.main.http2.server.js.map +7 -0
  42. package/public/browser/qcobjects-cli.js +4118 -0
  43. package/public/browser/qcobjects-cli.js.map +7 -0
  44. package/public/browser/qcobjects-collab.js +41 -0
  45. package/public/browser/qcobjects-collab.js.map +7 -0
  46. package/public/browser/qcobjects-createcert.js +67 -0
  47. package/public/browser/qcobjects-createcert.js.map +7 -0
  48. package/public/browser/qcobjects-gae-http-server.js +41 -0
  49. package/public/browser/qcobjects-gae-http-server.js.map +7 -0
  50. package/public/browser/qcobjects-http-server.js +41 -0
  51. package/public/browser/qcobjects-http-server.js.map +7 -0
  52. package/public/browser/qcobjects-http2-server.js +44 -0
  53. package/public/browser/qcobjects-http2-server.js.map +7 -0
  54. package/public/browser/qcobjects-shell.js +50 -0
  55. package/public/browser/qcobjects-shell.js.map +7 -0
  56. package/public/browser/types/global/index.d.js +15 -0
  57. package/public/browser/types/global/index.d.js.map +7 -0
  58. package/public/cjs/backend/com.qcobjects.backend.microservice.static.cjs +305 -0
  59. package/public/cjs/backend/com.qcobjects.backend.microservice.static.cjs.map +7 -0
  60. package/public/cjs/backend/org.qcobjects.backend.php.cjs +273 -0
  61. package/public/cjs/backend/org.qcobjects.backend.php.cjs.map +7 -0
  62. package/public/cjs/com.qcobjects.cli.commands.cjs +384 -0
  63. package/public/cjs/com.qcobjects.cli.commands.cjs.map +7 -0
  64. package/public/cjs/com.qcobjects.cli.commands.jira.cjs +158 -0
  65. package/public/cjs/com.qcobjects.cli.commands.jira.cjs.map +7 -0
  66. package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs +79 -0
  67. package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs.map +7 -0
  68. package/public/cjs/com.qcobjects.cli.commands.version.cjs +243 -0
  69. package/public/cjs/com.qcobjects.cli.commands.version.cjs.map +7 -0
  70. package/public/cjs/index.cjs +4118 -0
  71. package/public/cjs/index.cjs.map +7 -0
  72. package/public/cjs/org.qcobjects.common.pipelog.cjs +52 -0
  73. package/public/cjs/org.qcobjects.common.pipelog.cjs.map +7 -0
  74. package/public/cjs/org.qcobjects.enterprise.commands.cjs +156 -0
  75. package/public/cjs/org.qcobjects.enterprise.commands.cjs.map +7 -0
  76. package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs +77 -0
  77. package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs.map +7 -0
  78. package/public/cjs/org.quickcorp.qcobjects.cli.cjs +4086 -0
  79. package/public/cjs/org.quickcorp.qcobjects.cli.cjs.map +7 -0
  80. package/public/cjs/org.quickcorp.qcobjects.collab.server.cjs +405 -0
  81. package/public/cjs/org.quickcorp.qcobjects.collab.server.cjs.map +7 -0
  82. package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs +394 -0
  83. package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs.map +7 -0
  84. package/public/cjs/org.quickcorp.qcobjects.main.file.cjs +235 -0
  85. package/public/cjs/org.quickcorp.qcobjects.main.file.cjs.map +7 -0
  86. package/public/cjs/org.quickcorp.qcobjects.main.http.gae.server.cjs +525 -0
  87. package/public/cjs/org.quickcorp.qcobjects.main.http.gae.server.cjs.map +7 -0
  88. package/public/cjs/org.quickcorp.qcobjects.main.http.server.cjs +587 -0
  89. package/public/cjs/org.quickcorp.qcobjects.main.http.server.cjs.map +7 -0
  90. package/public/cjs/org.quickcorp.qcobjects.main.http2.server.cjs +452 -0
  91. package/public/cjs/org.quickcorp.qcobjects.main.http2.server.cjs.map +7 -0
  92. package/public/cjs/qcobjects-cli.cjs +4115 -0
  93. package/public/cjs/qcobjects-cli.cjs.map +7 -0
  94. package/public/cjs/qcobjects-collab.cjs +24 -0
  95. package/public/cjs/qcobjects-collab.cjs.map +7 -0
  96. package/public/cjs/qcobjects-createcert.cjs +50 -0
  97. package/public/cjs/qcobjects-createcert.cjs.map +7 -0
  98. package/public/cjs/qcobjects-gae-http-server.cjs +24 -0
  99. package/public/cjs/qcobjects-gae-http-server.cjs.map +7 -0
  100. package/public/cjs/qcobjects-http-server.cjs +24 -0
  101. package/public/cjs/qcobjects-http-server.cjs.map +7 -0
  102. package/public/cjs/qcobjects-http2-server.cjs +27 -0
  103. package/public/cjs/qcobjects-http2-server.cjs.map +7 -0
  104. package/public/cjs/qcobjects-shell.cjs +34 -0
  105. package/public/cjs/qcobjects-shell.cjs.map +7 -0
  106. package/public/cjs/types/global/index.d.cjs +2 -0
  107. package/public/cjs/types/global/index.d.cjs.map +7 -0
  108. package/public/esm/backend/com.qcobjects.backend.microservice.static.mjs +315 -0
  109. package/public/esm/backend/com.qcobjects.backend.microservice.static.mjs.map +7 -0
  110. package/public/esm/backend/org.qcobjects.backend.php.mjs +287 -0
  111. package/public/esm/backend/org.qcobjects.backend.php.mjs.map +7 -0
  112. package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs +62 -0
  113. package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs.map +7 -0
  114. package/public/esm/com.qcobjects.cli.commands.jira.mjs +139 -0
  115. package/public/esm/com.qcobjects.cli.commands.jira.mjs.map +7 -0
  116. package/public/esm/com.qcobjects.cli.commands.mjs +368 -0
  117. package/public/esm/com.qcobjects.cli.commands.mjs.map +7 -0
  118. package/public/esm/com.qcobjects.cli.commands.version.mjs +226 -0
  119. package/public/esm/com.qcobjects.cli.commands.version.mjs.map +7 -0
  120. package/public/esm/index.mjs +4108 -0
  121. package/public/esm/index.mjs.map +7 -0
  122. package/public/esm/org.qcobjects.common.pipelog.mjs +35 -0
  123. package/public/esm/org.qcobjects.common.pipelog.mjs.map +7 -0
  124. package/public/esm/org.qcobjects.enterprise.commands.mjs +139 -0
  125. package/public/esm/org.qcobjects.enterprise.commands.mjs.map +7 -0
  126. package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs +60 -0
  127. package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs.map +7 -0
  128. package/public/esm/org.quickcorp.qcobjects.cli.mjs +4068 -0
  129. package/public/esm/org.quickcorp.qcobjects.cli.mjs.map +7 -0
  130. package/public/esm/org.quickcorp.qcobjects.collab.server.mjs +419 -0
  131. package/public/esm/org.quickcorp.qcobjects.collab.server.mjs.map +7 -0
  132. package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs +376 -0
  133. package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs.map +7 -0
  134. package/public/esm/org.quickcorp.qcobjects.main.file.mjs +245 -0
  135. package/public/esm/org.quickcorp.qcobjects.main.file.mjs.map +7 -0
  136. package/public/esm/org.quickcorp.qcobjects.main.http.gae.server.mjs +535 -0
  137. package/public/esm/org.quickcorp.qcobjects.main.http.gae.server.mjs.map +7 -0
  138. package/public/esm/org.quickcorp.qcobjects.main.http.server.mjs +597 -0
  139. package/public/esm/org.quickcorp.qcobjects.main.http.server.mjs.map +7 -0
  140. package/public/esm/org.quickcorp.qcobjects.main.http2.server.mjs +462 -0
  141. package/public/esm/org.quickcorp.qcobjects.main.http2.server.mjs.map +7 -0
  142. package/public/esm/qcobjects-cli.mjs +4100 -0
  143. package/public/esm/qcobjects-cli.mjs.map +7 -0
  144. package/public/esm/qcobjects-collab.mjs +38 -0
  145. package/public/esm/qcobjects-collab.mjs.map +7 -0
  146. package/public/esm/qcobjects-createcert.mjs +64 -0
  147. package/public/esm/qcobjects-createcert.mjs.map +7 -0
  148. package/public/esm/qcobjects-gae-http-server.mjs +38 -0
  149. package/public/esm/qcobjects-gae-http-server.mjs.map +7 -0
  150. package/public/esm/qcobjects-http-server.mjs +38 -0
  151. package/public/esm/qcobjects-http-server.mjs.map +7 -0
  152. package/public/esm/qcobjects-http2-server.mjs +41 -0
  153. package/public/esm/qcobjects-http2-server.mjs.map +7 -0
  154. package/public/esm/qcobjects-shell.mjs +26 -0
  155. package/public/esm/qcobjects-shell.mjs.map +7 -0
  156. package/public/esm/types/global/index.d.mjs +12 -0
  157. package/public/esm/types/global/index.d.mjs.map +7 -0
  158. package/public/index.d.ts +165 -0
  159. package/spec/support/jasmine.json +7 -4
  160. package/src/backend/{com.qcobjects.backend.microservice.static.js → com.qcobjects.backend.microservice.static.ts} +42 -28
  161. package/src/backend/org.qcobjects.backend.php.ts +348 -0
  162. package/src/{com.qcobjects.cli.commands.jira.client_services.js → com.qcobjects.cli.commands.jira.client_services.ts} +47 -33
  163. package/src/com.qcobjects.cli.commands.jira.ts +124 -0
  164. package/src/{com.qcobjects.cli.commands.js → com.qcobjects.cli.commands.ts} +3 -9
  165. package/src/com.qcobjects.cli.commands.version.ts +285 -0
  166. package/src/{index.mjs → index.cts} +1 -1
  167. package/src/index.mts +2 -0
  168. package/src/index.ts +1 -1
  169. package/src/{org.qcobjects.common.pipelog.js → org.qcobjects.common.pipelog.ts} +21 -18
  170. package/src/org.qcobjects.enterprise.commands.ts +174 -0
  171. package/src/{org.quickcorp.qcobjects.api.client_services.js → org.quickcorp.qcobjects.api.client_services.ts} +46 -32
  172. package/src/org.quickcorp.qcobjects.cli.ts +504 -0
  173. package/src/org.quickcorp.qcobjects.collab.server.ts +420 -0
  174. package/src/org.quickcorp.qcobjects.defaultsettings.ts +424 -0
  175. package/src/org.quickcorp.qcobjects.main.file.ts +180 -0
  176. package/src/org.quickcorp.qcobjects.main.http.gae.server.ts +507 -0
  177. package/src/org.quickcorp.qcobjects.main.http.server.ts +551 -0
  178. package/src/org.quickcorp.qcobjects.main.http2.server.ts +419 -0
  179. package/src/{qcobjects-cli.js → qcobjects-cli.ts} +10 -12
  180. package/src/{qcobjects-collab.js → qcobjects-collab.ts} +4 -4
  181. package/src/{qcobjects-createcert.js → qcobjects-createcert.ts} +5 -3
  182. package/src/{qcobjects-gae-http-server.js → qcobjects-gae-http-server.ts} +4 -4
  183. package/src/{qcobjects-http-server.js → qcobjects-http-server.ts} +4 -4
  184. package/src/{qcobjects-http2-server.js → qcobjects-http2-server.ts} +6 -8
  185. package/src/{qcobjects-shell.js → qcobjects-shell.ts} +11 -14
  186. package/src/types/global/index.d.ts +2 -0
  187. package/tsconfig.d.json +45 -3
  188. package/tsconfig.jasmine.json +39 -0
  189. package/tsconfig.json +50 -7
  190. package/.eslintignore +0 -5
  191. package/.eslintrc.cjs +0 -6
  192. package/src/backend/org.qcobjects.backend.php.js +0 -334
  193. package/src/com.qcobjects.cli.commands.jira.js +0 -144
  194. package/src/com.qcobjects.cli.commands.version.js +0 -285
  195. package/src/index.cjs +0 -2
  196. package/src/index.d.ts +0 -2
  197. package/src/org.qcobjects.enterprise.commands.js +0 -194
  198. package/src/org.quickcorp.qcobjects.cli.js +0 -523
  199. package/src/org.quickcorp.qcobjects.collab.server.js +0 -415
  200. package/src/org.quickcorp.qcobjects.defaultsettings.js +0 -397
  201. package/src/org.quickcorp.qcobjects.main.file.js +0 -159
  202. package/src/org.quickcorp.qcobjects.main.http.gae.server.js +0 -495
  203. package/src/org.quickcorp.qcobjects.main.http.server.js +0 -529
  204. package/src/org.quickcorp.qcobjects.main.http2.server.js +0 -392
  205. /package/spec/{testsSpec.js → testsSpec.ts} +0 -0
@@ -0,0 +1,124 @@
1
+ /**
2
+ * QCObjects CLI 2.4.x
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
+ /*eslint no-unused-vars: "off"*/
26
+ /*eslint no-redeclare: "off"*/
27
+ /*eslint no-empty: "off"*/
28
+ /*eslint strict: "off"*/
29
+ /*eslint no-mixed-operators: "off"*/
30
+ /*eslint no-undef: "off"*/
31
+ "use strict";
32
+ const path = require("path");
33
+ const absolutePath = path.resolve(__dirname, "./");
34
+ const {
35
+ exec,
36
+ execSync
37
+ } = require("child_process");
38
+
39
+ const { Package, InheritClass, _DataStringify, New, CONFIG, logger, serviceLoader } = require("qcobjects");
40
+
41
+ import { JiraCloud } from "./com.qcobjects.cli.commands.jira.client_services";
42
+
43
+ export class CommandHandler extends InheritClass {
44
+ constructor({
45
+ switchCommander
46
+ }: { switchCommander: any }) {
47
+ super({ switchCommander });
48
+ this.choiceOption = {
49
+ issues: function () {
50
+
51
+ this.getIssueList().then(function (response: any) {
52
+ console.log(_DataStringify(response));
53
+ }).catch((e: any) => {
54
+ console.log(e);
55
+ process.exit(1);
56
+ });
57
+
58
+ }
59
+ };
60
+
61
+ const commandHandler = this;
62
+
63
+ switchCommander.program.command("jira <subcommand>")
64
+ .option("-u, --from-user [username]", "User name")
65
+ .option("-fp,--from-project <projectName>", "Project name")
66
+ .option("-p, --pwd <password>", "Password")
67
+ .option("-f, --format <format>", "Format (json, table)")
68
+ .description(`Jira Integration:
69
+ Sub-Commands can be:
70
+ issues: To get the issues list from JIRA
71
+ `)
72
+ .action(function (subcommand: string | number, options: any) {
73
+ if (commandHandler.choiceOption.hasOwnProperty.call(commandHandler.choiceOption, subcommand)) {
74
+ commandHandler.choiceOption[subcommand].call(commandHandler, subcommand, options);
75
+ } else {
76
+ console.error(`Sub-Command (jira ${subcommand}... ) is not available`);
77
+ process.exit(1);
78
+ }
79
+ });
80
+
81
+ }
82
+
83
+ getIssueList() {
84
+ return new Promise<void>(function (resolve, reject) {
85
+ logger.info("I'm going to get the issue list from the jira cloud...");
86
+ const jira_config = CONFIG.get("jira", null);
87
+ if (jira_config !== null) {
88
+ const jira_username = jira_config.username;
89
+ const jira_password = jira_config.auth_token;
90
+ const jira_project = jira_config.project;
91
+ const jira_domain = jira_config.domain;
92
+ const jira_issue_fields = ["id", "key", "summary", "timetracking"];
93
+ const cloudClient = New(JiraCloud, {
94
+ domain: `${jira_domain}`,
95
+ username: `${jira_username}`,
96
+ password: `${jira_password}`,
97
+ apiMethod: "rest/api/latest/search",
98
+ data: {
99
+ "jql": `project = ${jira_project}`,
100
+ "startAt": 0,
101
+ "maxResults": 5000,
102
+ "fields": jira_issue_fields
103
+ }
104
+ });
105
+ try {
106
+ } catch (e) {
107
+ console.error("\u{1F926} Something went wrong \u{1F926} when trying to get jira issues from the cloud");
108
+ reject(e as Error);
109
+ }
110
+
111
+ } else {
112
+ console.error("\u{1F926} Something went wrong \u{1F926} You need to set the jira config settings");
113
+ reject(new Error("\u{1F926} Something went wrong \u{1F926} You need to set the jira config settings"));
114
+ }
115
+
116
+ });
117
+ }
118
+
119
+
120
+ }
121
+
122
+ Package("com.qcobjects.cli.commands.jira", [
123
+ CommandHandler
124
+ ]);
@@ -29,14 +29,8 @@
29
29
  /*eslint no-mixed-operators: "off"*/
30
30
  /*eslint no-undef: "off"*/
31
31
  "use strict";
32
- const fs = require("fs");
33
- const path = require("path");
34
- const absolutePath = path.resolve( __dirname, "./" );
35
- const templatePath = path.resolve( __dirname, "./templates/apps/" )+"/";
36
- const templatePwaPath = path.resolve( __dirname, "./templates/pwa/" )+"/";
37
- const package_config = require(absolutePath+"/../package.json");
38
- const { exec,execSync } = require("child_process");
39
32
 
40
33
  // plugin commands here
41
- require(absolutePath+"/com.qcobjects.cli.commands.version");
42
- require(absolutePath+"/com.qcobjects.cli.commands.jira");
34
+
35
+ export * as versionCommand from "./com.qcobjects.cli.commands.version";
36
+ export * as jiraCommand from "./com.qcobjects.cli.commands.jira";
@@ -0,0 +1,285 @@
1
+ /**
2
+ * QCObjects CLI 2.4.x
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
+ /*eslint no-unused-vars: "off"*/
26
+ /*eslint no-redeclare: "off"*/
27
+ /*eslint no-empty: "off"*/
28
+ /*eslint strict: "off"*/
29
+ /*eslint no-mixed-operators: "off"*/
30
+ /*eslint no-undef: "off"*/
31
+ "use strict";
32
+ const fs = require("fs");
33
+ const path = require("path");
34
+ const { exec, execSync } = require("child_process");
35
+
36
+ const { Package, InheritClass, logger } = require("qcobjects");
37
+
38
+ export class CommandHandler extends InheritClass {
39
+
40
+ constructor({ switchCommander }: { switchCommander: any }) {
41
+ super({ switchCommander });
42
+
43
+ const commandHandler = this;
44
+
45
+ this.choiceOption = {
46
+ v_major(filename: string, options: any) {
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: minor, patch: 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: string, options: any) {
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: major, minor: minor + 1, patch: 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: string, options: any) {
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: major, minor: 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: string, options: any) {
92
+ filename = (typeof filename === "undefined") ? ("VERSION") : (filename);
93
+ var commandHandler = this;
94
+ commandHandler.switchCommander.shellCommands([
95
+ "echo $(git describe)"
96
+ ]).then(function (response: any) {
97
+ const versionString = response[0].split("-")[0].slice(1).replace("\n", "");
98
+ console.log(versionString);
99
+ const versionSuffix = commandHandler.parseVersionSuffix(versionString);
100
+ const versionObject = commandHandler.parseVersionString(versionString);
101
+ const major = parseInt(versionObject.major);
102
+ const minor = parseInt(versionObject.minor);
103
+ const patch = parseInt(versionObject.patch);
104
+ const newVersion = commandHandler.buildNewVersionString({ major: major, minor: minor, patch: patch }, versionSuffix);
105
+ commandHandler.saveNewVersionFile(filename, newVersion);
106
+ var commitMsg = options.commitMsg || `Synced Version v${newVersion}`;
107
+ commandHandler.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 (response: any) {
117
+ console.log(response);
118
+ });
119
+ });
120
+ },
121
+ v_changelog() {
122
+ const commandHandler = this;
123
+ commandHandler.switchCommander.shellCommands(
124
+ [
125
+ "git tag -ln"
126
+ ]
127
+ ).then(function (response: any) {
128
+ var versionTags = response[0].split("\n").map((tag: any) => tag.split(" ").unique()).unique().map(
129
+ (tag: any) => {
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: { version: string; }) => tag.version !== "").map((tag: { version: string; }) => tag.version.split(".")[0] + "." + tag.version.split(".")[1]).unique();
139
+ var history = minorVersionTags.map((minor: string) => {
140
+ return {
141
+ "major": minor.split(".")[0],
142
+ "minor": minor,
143
+ "history": "\n\t- " + versionTags.filter((tag: { minor: any; }) => tag.minor === minor).map(
144
+ function (tag: { description: any; }) {
145
+ return tag.description;
146
+ }
147
+ ).filter((desc: string) => !desc.startsWith(minor.slice(1))).sort().unique().join("\n\t- ")
148
+ };
149
+ }).map((hist: { major: any; minor: any; history: string; }) => { return `## ${hist.major} -> ${hist.minor}` + "\n" + hist.history; }).join("\n");
150
+ const subtitle = "This is an automatic Changelog history of versions generated using the command: **qcobjects v-changelog > CHANGELOG.md**";
151
+ console.log("# Changelog \n\n" + subtitle + "\n\n" + history);
152
+
153
+ });
154
+ }
155
+ };
156
+
157
+ switchCommander.program.command("v-major [filename]")
158
+ .option("--git, --sync-git", "Sync with Git")
159
+ .option("--npm, --sync-npm", "Sync with NPM")
160
+ .option("-m, --commit-msg [message]", "Commit Message")
161
+ .description("Semantic Versioning: Upgrade to a new major version")
162
+ .action(function (args: any, options: any) {
163
+ commandHandler.choiceOption.v_major.call(commandHandler, args, options);
164
+ });
165
+ switchCommander.program.command("v-minor [filename]")
166
+ .option("--git, --sync-git", "Sync with Git")
167
+ .option("--npm, --sync-npm", "Sync with NPM")
168
+ .option("-m, --commit-msg [message]", "Commit Message")
169
+ .description("Semantic Versioning: Upgrade to a new minor version")
170
+ .action(function (args: any, options: any) {
171
+ commandHandler.choiceOption.v_minor.call(commandHandler, args, options);
172
+ });
173
+
174
+ switchCommander.program.command("v-patch [filename]")
175
+ .option("--git, --sync-git", "Sync with Git")
176
+ .option("--npm, --sync-npm", "Sync with NPM")
177
+ .option("-m, --commit-msg [message]", "Commit Message")
178
+ .description("Semantic Versioning: Upgrade to a new patch version")
179
+ .action(function (args: any, options: any) {
180
+ commandHandler.choiceOption.v_patch.call(commandHandler, args, options);
181
+ });
182
+
183
+ switchCommander.program.command("v-sync [filename]")
184
+ .option("-m, --commit-msg [message]", "Commit Message")
185
+ .description("Semantic Versioning: Sync the version of NPM with version of GIT")
186
+ .action(function (args: any, options: any) {
187
+ commandHandler.choiceOption.v_sync.call(commandHandler, args, options);
188
+ });
189
+
190
+ switchCommander.program.command("v-changelog")
191
+ .description("Semantic Versioning: Shows a changelog using Semantic Versioning")
192
+ .action(function (args: any, options: any) {
193
+ commandHandler.choiceOption.v_changelog.call(commandHandler, args, options);
194
+ });
195
+
196
+
197
+ }
198
+
199
+
200
+ syncGit(versionString: any, commitMsg: any, syncNpm = false) {
201
+ let _commands_: any[] = [];
202
+ if (syncNpm) {
203
+ _commands_ = _commands_.concat(
204
+ [
205
+ "git fetch --tags -f",
206
+ `npm version "${versionString}" -m "${commitMsg}"`
207
+ ]
208
+ );
209
+ }
210
+ _commands_ = _commands_.concat(
211
+ [
212
+ `git add . && git commit -am "${commitMsg}"`,
213
+ "git fetch origin --tags",
214
+ "git tag -ln"
215
+ ]);
216
+
217
+ if (!syncNpm) {
218
+ _commands_ = _commands_.concat(
219
+ [
220
+ `git tag -a "v${versionString}" -m "${commitMsg}"`,
221
+ ]
222
+ );
223
+ }
224
+
225
+ _commands_ = _commands_.concat([
226
+ "git push && git push --tags"
227
+ ]
228
+ );
229
+
230
+ this.switchCommander.shellCommands(_commands_).then(function (response: any) {
231
+ logger.info("Synced to Git");
232
+ logger.debug(response);
233
+ }).catch(function (e: any) {
234
+ logger.info("Something went wrong trying to sync to git");
235
+ logger.debug(e);
236
+ });
237
+ }
238
+
239
+ parseVersionString(versionString: string): { major: string, minor: string, patch: string } {
240
+ versionString = versionString.replace("\n", "");
241
+ 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-]+)*))?$/;
242
+ const versionObject = { ...versionString.match(regexpVer)?.groups };
243
+ return versionObject as { major: string, minor: string, patch: string };
244
+ }
245
+
246
+ getVersionStringFromFile(filename: any) {
247
+ let versionString;
248
+ try {
249
+ versionString = fs.readFileSync(filename).toString().replace("\n", "");
250
+ } catch (e) {
251
+ versionString = "0.0.1";
252
+ }
253
+ return versionString;
254
+ }
255
+
256
+ buildNewSemVersionString({ major, minor, patch }: { major: string, minor: string, patch: string }) {
257
+ return `${major}.${minor}.${patch}`;
258
+ }
259
+
260
+ parseVersionSuffix(versionString: string) {
261
+ versionString = versionString.replace("\n", "");
262
+ const versionObject = this.parseVersionString(versionString);
263
+ const semVersionString = this.buildNewSemVersionString(versionObject);
264
+ return versionString.replace(semVersionString, "");
265
+ }
266
+
267
+ buildNewVersionString({ major, minor, patch }: any, suffix: any) {
268
+ const semVersionString = this.buildNewSemVersionString({ major, minor, patch });
269
+ return `${semVersionString}${suffix}`;
270
+ }
271
+
272
+ saveNewVersionFile(filename: any, versionString: any) {
273
+ fs.writeFileSync(filename, versionString);
274
+ }
275
+
276
+
277
+
278
+
279
+
280
+ }
281
+
282
+
283
+ Package("com.qcobjects.cli.commands.version", [
284
+ CommandHandler
285
+ ]);
@@ -1,2 +1,2 @@
1
1
  import cli from "./qcobjects-cli";
2
- export default cli;
2
+ module.exports = cli;
package/src/index.mts ADDED
@@ -0,0 +1,2 @@
1
+ import cli from "./qcobjects-cli.js";
2
+ export default cli;
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- import * as cli from "./qcobjects-cli";
1
+ import * as cli from "./qcobjects-cli.js";
2
2
  export default cli;
@@ -29,27 +29,30 @@
29
29
  /*eslint no-mixed-operators: "off"*/
30
30
  /*eslint no-undef: "off"*/
31
31
  "use strict";
32
- Package("org.qcobjects.common.pipelog", [
33
- class PipeLog extends InheritClass {
34
- constructor() {
35
- super(...arguments);
36
- }
37
32
 
38
- pipe(o) {
39
- var _o = [];
40
- for (var k in o) {
41
- if (typeof o[k] !== "undefined" &&
42
- o[k] !== null &&
43
- typeof o[k] !== "function") {
44
- try {
45
- _o.push("" + k + "=" + o[k].toString());
46
- } catch (e) {
47
- // error logging, do nothing
48
- }
33
+ const {Package, InheritClass} = require("qcobjects");
34
+
35
+ export class PipeLog extends InheritClass {
36
+
37
+ pipe(o:any) {
38
+ var _o = [];
39
+ for (var k in o) {
40
+ if (typeof o[k] !== "undefined" &&
41
+ o[k] !== null &&
42
+ typeof o[k] !== "function") {
43
+ try {
44
+ _o.push("" + k + "=" + o[k].toString());
45
+ } catch (e) {
46
+ // error logging, do nothing
49
47
  }
50
48
  }
51
- return _o.join(" ");
52
49
  }
53
-
50
+ return _o.join(" ");
54
51
  }
52
+
53
+ }
54
+
55
+
56
+ Package("org.qcobjects.common.pipelog", [
57
+ PipeLog
55
58
  ]);
@@ -0,0 +1,174 @@
1
+ /**
2
+ * QCObjects CLI 2.4.x
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
+ /*eslint no-unused-vars: "off"*/
26
+ /*eslint no-redeclare: "off"*/
27
+ /*eslint no-empty: "off"*/
28
+ /*eslint strict: "off"*/
29
+ /*eslint no-mixed-operators: "off"*/
30
+ /*eslint no-undef: "off"*/
31
+ "use strict";
32
+
33
+ import { execSync } from "node:child_process";
34
+
35
+ const { Package, InheritClass, CONFIG, logger } = require("qcobjects");
36
+ const license = CONFIG.get("enterprise-license", "1234");
37
+ const email = CONFIG.get("enterprise-email", "a@b.com");
38
+
39
+ export class QCObjectsEnterprise extends InheritClass {
40
+
41
+ install() {
42
+ const instance = this;
43
+ return instance.installEnterprise(license, email);
44
+ }
45
+
46
+ upgrade(switchCommander: any) {
47
+ const instance = this;
48
+ const readline = require("readline");
49
+
50
+ const rl = readline.createInterface({
51
+ input: process.stdin,
52
+ output: process.stdout
53
+ });
54
+
55
+ var emailQuestion = function () {
56
+ rl.question(`
57
+ [NOTE: No information will be sent to a server until I got your consent]
58
+
59
+ Please tell me your e-Mail (\u{1F48C}):
60
+ `, (email: string) => {
61
+ if (email !== "") {
62
+ var phoneNumberQuestion = function () {
63
+ rl.question("Please tell me your phone number (\u{1F919}): \n", (phonenumber: string) => {
64
+ if (phonenumber !== "") {
65
+ rl.question(`
66
+ Please select one of the following options (type a number):
67
+
68
+ 1.- \u{1F640} This is your first interaction \u{1F60D} with QCObjects Enterprise Edition \u{1F3E2},
69
+ you want to send your email and phone number to one of our executives to process your
70
+ inquiry, pay the license (when aplies) and receive a new fresh license number
71
+ that will free up to you the most advanced features for large companies
72
+
73
+ 2.- \u{2714} Your assigned executive \u{1F9D1} has given to you a new fresh QCObjects Enterprise Edition License Number
74
+ and you want to enter it to follow up with the next steps.
75
+
76
+ 3.- \u{1F3C3} You want to quit this form, as you got here accidentally
77
+ (You should think about it. It's not a coincidence, It's destiny \u{1F600}).
78
+
79
+ Please enter the number of the option and press [enter]: `, (interaction_option: any) => {
80
+ logger.infoEnabled = true;
81
+
82
+ switch (interaction_option) {
83
+ case "1":
84
+ switchCommander.register(email, phonenumber).then(function () {
85
+ logger.info(`\u{1F44F} Congrats! You have been successfully registered to the cloud! \u{1F44F}
86
+ One of our executives will be in touch with you as soon as possible to give you the next steps
87
+ to get a new License Number and start using QCObjects Entrprise Edition!
88
+
89
+ (In the meantime, you can continue using all the features of the QCObjects Community Edition)
90
+ `);
91
+ rl.close();
92
+ }).catch(() => {
93
+ rl.close();
94
+ });
95
+ break;
96
+ case "2":
97
+ rl.stdoutMuted = true;
98
+ rl._writeToOutput = function _writeToOutput(stringToWrite: any) {
99
+ if (rl.stdoutMuted)
100
+ rl.output.write("*");
101
+ else
102
+ rl.output.write(stringToWrite);
103
+ };
104
+ rl.question("Please tell me the number of license that your executive has given to you: \n", (license: any) => {
105
+ rl.stdoutMuted = false;
106
+ instance.installEnterprise(license, email);
107
+
108
+ rl.close();
109
+ });
110
+
111
+ break;
112
+ default:
113
+ logger.info("\u{1F937} You can continue to use QCObjects Community Edition, see you! \u{1F64B} ");
114
+ rl.close();
115
+ break;
116
+ }
117
+
118
+ });
119
+
120
+ } else {
121
+ console.log(`You need to enter a Phone Number if you want to be contacted.
122
+ If you want to quit, press Ctrl-C.
123
+ `);
124
+ phoneNumberQuestion();
125
+ }
126
+ });
127
+ };
128
+ phoneNumberQuestion();
129
+
130
+ } else {
131
+ console.log(`You need to enter a real e-Mail adress if you want to be contacted.
132
+ If you want to quit, press Ctrl-C.
133
+ `);
134
+ emailQuestion();
135
+ }
136
+ });
137
+
138
+ };
139
+ emailQuestion();
140
+
141
+ }
142
+
143
+ installEnterprise(license: string | any[], email: any) {
144
+ const asterisk = "*";
145
+
146
+ logger.info(`Your entered license number is ${asterisk.repeat(license.length)} and the email that you have entered is ${email}`);
147
+ logger.info("Now, I'm installing QCObjects Enterprise Edition in your computer...");
148
+ const cmdDownloadGit = `npm i --force -g git+https://license:${license}@software.qcobjects.io/qcobjects-enterprise/qcobjects-enterprise.git`;
149
+ execSync(cmdDownloadGit);
150
+ const stdout = execSync("qcobjects --version");
151
+ if (stdout.lastIndexOf("Enterprise Edition") !== -1) {
152
+ logger.info("\u{1F44F} Congrats! Now you have installed QCObjects Entrprise Edition! \u{1F44F}");
153
+ logger.info(`You can test it using:
154
+ > qcobjects --version
155
+
156
+ To find more help, type the command:
157
+
158
+ > qcobjects --help
159
+
160
+ Enjoy!
161
+ `);
162
+ } else {
163
+ console.log("\u{1F926} Something went wrong \u{1F926} when trying to update your license to QCObjects Enterprise Edition");
164
+ console.log("Ask your executive to help");
165
+ }
166
+
167
+ }
168
+
169
+ }
170
+
171
+ Package("org.qcobjects.enterprise.commands", [
172
+ QCObjectsEnterprise
173
+ ]);
174
+