qcobjects-cli 2.3.50 → 2.4.21

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 (36) hide show
  1. package/.github/FUNDING.yml +12 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  3. package/.github/ISSUE_TEMPLATE/custom.md +10 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. package/.github/ISSUE_TEMPLATE/issue-template.md +33 -0
  6. package/.github/workflows/codeql-analysis.yml +71 -0
  7. package/.github/workflows/npmpublish-beta.yml +38 -0
  8. package/.github/workflows/npmpublish-lts.yml +38 -0
  9. package/.github/workflows/npmpublish-main.yml +38 -0
  10. package/.gitlab-ci.yml +3 -2
  11. package/VERSION +1 -1
  12. package/backend/com.qcobjects.backend.microservice.static.js +40 -24
  13. package/backend/org.qcobjects.backend.php.js +149 -116
  14. package/{org.quickcorp.qcobjects.cli.commands.jira.client_services.js → com.qcobjects.cli.commands.jira.client_services.js} +29 -22
  15. package/{org.quickcorp.qcobjects.cli.commands.jira.js → com.qcobjects.cli.commands.jira.js} +77 -60
  16. package/{org.quickcorp.qcobjects.cli.commands.js → com.qcobjects.cli.commands.js} +3 -3
  17. package/com.qcobjects.cli.commands.version.js +285 -0
  18. package/org.qcobjects.common.pipelog.js +55 -0
  19. package/org.qcobjects.enterprise.commands.js +149 -139
  20. package/org.quickcorp.qcobjects.api.client_services.js +31 -20
  21. package/org.quickcorp.qcobjects.cli.js +288 -275
  22. package/org.quickcorp.qcobjects.collab.server.js +317 -308
  23. package/org.quickcorp.qcobjects.defaultsettings.js +1 -1
  24. package/org.quickcorp.qcobjects.main.file.js +100 -79
  25. package/org.quickcorp.qcobjects.main.http.gae.server.js +264 -232
  26. package/org.quickcorp.qcobjects.main.http.server.js +155 -145
  27. package/org.quickcorp.qcobjects.main.http2.server.js +198 -191
  28. package/package.json +18 -10
  29. package/qcobjects-cli.js +8 -11
  30. package/qcobjects-collab.js +8 -6
  31. package/qcobjects-createcert.js +28 -16
  32. package/qcobjects-gae-http-server.js +8 -5
  33. package/qcobjects-http-server.js +7 -5
  34. package/qcobjects-http2-server.js +8 -5
  35. package/qcobjects-shell.js +113 -107
  36. package/org.quickcorp.qcobjects.cli.commands.version.js +0 -267
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * QCObjects CLI 2.3.x
3
+ * QCObjects CLI 2.4.x
4
4
  * ________________
5
5
  *
6
6
  * Author: Jean Machuca <correojean@gmail.com>
@@ -38,20 +38,32 @@ require("qcobjects");
38
38
 
39
39
  require(absolutePath+"/org.quickcorp.qcobjects.defaultsettings.js");
40
40
 
41
-
42
41
  const { execSync } = require("child_process");
