qcobjects-cli 2.4.31 → 2.4.34

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 (37) hide show
  1. package/.dockerignore +2 -0
  2. package/.eslintignore +7 -0
  3. package/.eslintrc.cjs +22 -0
  4. package/VERSION +1 -1
  5. package/package.json +45 -24
  6. package/{backend → src/backend}/com.qcobjects.backend.microservice.static.js +26 -26
  7. package/{backend → src/backend}/org.qcobjects.backend.php.js +45 -38
  8. package/{com.qcobjects.cli.commands.jira.js → src/com.qcobjects.cli.commands.jira.js} +1 -1
  9. package/{com.qcobjects.cli.commands.js → src/com.qcobjects.cli.commands.js} +1 -1
  10. package/{com.qcobjects.cli.commands.version.js → src/com.qcobjects.cli.commands.version.js} +1 -1
  11. package/src/index.cjs +2 -0
  12. package/src/index.d.ts +2 -0
  13. package/src/index.mjs +2 -0
  14. package/src/index.ts +2 -0
  15. package/{org.qcobjects.enterprise.commands.js → src/org.qcobjects.enterprise.commands.js} +1 -1
  16. package/{org.quickcorp.qcobjects.cli.js → src/org.quickcorp.qcobjects.cli.js} +265 -252
  17. package/src/org.quickcorp.qcobjects.defaultsettings.js +293 -0
  18. package/{qcobjects-cli.js → src/qcobjects-cli.js} +5 -3
  19. package/.eslintrc.json +0 -15
  20. package/org.quickcorp.qcobjects.defaultsettings.js +0 -242
  21. /package/{com.qcobjects.cli.commands.jira.client_services.js → src/com.qcobjects.cli.commands.jira.client_services.js} +0 -0
  22. /package/{org.qcobjects.common.pipelog.js → src/org.qcobjects.common.pipelog.js} +0 -0
  23. /package/{org.quickcorp.qcobjects.api.client_services.js → src/org.quickcorp.qcobjects.api.client_services.js} +0 -0
  24. /package/{org.quickcorp.qcobjects.collab.server.js → src/org.quickcorp.qcobjects.collab.server.js} +0 -0
  25. /package/{org.quickcorp.qcobjects.main.file.js → src/org.quickcorp.qcobjects.main.file.js} +0 -0
  26. /package/{org.quickcorp.qcobjects.main.http.gae.server.js → src/org.quickcorp.qcobjects.main.http.gae.server.js} +0 -0
  27. /package/{org.quickcorp.qcobjects.main.http.server.js → src/org.quickcorp.qcobjects.main.http.server.js} +0 -0
  28. /package/{org.quickcorp.qcobjects.main.http2.server.js → src/org.quickcorp.qcobjects.main.http2.server.js} +0 -0
  29. /package/{qcobjects-collab.js → src/qcobjects-collab.js} +0 -0
  30. /package/{qcobjects-createcert.js → src/qcobjects-createcert.js} +0 -0
  31. /package/{qcobjects-gae-http-server.js → src/qcobjects-gae-http-server.js} +0 -0
  32. /package/{qcobjects-http-server.js → src/qcobjects-http-server.js} +0 -0
  33. /package/{qcobjects-http2-server.js → src/qcobjects-http2-server.js} +0 -0
  34. /package/{qcobjects-shell.js → src/qcobjects-shell.js} +0 -0
  35. /package/{templates → src/templates}/apps/spa-local.html +0 -0
  36. /package/{templates → src/templates}/apps/spa-local.js +0 -0
  37. /package/{templates → src/templates}/pwa/sw.js +0 -0
@@ -34,10 +34,9 @@ const path = require("path");
34
34
  const absolutePath = path.resolve( __dirname, "./" );
35
35
  const templatePath = path.resolve( __dirname, "./templates/apps/" )+"/";
36
36
  const templatePwaPath = path.resolve( __dirname, "./templates/pwa/" )+"/";
37
- const package_config = require(absolutePath+"/package.json");
37
+ const package_config = require(absolutePath+"/../package.json");
38
38
  const { exec,execSync } = require("child_process");
39
39
 
40
- logger.debugEnabled=false;
41
40
  CONFIG.set("node_modules_path","./node_modules/");
42
41
  CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/qcobjectsnewapp");
43
42
 
@@ -61,267 +60,266 @@ let ImportCustomCommand = function (commandName, commandPackage){
61
60
  Package("org.quickcorp.qcobjects.cli",[
62
61
 
63
62
  class SwitchCommander extends InheritClass {
64
- constructor (){
65
- super(...arguments);
66
- this.program = require("commander");
67
63
 
68
- this.choiceOption={
69
- generateSw(_appName){
70
- let switchCommander = this;
71
- let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
72
- switchCommander.generateServiceWorker(appName);
73
-
74
- },
75
- create(_appName, options){
76
- const version = global.__get_version__();
77
- let switchCommander = this;
78
- let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
79
-
80
- const readline = require("readline");
81
-
82
- const rl = readline.createInterface({
83
- input: process.stdin,
84
- output: process.stdout
85
- });
86
-
87
- rl.question(`Please tell me your git repository url
88
- [press ENTER \u{21b5} to leave it blank or Ctrl+C to cancel]:
89
- `, (answer) => {
90
- logger.info(`your git repository url is ${answer}`);
91
- rl.close();
92
- let giturl = answer;
93
-
94
- let createAppCommandCustom = `
95
- {
96
- "name": "${appName.toLowerCase()}",
97
- "version": "0.0.1",
98
- "repository": {
99
- "type": "git",
100
- "url": "${giturl}"
101
- },
102
- "description": "This is a custom NPM template app from ${options.createCustom} generated with QCObjects.",
103
- "main": "js/init.js",
104
- "license": "LGPL-3.0-or-later",
105
- "scripts": {
106
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
107
- "sync": "git add . && git commit -am ",
108
- "preversion": "npm i --upgrade && npm test",
109
- "postversion": "git push && git push --tags",
110
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
111
- "start": "node app.js",
112
- "build": "exit 0"
113
- },
114
- "dependencies": {
115
- "${options.createCustom}": "latest",
116
- "qcobjects": "^${version.qcobjects}",
117
- "qcobjects-sdk": "^${version.sdk}"
118
- },
119
- "devDependencies": {
120
- "eslint": "^8.2.0",
121
- "eslint-config-qcobjects": "latest",
122
- "jasmine": "latest",
123
- "qcobjects-cli": "^${version.cli}",
124
- "grunt": "^1.4.1",
125
- "grunt-contrib-jasmine": "^2.0.2",
126
- "nyc": "^15.1.0"
127
- }
128
- }`;
129
-
130
- let createAppCommandPWA = `
131
- {
132
- "name": "${appName.toLowerCase()}",
133
- "version": "0.0.1",
134
- "repository": {
135
- "type": "git",
136
- "url": "${giturl}"
137
- },
138
- "description": "Awesome PWA application that will help you achieve your dreams.",
139
- "main": "js/init.js",
140
- "license": "LGPL-3.0-or-later",
141
- "scripts": {
142
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
143
- "sync": "git add . && git commit -am ",
144
- "preversion": "npm i --upgrade && npm test",
145
- "postversion": "git push && git push --tags",
146
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
147
- "start": "node app.js",
148
- "build": "exit 0"
149
- },
150
- "dependencies": {
151
- "qcobjectsnewapp": "latest",
152
- "qcobjects": "^${version.qcobjects}",
153
- "qcobjects-sdk": "^${version.sdk}"
154
- },
155
- "devDependencies": {
156
- "eslint": "^8.2.0",
157
- "eslint-config-qcobjects": "latest",
158
- "jasmine": "latest",
159
- "qcobjects-cli": "^${version.cli}",
160
- "grunt": "^1.4.1",
161
- "grunt-contrib-jasmine": "^2.0.2",
162
- "nyc": "^15.1.0"
163
- }
164
- }`;
165
-
166
- let createAppCommandAMP = `echo
167
- {
168
- "name": "${appName.toLowerCase()}",
169
- "version": "0.0.1",
170
- "repository": {
64
+ choiceOption = {
65
+ generateSw(_appName){
66
+ let switchCommander = this;
67
+ let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
68
+ switchCommander.generateServiceWorker(appName);
69
+
70
+ },
71
+ create(_appName, options){
72
+ const version = global.__get_version__();
73
+ let switchCommander = this;
74
+ let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
75
+
76
+ const readline = require("readline");
77
+
78
+ const rl = readline.createInterface({
79
+ input: process.stdin,
80
+ output: process.stdout
81
+ });
82
+
83
+ rl.question(`Please tell me your git repository url
84
+ [press ENTER \u{21b5} to leave it blank or Ctrl+C to cancel]:
85
+ `, (answer) => {
86
+ logger.info(`your git repository url is ${answer}`);
87
+ rl.close();
88
+ let giturl = answer;
89
+
90
+ let createAppCommandCustom = `
91
+ {
92
+ "name": "${appName.toLowerCase()}",
93
+ "version": "0.0.1",
94
+ "repository": {
95
+ "type": "git",
96
+ "url": "${giturl}"
97
+ },
98
+ "description": "This is a custom NPM template app from ${options.createCustom} generated with QCObjects.",
99
+ "main": "js/init.js",
100
+ "license": "LGPL-3.0-or-later",
101
+ "scripts": {
102
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
103
+ "sync": "git add . && git commit -am ",
104
+ "preversion": "npm i --upgrade && npm test",
105
+ "postversion": "git push && git push --tags",
106
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
107
+ "start": "node app.js",
108
+ "build": "exit 0"
109
+ },
110
+ "dependencies": {
111
+ "${options.createCustom}": "latest",
112
+ "qcobjects": "^${version.qcobjects}",
113
+ "qcobjects-sdk": "^${version.sdk}"
114
+ },
115
+ "devDependencies": {
116
+ "eslint": "^8.2.0",
117
+ "eslint-config-qcobjects": "latest",
118
+ "jasmine": "latest",
119
+ "qcobjects-cli": "^${version.cli}",
120
+ "grunt": "^1.4.1",
121
+ "grunt-contrib-jasmine": "^2.0.2",
122
+ "nyc": "^15.1.0"
123
+ }
124
+ }`;
125
+
126
+ let createAppCommandPWA = `
127
+ {
128
+ "name": "${appName.toLowerCase()}",
129
+ "version": "0.0.1",
130
+ "repository": {
131
+ "type": "git",
132
+ "url": "${giturl}"
133
+ },
134
+ "description": "Awesome PWA application that will help you achieve your dreams.",
135
+ "main": "js/init.js",
136
+ "license": "LGPL-3.0-or-later",
137
+ "scripts": {
138
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
139
+ "sync": "git add . && git commit -am ",
140
+ "preversion": "npm i --upgrade && npm test",
141
+ "postversion": "git push && git push --tags",
142
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
143
+ "start": "node app.js",
144
+ "build": "exit 0"
145
+ },
146
+ "dependencies": {
147
+ "qcobjectsnewapp": "latest",
148
+ "qcobjects": "^${version.qcobjects}",
149
+ "qcobjects-sdk": "^${version.sdk}"
150
+ },
151
+ "devDependencies": {
152
+ "eslint": "^8.2.0",
153
+ "eslint-config-qcobjects": "latest",
154
+ "jasmine": "latest",
155
+ "qcobjects-cli": "^${version.cli}",
156
+ "grunt": "^1.4.1",
157
+ "grunt-contrib-jasmine": "^2.0.2",
158
+ "nyc": "^15.1.0"
159
+ }
160
+ }`;
161
+
162
+ let createAppCommandAMP = `echo
163
+ {
164
+ "name": "${appName.toLowerCase()}",
165
+ "version": "0.0.1",
166
+ "repository": {
167
+ "type": "git",
168
+ "url": "${giturl}"
169
+ },
170
+ "description": "Awesome AMP application that will help you achieve your dreams.",
171
+ "main": "js/init.js",
172
+ "license": "LGPL-3.0-or-later",
173
+ "scripts": {
174
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
175
+ "sync": "git add . && git commit -am ",
176
+ "preversion": "npm i --upgrade && npm test",
177
+ "postversion": "git push && git push --tags",
178
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
179
+ "start": "node app.js",
180
+ "build": "exit 0"
181
+ },
182
+ "dependencies": {
183
+ "qcobjects-ecommerce-amp": "latest",
184
+ "qcobjects": "^${version.qcobjects}",
185
+ "qcobjects-sdk": "^${version.sdk}"
186
+ },
187
+ "devDependencies": {
188
+ "eslint": "^8.2.0",
189
+ "eslint-config-qcobjects": "latest",
190
+ "jasmine": "latest",
191
+ "qcobjects-cli": "^${version.cli}",
192
+ "grunt": "^1.4.1",
193
+ "grunt-contrib-jasmine": "^2.0.2",
194
+ "nyc": "^15.1.0"
195
+ }
196
+ }`;
197
+
198
+ let createAppCommandPHP = `
199
+ {
200
+ "name": "${appName.toLowerCase()}",
201
+ "version": "0.0.1",
202
+ "repository": {
171
203
  "type": "git",
172
204
  "url": "${giturl}"
173
- },
174
- "description": "Awesome AMP application that will help you achieve your dreams.",
175
- "main": "js/init.js",
176
- "license": "LGPL-3.0-or-later",
177
- "scripts": {
178
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
179
- "sync": "git add . && git commit -am ",
180
- "preversion": "npm i --upgrade && npm test",
181
- "postversion": "git push && git push --tags",
182
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
183
- "start": "node app.js",
184
- "build": "exit 0"
185
- },
186
- "dependencies": {
187
- "qcobjects-ecommerce-amp": "latest",
188
- "qcobjects": "^${version.qcobjects}",
189
- "qcobjects-sdk": "^${version.sdk}"
190
- },
191
- "devDependencies": {
192
- "eslint": "^8.2.0",
193
- "eslint-config-qcobjects": "latest",
194
- "jasmine": "latest",
195
- "qcobjects-cli": "^${version.cli}",
196
- "grunt": "^1.4.1",
197
- "grunt-contrib-jasmine": "^2.0.2",
198
- "nyc": "^15.1.0"
199
- }
200
- }`;
201
-
202
- let createAppCommandPHP = `
203
- {
204
- "name": "${appName.toLowerCase()}",
205
- "version": "0.0.1",
206
- "repository": {
207
- "type": "git",
208
- "url": "${giturl}"
209
- },
210
- "description": "Awesome PHP application that will help you achieve your dreams.",
211
- "main": "js/init.js",
212
- "license": "LGPL-3.0-or-later",
213
- "scripts": {
214
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
215
- "sync": "git add . && git commit -am ",
216
- "preversion": "npm i --upgrade && npm test",
217
- "postversion": "git push && git push --tags",
218
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
219
- "start": "node app.js",
220
- "build": "exit 0"
221
- },
222
- "dependencies": {
223
- "qcobjectsnewphp": "latest",
224
- "qcobjects": "^${version.qcobjects}",
225
- "qcobjects-sdk": "^${version.sdk}"
226
- },
227
- "devDependencies": {
228
- "eslint": "^8.2.0",
229
- "eslint-config-qcobjects": "latest",
230
- "jasmine": "latest",
231
- "qcobjects-cli": "^${version.cli}",
232
- "grunt": "^1.4.1",
233
- "grunt-contrib-jasmine": "^2.0.2",
234
- "nyc": "^15.1.0"
235
- }
236
- }`;
237
-
238
- let createAppCommand;
239
- let appTemplateName;
240
- let _package_json_content;
241
-
242
- if (options.createAmp){
243
- appTemplateName = "qcobjects-ecommerce-amp";
244
- _package_json_content = createAppCommandAMP;
245
- } else if (options.createPwa){
246
- appTemplateName = "qcobjectsnewapp";
247
- _package_json_content = createAppCommandPWA;
248
- } else if (options.createPhp){
249
- appTemplateName = "qcobjectsnewphp";
250
- _package_json_content = createAppCommandPHP;
251
- } else if (options.createCustom){
252
- appTemplateName = options.createCustom;
253
- _package_json_content = createAppCommandCustom;
254
- } else {
255
- appTemplateName = "qcobjectsnewapp";
256
- _package_json_content = createAppCommandPWA;
205
+ },
206
+ "description": "Awesome PHP application that will help you achieve your dreams.",
207
+ "main": "js/init.js",
208
+ "license": "LGPL-3.0-or-later",
209
+ "scripts": {
210
+ "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
211
+ "sync": "git add . && git commit -am ",
212
+ "preversion": "npm i --upgrade && npm test",
213
+ "postversion": "git push && git push --tags",
214
+ "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
215
+ "start": "node app.js",
216
+ "build": "exit 0"
217
+ },
218
+ "dependencies": {
219
+ "qcobjectsnewphp": "latest",
220
+ "qcobjects": "^${version.qcobjects}",
221
+ "qcobjects-sdk": "^${version.sdk}"
222
+ },
223
+ "devDependencies": {
224
+ "eslint": "^8.2.0",
225
+ "eslint-config-qcobjects": "latest",
226
+ "jasmine": "latest",
227
+ "qcobjects-cli": "^${version.cli}",
228
+ "grunt": "^1.4.1",
229
+ "grunt-contrib-jasmine": "^2.0.2",
230
+ "nyc": "^15.1.0"
231
+ }
232
+ }`;
233
+
234
+ let createAppCommand;
235
+ let appTemplateName;
236
+ let _package_json_content;
237
+
238
+ if (options.createAmp){
239
+ appTemplateName = "qcobjects-ecommerce-amp";
240
+ _package_json_content = createAppCommandAMP;
241
+ } else if (options.createPwa){
242
+ appTemplateName = "qcobjectsnewapp";
243
+ _package_json_content = createAppCommandPWA;
244
+ } else if (options.createPhp){
245
+ appTemplateName = "qcobjectsnewphp";
246
+ _package_json_content = createAppCommandPHP;
247
+ } else if (options.createCustom){
248
+ appTemplateName = options.createCustom;
249
+ _package_json_content = createAppCommandCustom;
250
+ } else {
251
+ appTemplateName = "qcobjectsnewapp";
252
+ _package_json_content = createAppCommandPWA;
253
+ }
254
+ CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/"+appTemplateName);
255
+ /* if (!process.platform.toLowerCase().startsWith("win")){
256
+ _package_json_content = _package_json_content.replace(/(")/g, String.fromCharCode(92)+"\"");
257
+ }*/
258
+ createAppCommand = "npm init -y";
259
+ let _package_json_file = path.resolve(CONFIG.get("projectPath"),"./package.json");
260
+ logger.debug("_package_json_file: "+_package_json_file);
261
+ logger.debug(createAppCommand);
262
+
263
+ exec(createAppCommand, (err, stdout, stderr) => {
264
+ if (err) {
265
+ logger.warn(err);
266
+ process.exit(1);
267
+ return;
257
268
  }
258
- CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/"+appTemplateName);
259
- /* if (!process.platform.toLowerCase().startsWith("win")){
260
- _package_json_content = _package_json_content.replace(/(")/g, String.fromCharCode(92)+"\"");
261
- }*/
262
- createAppCommand = "npm init -y";
263
- let _package_json_file = path.resolve(CONFIG.get("projectPath"),"./package.json");
264
- logger.debug("_package_json_file: "+_package_json_file);
265
- logger.debug(createAppCommand);
266
-
267
- exec(createAppCommand, (err, stdout, stderr) => {
269
+ fs.writeFile(_package_json_file, _package_json_content, err => {
268
270
  if (err) {
269
271
  logger.warn(err);
270
272
  process.exit(1);
271
273
  return;
272
274
  }
273
- fs.writeFile(_package_json_file, _package_json_content, err => {
275
+
276
+ exec("npm cache verify && npm i --save-dev --legacy-peer-deps", (err, stdout, stderr) => {
274
277
  if (err) {
275
278
  logger.warn(err);
276
279
  process.exit(1);
277
280
  return;
278
281
  }
279
-
280
- exec("npm cache verify && npm i --save-dev --legacy-peer-deps", (err, stdout, stderr) => {
281
- if (err) {
282
- logger.warn(err);
283
- process.exit(1);
284
- return;
285
- }
286
-
287
- Promise.resolve(switchCommander.copyTemplate())
288
- .then(()=>{
289
- logger.info("Good! Your application is getting done. You can play with QCObjects now!");
290
- logger.info("In about five seconds your server will start...");
291
- exec("qcobjects-createcert",(err,stdout,stderr)=>{
292
- logger.info("Test certificates generated");
293
-
294
- exec("npm uninstall "+appTemplateName+" --save && npm cache verify",(err,stdout,stderr)=>{
295
- switchCommander.generateServiceWorker(appName);
296
- });
297
-
298
- }).stdout.on("data", function(data) {
299
- console.log(data);
282
+
283
+ Promise.resolve(switchCommander.copyTemplate())
284
+ .then(()=>{
285
+ logger.info("Good! Your application is getting done. You can play with QCObjects now!");
286
+ logger.info("In about five seconds your server will start...");
287
+ exec("qcobjects-createcert",(err,stdout,stderr)=>{
288
+ logger.info("Test certificates generated");
289
+
290
+ exec("npm uninstall "+appTemplateName+" --save && npm cache verify",(err,stdout,stderr)=>{
291
+ switchCommander.generateServiceWorker(appName);
300
292
  });
293
+
294
+ }).stdout.on("data", function(data) {
295
+ console.log(data);
301
296
  });
302
- }).stdout.on("data", function(data) {
303
- console.log(data);
304
297
  });
305
-
298
+ }).stdout.on("data", function(data) {
299
+ console.log(data);
306
300
  });
307
-
308
- }).stdout.on("data", function(data) {
309
- console.log("App generation started...");
301
+
310
302
  });
311
-
303
+
304
+ }).stdout.on("data", function(data) {
305
+ console.log("App generation started...");
312
306
  });
313
-
314
- },
315
- publish(_appName){
316
- logger.debug("publish is not yet implemented");
317
- },
318
- upgradeToEnterprise (){
319
- let switchCommander = this;
320
- QCObjectsEnterprise.upgrade(switchCommander);
321
- }
322
- };
323
-
324
307
 
308
+ });
309
+
310
+ },
311
+ publish(_appName){
312
+ logger.debug("publish is not yet implemented");
313
+ },
314
+ upgradeToEnterprise (){
315
+ let switchCommander = this;
316
+ QCObjectsEnterprise.upgrade(switchCommander);
317
+ }
318
+ };
319
+
320
+ constructor (){
321
+ super(...arguments);
322
+ this.program = require("commander");
325
323
  }
326
324
 
327
325
  shellCommands(_shell_commands){
@@ -492,6 +490,7 @@ Package("org.quickcorp.qcobjects.cli",[
492
490
  initCommand(){
493
491
  let switchCommander = this;
494
492
  if (process.argv.length>1){
493
+ logger.debug("Installing Commands...");
495
494
 
496
495
  switchCommander.program
497
496
  .version(global.__get_version_string__());
@@ -506,6 +505,30 @@ Package("org.quickcorp.qcobjects.cli",[
506
505
  .action(function(args, options){
507
506
  switchCommander.choiceOption.create.call(switchCommander,args,options);
508
507
  });
508
+
509
+
510
+ try {
511
+ logger.debug("Loading Plugin Commands...");
512
+ const importPluginCommands = function (switchCommander){
513
+ return global.ClassesList
514
+ .filter(c=>c.packageName.startsWith("com.qcobjects.cli.commands."))
515
+ .filter(p=>p.classFactory.name.endsWith("CommandHandler"))
516
+ .map(pluginCommand => {
517
+ try {
518
+ logger.debug(`Loading plugin ${pluginCommand.packageName}`);
519
+ const classFactory = pluginCommand.classFactory;
520
+ pluginCommand.plugin = New(classFactory,{switchCommander:switchCommander});
521
+ } catch (e){
522
+ throw Error(`Something went wrong loading ${pluginCommand.packageName}`);
523
+ }
524
+ return pluginCommand;
525
+ });
526
+ };
527
+ importPluginCommands(switchCommander);
528
+ } catch (e){
529
+ throw Error (`Something went wrong loading plugins: ${e.message}`);
530
+ }
531
+
509
532
  switchCommander.program.command("publish <appname>")
510
533
  .description("Publishes an app with <appname>")
511
534
  .option("--pwa, --create-pwa", "Publishes the progressive web app assets")
@@ -517,16 +540,6 @@ Package("org.quickcorp.qcobjects.cli",[
517
540
  switchCommander.choiceOption.publish.call(switchCommander,args,options);
518
541
  });
519
542
 
520
-
521
- let importPluginCommands = function (){
522
- this.pluginCommandsList = [];
523
- let _pluginCommandsList = global.ClassesList.filter(c=>c.packageName.startsWith("com.qcobjects.cli.commands."));
524
- _pluginCommandsList.filter(p=>p.classFactory.name.endsWith("CommandHandler")).map(pluginCommand => {
525
- this.pluginCommandsList.push(new pluginCommand.classFactory({switchCommander:switchCommander}));
526
- });
527
- };
528
- importPluginCommands.call(switchCommander);
529
-
530
543
  switchCommander.program.command("upgrade-to-enterprise")
531
544
  .description("Upgrades to QCObjects Enterprise Edition")
532
545
  .action(function(args, options){