43
- const certificate_provider = CONFIG.get("certificate_provider","self_signed");
44
- let stdout;
45
- switch (certificate_provider) {
46
- case "self_signed":
47
- // stderr is sent to stderr of parent process
48
- // you can set options.stdio if you want it to go elsewhere
49
- stdout = execSync("openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN="+CONFIG.get("domain")+"' -keyout "+CONFIG.get("private-key-pem")+" -out "+CONFIG.get("private-cert-pem"));
50
- break;
51
- case "letsencrypt":
52
- var prehook_posthook = "--pre-hook \"service qcobjects stop\" --post-hook=\"service qcobjects start\"";
53
- stdout = execSync(`certbot -n -d ${CONFIG.get("domain")} certonly --standalone ${prehook_posthook}`);
54
- break;
55
- default:
56
- break;
42
+
43
+ class Main extends InheritClass {
44
+ constructor (){
45
+ super(...arguments);
46
+ this.start();
47
+ }
48
+
49
+ start (){
50
+ const certificate_provider = CONFIG.get("certificate_provider","self_signed");
51
+ let stdout;
52
+ switch (certificate_provider) {
53
+ case "self_signed":
54
+ // stderr is sent to stderr of parent process
55
+ // you can set options.stdio if you want it to go elsewhere
56
+ stdout = execSync("openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN="+CONFIG.get("domain")+"' -keyout "+CONFIG.get("private-key-pem")+" -out "+CONFIG.get("private-cert-pem"));
57
+ break;
58
+ case "letsencrypt":
59
+ var prehook_posthook = "--pre-hook \"service qcobjects stop\" --post-hook=\"service qcobjects start\"";
60
+ stdout = execSync(`certbot -n -d ${CONFIG.get("domain")} certonly --standalone ${prehook_posthook}`);
61
+ break;
62
+ default:
63
+ break;
64
+ }
65
+
66
+ }
57
67
  }
68
+
69
+ let __main__ = new Main();
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * QCObjects CLI 2.3.x
3
+ * QCObjects CLI 2.4.x
4
4
  * ________________
5
5
  *
6
6
  * Author: Jean Machuca <correojean@gmail.com>
@@ -39,13 +39,16 @@ require(absolutePath+"/org.quickcorp.qcobjects.defaultsettings.js");
39
39
 
40
40
  require(absolutePath+"/org.quickcorp.qcobjects.main.http.gae.server.js");
41
41
 
42
- Class("Main",{
43
- _new_:()=>{
42
+ class Main extends InheritClass {
43
+
44
+ constructor (){
45
+ super(...arguments);
44
46
  const app = New(HTTPServer);
45
47
  app.start();
46
48
 
47
49
  logger.debug("initialized");
50
+
48
51
  }
49
- });
52
+ }
50
53
 
51
- let __main__ = New(Main);
54
+ let __main__ = new Main ();
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * QCObjects CLI 2.3.x
3
+ * QCObjects CLI 2.4.x
4
4
  * ________________
5
5
  *
6
6
  * Author: Jean Machuca <correojean@gmail.com>
@@ -39,13 +39,15 @@ require(absolutePath+"/org.quickcorp.qcobjects.defaultsettings.js");
39
39
 
40
40
  require(absolutePath+"/org.quickcorp.qcobjects.main.http.server.js");
41
41
 
42
- Class("Main",{
43
- _new_:()=>{
42
+ class Main extends InheritClass {
43
+ constructor(){
44
+ super(...arguments);
44
45
  const app = New(HTTPServer);
45
46
  app.start();
46
47
 
47
48
  logger.debug("initialized");
49
+
48
50
  }
49
- });
51
+ }
50
52
 
51
- let __main__ = New(Main);
53
+ let __main__ = new Main();
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * QCObjects CLI 2.3.x
3
+ * QCObjects CLI 2.4.x
4
4
  * ________________
5
5
  *
6
6
  * Author: Jean Machuca <correojean@gmail.com>
@@ -43,14 +43,17 @@ if (CONFIG.get("useLegacyHTTP",false)){
43
43
  require(absolutePath+"/org.quickcorp.qcobjects.main.http2.server.js");
44
44
  }
45
45
 
46
- Class("Main",{
47
- _new_:()=>{
46
+ class Main extends InheritClass {
47
+ constructor (){
48
+ super(...arguments);
48
49
  const _ServerClass_ = (CONFIG.get("useLegacyHTTP",false))? (HTTPServer): (HTTP2Server);
49
50
  const app = New(_ServerClass_);
50
51
  app.start();
51
52
 
52
53
  logger.debug("initialized");
54
+
53
55
  }
54
- });
55
56
 
56
- let __main__ = New(Main);
57
+ }
58
+
59
+ let __main__ = new Main();
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * QCObjects CLI 2.3.x
3
+ * QCObjects CLI 2.4.x
4
4
  * ________________
5
5
  *
6
6
  * Author: Jean Machuca <correojean@gmail.com>
@@ -43,118 +43,124 @@ const vm = require("vm");
43
43
  require("qcobjects");
44
44
 
45
45
  require(absolutePath+"/org.quickcorp.qcobjects.defaultsettings.js");
46
-
46
+ const readline = require("readline");
47
47
 
48
48
  const package_config = require(absolutePath+"/package.json");
49
49
  const qcobjects_pkg_config = require("qcobjects/package.json");
50
50
  const qcobjects_sdk_pkg_config = require("qcobjects-sdk/package.json");
51
51
 
52
- let sandbox = {
53
- require:require,
54
- module:module,
55
- __dirname:"./",
56
- __filename:"qcobjects-shell-file.js"
57
- };
58
- global.context = vm.createContext(sandbox);
59
-
60
-
61
- const runScript = (code,logOutput=false)=>{
62
- const options = {filename:sandbox.__filename};
63
-
64
- const backgroundRunScript = (code)=>{
65
- var output = vm.runInContext(code,global.context,options);
66
- return output;
67
- };
68
-
69
- var output = backgroundRunScript(code);
70
-
71
-
72
- if (logOutput && typeof output !== "undefined"){
73
- console.log(output);
52
+ class Main extends InheritClass {
53
+ constructor(){
54
+ super(...arguments);
55
+ this.start();
74
56
  }
75
- };
76
-
77
- const syncGlobal = ()=>{
78
- var s = "Object.assign(this,this.constructor.constructor('return this')())";
79
- runScript(s);
80
- };
81
-
82
57
 
83
- const readline = require("readline");
84
- readline.emitKeypressEvents(process.stdin);
85
- if (process.stdin.isTTY)
86
- process.stdin.setRawMode(true);
87
-
88
- let qcobjects_version = global.__get_version_string__();
89
-
90
- const rl = readline.createInterface({
91
- input: process.stdin,
92
- output: process.stdout,
93
- prompt: qcobjects_version + " >"
94
- });
95
-
96
- const protected_symbols = [ "clearInterval",
97
- "clearTimeout",
98
- "setInterval",
99
- "setTimeout", "queueMicrotask",
100
- "clearImmediate", "setImmediate", "_asyncLoad",
101
- "_fireAsyncLoad", "asyncLoad", "logger",
102
- "_Crypt", "CONFIG", "waitUntil",
103
- "_super_", "ComplexStorageCache", "TagElements",
104
- "onload", "InheritClass", "Component",
105
- "Controller", "View", "Service",
106
- "JSONService", "ConfigService", "VO",
107
- "serviceLoader", "componentLoader", "ComponentURI",
108
- "SourceJS", "SourceCSS", "ArrayList",
109
- "ArrayCollection", "Effect", "Timer",
110
- "Export", "Import", "Package",
111
- "Class", "New", "Tag",
112
- "Ready", "Contact", "FormField",
113
- "ButtonField", "InputField", "TextField",
114
- "EmailField", "GridComponent", "GridController",
115
- "GridView", "Move", "RotateX",
116
- "RotateY", "RotateZ", "Rotate",
117
- "Fade", "Radius", "CanvasTool",
118
- "BasicLayout"
119
- ];
120
-
121
- const preloaded_scripts = [
122
- "require('qcobjects')",
123
- "Object.assign(this,this.constructor.constructor('return this')())"
124
- ];
125
-
126
- preloaded_scripts.map(preloaded_script =>
127
- runScript(preloaded_script.trim())
128
- );
129
-
130
-
131
- console.log(welcometo);
132
- console.log(logo);
133
- console.log(instructions);
134
- rl.prompt(true);
135
-
136
- rl.on("line", (line) => {
137
- var codeline = line.trim();
138
- switch (true) {
139
- case codeline=="hello":
140
- console.log("world!");
141
- break;
142
- case codeline==".exit":
143
- rl.close();
144
- break;
145
- default:
146
- try{
147
- runScript(codeline,true);
148
- syncGlobal(sandbox);
149
- }catch (e){
150
- console.log("An exeption ocurred while trying to run your awesome code! ");
151
- console.log(e);
58
+ start (){
59
+ let sandbox = {
60
+ require:require,
61
+ module:module,
62
+ __dirname:"./",
63
+ __filename:"qcobjects-shell-file.js"
64
+ };
65
+ global.context = vm.createContext(sandbox);
66
+
67
+ const runScript = (code,logOutput=false)=>{
68
+ const options = {filename:sandbox.__filename};
69
+
70
+ const backgroundRunScript = (code)=>{
71
+ var output = vm.runInContext(code,global.context,options);
72
+ return output;
73
+ };
74
+
75
+ var output = backgroundRunScript(code);
76
+
77
+ if (logOutput && typeof output !== "undefined"){
78
+ console.log(output);
79
+ }
80
+ };
81
+
82
+ const syncGlobal = ()=>{
83
+ var s = "Object.assign(this,this.constructor.constructor('return this')())";
84
+ runScript(s);
85
+ };
86
+
87
+ readline.emitKeypressEvents(process.stdin);
88
+ if (process.stdin.isTTY)
89
+ process.stdin.setRawMode(true);
90
+
91
+ let qcobjects_version = global.__get_version_string__();
92
+
93
+ const rl = readline.createInterface({
94
+ input: process.stdin,
95
+ output: process.stdout,
96
+ prompt: qcobjects_version + " >"
97
+ });
98
+
99
+ const protected_symbols = [ "clearInterval",
100
+ "clearTimeout",
101
+ "setInterval",
102
+ "setTimeout", "queueMicrotask",
103
+ "clearImmediate", "setImmediate", "_asyncLoad",
104
+ "_fireAsyncLoad", "asyncLoad", "logger",
105
+ "_Crypt", "CONFIG", "waitUntil",
106
+ "_super_", "ComplexStorageCache", "TagElements",
107
+ "onload", "InheritClass", "Component",
108
+ "Controller", "View", "Service",
109
+ "JSONService", "ConfigService", "VO",
110
+ "serviceLoader", "componentLoader", "ComponentURI",
111
+ "SourceJS", "SourceCSS", "ArrayList",
112
+ "ArrayCollection", "Effect", "Timer",
113
+ "Export", "Import", "Package",
114
+ "Class", "New", "Tag",
115
+ "Ready", "Contact", "FormField",
116
+ "ButtonField", "InputField", "TextField",
117
+ "EmailField", "GridComponent", "GridController",
118
+ "GridView", "Move", "RotateX",
119
+ "RotateY", "RotateZ", "Rotate",
120
+ "Fade", "Radius", "CanvasTool",
121
+ "BasicLayout"
122
+ ];
123
+
124
+ const preloaded_scripts = [
125
+ "require('qcobjects')",
126
+ "Object.assign(this,this.constructor.constructor('return this')())"
127
+ ];
128
+
129
+ preloaded_scripts.map(preloaded_script =>
130
+ runScript(preloaded_script.trim())
131
+ );
132
+
133
+
134
+ console.log(welcometo);
135
+ console.log(logo);
136
+ console.log(instructions);
137
+ rl.prompt(true);
138
+
139
+ rl.on("line", (line) => {
140
+ var codeline = line.trim();
141
+ switch (true) {
142
+ case codeline=="hello":
143
+ console.log("world!");
144
+ break;
145
+ case codeline==".exit":
146
+ rl.close();
147
+ break;
148
+ default:
149
+ try{
150
+ runScript(codeline,true);
151
+ syncGlobal(sandbox);
152
+ }catch (e){
153
+ console.log("An exeption ocurred while trying to run your awesome code! ");
154
+ console.log(e);
155
+ }
156
+ break;
152
157
  }
153
- break;
158
+ rl.prompt();
159
+ }).on("close", () => {
160
+ console.log("Thank you for using QCObjects.");
161
+ console.log("Have a nice day!");
162
+ process.exit(0);
163
+ });
164
+
154
165
  }
155
- rl.prompt();
156
- }).on("close", () => {
157
- console.log("Thank you for using QCObjects.");
158
- console.log("Have a nice day!");
159
- process.exit(0);
160
- });
166
+ }
@@ -1,267 +0,0 @@
1
- /**
2
- * QCObjects CLI 2.3.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 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
-
40
- Package("org.quickcorp.qcobjects.cli.commands.version",[
41
- Class("CommandHandler",{
42
- switchCommander:null,
43
- syncGit: function (versionString,commitMsg, syncNpm = false){
44
- let _commands_ = [];
45
- if (syncNpm){
46
- _commands_ = _commands_.concat(
47
- [
48
- "git fetch --tags -f",
49
- `npm version "${versionString}" -m "${commitMsg}"`
50
- ]
51
- );
52
- }
53
- _commands_ = _commands_.concat(
54
- [
55
- `git add . && git commit -am "${commitMsg}"`,
56
- "git fetch origin --tags",
57
- "git tag -ln"
58
- ]);
59
-
60
- if (!syncNpm){
61
- _commands_ = _commands_.concat(
62
- [
63
- `git tag -a "v${versionString}" -m "${commitMsg}"`,
64
- ]
65
- );
66
- }
67
-
68
- _commands_ = _commands_.concat([
69
- "git push && git push --tags"
70
- ]
71
- );
72
-
73
- this.switchCommander.shellCommands(_commands_).then(function (response){
74
- logger.info("Synced to Git");
75
- logger.debug(response);
76
- }).catch (function (e){
77
- logger.info("Something went wrong trying to sync to git");
78
- logger.debug(e);
79
- });
80
- },
81
- parseVersionString: function (versionString){
82
- versionString = versionString.replace("\n","");
83
- let 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-]+)*))?$/;
84
- let versionObject = {...versionString.match(regexpVer).groups};
85
- return versionObject;
86
- },
87
- getVersionStringFromFile: function (filename){
88
- let versionString;
89
- try {
90
- versionString = fs.readFileSync(filename).toString().replace("\n","");
91
- } catch (e){
92
- versionString = "0.0.1";
93
- }
94
- return versionString;
95
- },
96
- buildNewSemVersionString: function ({major,minor,patch}){
97
- return `${major}.${minor}.${patch}`;
98
- },
99
- parseVersionSuffix: function (versionString){
100
- versionString = versionString.replace("\n","");
101
- let versionObject = this.parseVersionString(versionString);
102
- let semVersionString = this.buildNewSemVersionString(versionObject);
103
- return versionString.replace(semVersionString,"");
104
- },
105
- buildNewVersionString: function ({major,minor,patch},suffix){
106
- let semVersionString = this.buildNewSemVersionString({major,minor,patch});
107
- return `${semVersionString}${suffix}`;
108
- },
109
- saveNewVersionFile: function (filename,versionString){
110
- fs.writeFileSync(filename,versionString);
111
- },
112
- choiceOption:{
113
- v_major: function (filename,options){
114
- filename = (typeof filename === "undefined")?("VERSION"):(filename);
115
- let versionString = this.getVersionStringFromFile(filename);
116
- let versionSuffix = this.parseVersionSuffix(versionString);
117
- let versionObject = this.parseVersionString(versionString);
118
- let major = parseInt(versionObject.major);
119
- let minor = parseInt(versionObject.minor);
120
- let patch = parseInt(versionObject.patch);
121
- let newVersion = this.buildNewVersionString({major:major+1,minor:minor,patch:patch},versionSuffix);
122
- this.saveNewVersionFile(filename,newVersion);
123
- if (options.syncGit){
124
- var commitMsg = options.commitMsg || `New Version v${newVersion}`;
125
- this.syncGit(newVersion,commitMsg, options.syncNpm);
126
- }
127
- },
128
- v_minor: function (filename,options){
129
- filename = (typeof filename === "undefined")?("VERSION"):(filename);
130
- let versionString = this.getVersionStringFromFile(filename);
131
- let versionSuffix = this.parseVersionSuffix(versionString);
132
- let versionObject = this.parseVersionString(versionString);
133
- let major = parseInt(versionObject.major);
134
- let minor = parseInt(versionObject.minor);
135
- let patch = parseInt(versionObject.patch);
136
- let newVersion = this.buildNewVersionString({major:major,minor:minor+1,patch:patch},versionSuffix);
137
- this.saveNewVersionFile(filename,newVersion);
138
- if (options.syncGit){
139
- var commitMsg = options.commitMsg || `New Version v${newVersion}`;
140
- this.syncGit(newVersion,commitMsg, options.syncNpm);
141
- }
142
- },
143
- v_patch: function (filename,options){
144
- filename = (typeof filename === "undefined")?("VERSION"):(filename);
145
- let versionString = this.getVersionStringFromFile(filename);
146
- let versionSuffix = this.parseVersionSuffix(versionString);
147
- let versionObject = this.parseVersionString(versionString);
148
- let major = parseInt(versionObject.major);
149
- let minor = parseInt(versionObject.minor);
150
- let patch = parseInt(versionObject.patch);
151
- let newVersion = this.buildNewVersionString({major:major,minor:minor,patch:patch+1},versionSuffix);
152
- this.saveNewVersionFile(filename,newVersion);
153
- if (options.syncGit){
154
- var commitMsg = options.commitMsg || `New Version v${newVersion}`;
155
- this.syncGit(newVersion,commitMsg, options.syncNpm);
156
- }
157
- },
158
- v_sync: function (filename, options){
159
- filename = (typeof filename === "undefined")?("VERSION"):(filename);
160
- var commandHandler = this;
161
- commandHandler.switchCommander.shellCommands([
162
- "echo $(git describe)"
163
- ]).then(function (response){
164
- let versionString = response[0].split("-")[0].slice(1).replace("\n","");
165
- console.log(versionString);
166
- let versionSuffix = commandHandler.parseVersionSuffix(versionString);
167
- let versionObject = commandHandler.parseVersionString(versionString);
168
- let major = parseInt(versionObject.major);
169
- let minor = parseInt(versionObject.minor);
170
- let patch = parseInt(versionObject.patch);
171
- let newVersion = commandHandler.buildNewVersionString({major:major,minor:minor,patch:patch},versionSuffix);
172
- commandHandler.saveNewVersionFile(filename,newVersion);
173
- var commitMsg = options.commitMsg || `Synced Version v${newVersion}`;
174
- commandHandler.switchCommander.shellCommands(
175
- [
176
- "git fetch --tags -f",
177
- `git add . && git commit -am "${commitMsg}"`,
178
- "git fetch origin --tags",
179
- "git tag -ln",
180
- `npm version "${newVersion}" --allow-same-version -m "${commitMsg}"`,
181
- "git push && git push --tags"
182
- ]
183
- ).then(function (response){
184
- console.log(response);
185
- });
186
- });
187
- },
188
- v_changelog: function (){
189
- let commandHandler = this;
190
- commandHandler.switchCommander.shellCommands(
191
- [
192
- "git tag -ln"
193
- ]
194
- ).then(function (response){
195
- var versionTags = response[0].split("\n").map(tag=>tag.split(" ").unique()).unique().map(
196
- tag=>{return {
197
- "version":tag[0],
198
- "major":tag[0].split(".")[0],
199
- "minor":tag[0].split(".")[0]+"."+tag[0].split(".")[1],
200
- "description":tag.slice(1).join(" ").trim()
201
- };}
202
- );
203
- var minorVersionTags = versionTags.filter(tag=>tag.version!=="").map(tag=>tag.version.split(".")[0] +"."+ tag.version.split(".")[1]).unique();
204
- var majorVersionTags = versionTags.filter(tag=>tag.version!=="").map(tag=>tag.version.split(".")[0]).unique();
205
- var history = minorVersionTags.map(minor=>{
206
- return {
207
- "major":minor.split(".")[0],
208
- "minor":minor,
209
- "history":"\n\t- "+versionTags.filter(tag=>tag.minor===minor).map(
210
- function (tag){
211
- return tag.description;
212
- }
213
- ).filter(desc=>!desc.startsWith(minor.slice(1))).sort().unique().join("\n\t- ")
214
- };
215
- }).map(hist=>{return `## ${hist.major} -> ${hist.minor}` + "\n" + hist.history;}).join("\n");
216
- let subtitle = "This is an automatic Changelog history of versions generated using the command: **qcobjects v-changelog > CHANGELOG.md**";
217
- console.log("# Changelog \n\n"+subtitle+"\n\n"+history);
218
-
219
- });
220
- }
221
- },
222
- _new_({switchCommander}){
223
- let commandHandler = this;
224
- this.switchCommander = switchCommander;
225
-
226
- switchCommander.program.command("v-major [filename]")
227
- .option("--git, --sync-git", "Sync with Git")
228
- .option("--npm, --sync-npm", "Sync with NPM")
229
- .option("-m, --commit-msg [message]", "Commit Message")
230
- .description("Semantic Versioning: Upgrade to a new major version")
231
- .action(function(args, options){
232
- commandHandler.choiceOption.v_major.call(commandHandler,args,options);
233
- });
234
- switchCommander.program.command("v-minor [filename]")
235
- .option("--git, --sync-git", "Sync with Git")
236
- .option("--npm, --sync-npm", "Sync with NPM")
237
- .option("-m, --commit-msg [message]", "Commit Message")
238
- .description("Semantic Versioning: Upgrade to a new minor version")
239
- .action(function(args, options){
240
- commandHandler.choiceOption.v_minor.call(commandHandler,args,options);
241
- });
242
-
243
- switchCommander.program.command("v-patch [filename]")
244
- .option("--git, --sync-git", "Sync with Git")
245
- .option("--npm, --sync-npm", "Sync with NPM")
246
- .option("-m, --commit-msg [message]", "Commit Message")
247
- .description("Semantic Versioning: Upgrade to a new patch version")
248
- .action(function(args, options){
249
- commandHandler.choiceOption.v_patch.call(commandHandler,args,options);
250
- });
251
-
252
- switchCommander.program.command("v-sync [filename]")
253
- .option("-m, --commit-msg [message]", "Commit Message")
254
- .description("Semantic Versioning: Sync the version of NPM with version of GIT")
255
- .action(function(args, options){
256
- commandHandler.choiceOption.v_sync.call(commandHandler,args,options);
257
- });
258
-
259
- switchCommander.program.command("v-changelog")
260
- .description("Semantic Versioning: Shows a changelog using Semantic Versioning")
261
- .action(function(args, options){
262
- commandHandler.choiceOption.v_changelog.call(commandHandler,args,options);
263
- });
264
-
265
- }
266
- })
267
- ]);