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,5 +1,5 @@
1
1
  /**
2
- * QCObjects CLI 2.3.x
2
+ * QCObjects CLI 2.4.x
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
@@ -30,31 +30,42 @@
30
30
  /*eslint no-undef: "off"*/
31
31
  "use strict";
32
32
  Package("org.quickcorp.qcobjects.api.client_services", [
33
- Class("QuickCorpCloud", Service, {
34
- name: "quickcorp_cloud",
35
- external: true,
36
- useHTTP2:true,
37
- cached: false,
38
- method: "post",
39
- headers: {
40
- "origin": "localhost",
41
- "content-type": "application/json"
42
- },
43
- basePath: "https://cloud.quickcorp.org/",
44
- url: "",
45
- withCredentials: false,
46
- _new_: function(o) {
33
+
34
+ class QuickCorpCloud extends Service {
35
+ constructor ({
36
+ name= "quickcorp_cloud",
37
+ external= true,
38
+ useHTTP2=true,
39
+ cached= false,
40
+ method= "post",
41
+ headers= {
42
+ "origin": "localhost",
43
+ "content-type": "application/json"
44
+ },
45
+ basePath= "https://cloud.quickcorp.org/",
46
+ url= "",
47
+ withCredentials= false
48
+ }) {
49
+ super(...arguments);
50
+
51
+ }
52
+
53
+ _new_(o) {
47
54
  // service instantiated
48
55
  this.headers["authorization"] = "Basic token";
49
56
  this.url = this.basePath + o.apiMethod;
50
57
  this.data = o.data;
51
- },
52
- done: function(service,standardResponse) {
58
+ }
59
+
60
+ done(service,standardResponse) {
53
61
  // service loaded
54
62
  logger.debug(standardResponse);
55
- },
56
- fail: function (e){
63
+ }
64
+
65
+ fail(e){
57
66
  logger.debug(e);
58
67
  }
59
- })
68
+
69
+ }
70
+
60
71
  ]);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * QCObjects CLI 2.3.x
2
+ * QCObjects CLI 2.4.x
3
3
  * ________________
4
4
  *
5
5
  * Author: Jean Machuca <correojean@gmail.com>
@@ -43,7 +43,7 @@ CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/qcobjectsnew
43
43
 
44
44
  require(absolutePath+"/org.qcobjects.enterprise.commands");
45
45
  require(absolutePath+"/org.quickcorp.qcobjects.api.client_services");
46
- require(absolutePath+"/org.quickcorp.qcobjects.cli.commands");
46
+ require(absolutePath+"/com.qcobjects.cli.commands");
47
47
 
48
48
  let ImportCustomCommand = function (commandName, commandPackage){
49
49
  let _ret_;
@@ -59,9 +59,272 @@ let ImportCustomCommand = function (commandName, commandPackage){
59
59
 
60
60
 
61
61
  Package("org.quickcorp.qcobjects.cli",[
62
- Class("SwitchCommander",{
63
- program:require("commander"),
64
- shellCommands: function (_shell_commands){
62
+
63
+ class SwitchCommander extends InheritClass {
64
+ constructor (){
65
+ super(...arguments);
66
+ this.program = require("commander");
67
+
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": {
171
+ "type": "git",
172
+ "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;
257
+ }
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) => {
268
+ if (err) {
269
+ logger.warn(err);
270
+ process.exit(1);
271
+ return;
272
+ }
273
+ fs.writeFile(_package_json_file, _package_json_content, err => {
274
+ if (err) {
275
+ logger.warn(err);
276
+ process.exit(1);
277
+ return;
278
+ }
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);
300
+ });
301
+ });
302
+ }).stdout.on("data", function(data) {
303
+ console.log(data);
304
+ });
305
+
306
+ });
307
+
308
+ }).stdout.on("data", function(data) {
309
+ console.log("App generation started...");
310
+ });
311
+
312
+ });
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
+
325
+ }
326
+
327
+ shellCommands(_shell_commands){
65
328
  return new Promise(function (resolve_all,reject_all){
66
329
  var _promises_set = _shell_commands.map(
67
330
  function (shell_command){
@@ -88,8 +351,9 @@ Package("org.quickcorp.qcobjects.cli",[
88
351
  reject_all(e);
89
352
  });
90
353
  }).catch(e=>console.log(e));
91
- },
92
- fileListRecursive : function (dir) {
354
+ }
355
+
356
+ fileListRecursive (dir) {
93
357
  var instance = this;
94
358
  return (fs.statSync(dir).isDirectory())
95
359
  ? (Array.prototype.concat(...fs.readdirSync(dir).map(f =>instance.fileListRecursive(path.join(dir, f))))
@@ -98,8 +362,9 @@ Package("org.quickcorp.qcobjects.cli",[
98
362
  })
99
363
  )
100
364
  : (dir);
101
- },
102
- register: function (email,phonenumber){
365
+ }
366
+
367
+ register(email,phonenumber){
103
368
  return new Promise (function (resolve,reject){
104
369
  logger.info("I'm going to register your profile on the cloud...");
105
370
  let cloudClient = New(QuickCorpCloud, {
@@ -122,8 +387,9 @@ Package("org.quickcorp.qcobjects.cli",[
122
387
  }
123
388
 
124
389
  });
125
- },
126
- generateServiceWorker: function (appName){
390
+ }
391
+
392
+ generateServiceWorker(appName){
127
393
  var filelist = ["/"].concat(this.fileListRecursive("./"));
128
394
  filelist = filelist.filter(function (fl){return fl !== "sw.js" && (!fl.startsWith("node_modules/")); });
129
395
  filelist = filelist.filter(fname => !fname.endsWith(".pem"));
@@ -160,8 +426,9 @@ Package("org.quickcorp.qcobjects.cli",[
160
426
  }
161
427
  });
162
428
  return component;
163
- },
164
- copyTemplate: function (){
429
+ }
430
+
431
+ copyTemplate(){
165
432
  var map_files = function (pathname,callback){
166
433
  var _filenames = function (pathname){
167
434
  fs.readdir(pathname,{withFileTypes:true},function (err,files){
@@ -220,263 +487,9 @@ Package("org.quickcorp.qcobjects.cli",[
220
487
  }
221
488
  });
222
489
 
223
- },
224
- choiceOption:{
225
- generateSw: function (_appName){
226
- let switchCommander = this;
227
- let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
228
- switchCommander.generateServiceWorker(appName);
229
-
230
- },
231
- create:function (_appName, options){
232
- const version = global.__get_version__();
233
- let switchCommander = this;
234
- let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
235
-
236
- const readline = require("readline");
237
-
238
- const rl = readline.createInterface({
239
- input: process.stdin,
240
- output: process.stdout
241
- });
242
-
243
- rl.question(`Please tell me your git repository url
244
- [press ENTER \u{21b5} to leave it blank or Ctrl+C to cancel]:
245
- `, (answer) => {
246
- logger.info(`your git repository url is ${answer}`);
247
- rl.close();
248
- let giturl = answer;
249
-
250
- let createAppCommandCustom = `
251
- {
252
- "name": "${appName.toLowerCase()}",
253
- "version": "0.0.1",
254
- "repository": {
255
- "type": "git",
256
- "url": "${giturl}"
257
- },
258
- "description": "This is a custom NPM template app from ${options.createCustom} generated with QCObjects.",
259
- "main": "js/init.js",
260
- "license": "LGPL-3.0-or-later",
261
- "scripts": {
262
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
263
- "sync": "git add . && git commit -am ",
264
- "preversion": "npm i --upgrade && npm test",
265
- "postversion": "git push && git push --tags",
266
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
267
- "start": "node app.js",
268
- "build": "exit 0"
269
- },
270
- "dependencies": {
271
- "${options.createCustom}": "latest",
272
- "qcobjects": "^${version.qcobjects}",
273
- "qcobjects-sdk": "^${version.sdk}"
274
- },
275
- "devDependencies": {
276
- "eslint": "^8.2.0",
277
- "eslint-config-qcobjects": "latest",
278
- "jasmine": "latest",
279
- "qcobjects-cli": "^${version.cli}",
280
- "grunt": "^1.4.1",
281
- "grunt-contrib-jasmine": "^2.0.2",
282
- "nyc": "^15.1.0"
283
- }
284
- }`;
285
-
286
- let createAppCommandPWA = `
287
- {
288
- "name": "${appName.toLowerCase()}",
289
- "version": "0.0.1",
290
- "repository": {
291
- "type": "git",
292
- "url": "${giturl}"
293
- },
294
- "description": "Awesome PWA application that will help you achieve your dreams.",
295
- "main": "js/init.js",
296
- "license": "LGPL-3.0-or-later",
297
- "scripts": {
298
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
299
- "sync": "git add . && git commit -am ",
300
- "preversion": "npm i --upgrade && npm test",
301
- "postversion": "git push && git push --tags",
302
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
303
- "start": "node app.js",
304
- "build": "exit 0"
305
- },
306
- "dependencies": {
307
- "qcobjectsnewapp": "latest",
308
- "qcobjects": "^${version.qcobjects}",
309
- "qcobjects-sdk": "^${version.sdk}"
310
- },
311
- "devDependencies": {
312
- "eslint": "^8.2.0",
313
- "eslint-config-qcobjects": "latest",
314
- "jasmine": "latest",
315
- "qcobjects-cli": "^${version.cli}",
316
- "grunt": "^1.4.1",
317
- "grunt-contrib-jasmine": "^2.0.2",
318
- "nyc": "^15.1.0"
319
- }
320
- }`;
321
-
322
- let createAppCommandAMP = `echo
323
- {
324
- "name": "${appName.toLowerCase()}",
325
- "version": "0.0.1",
326
- "repository": {
327
- "type": "git",
328
- "url": "${giturl}"
329
- },
330
- "description": "Awesome AMP application that will help you achieve your dreams.",
331
- "main": "js/init.js",
332
- "license": "LGPL-3.0-or-later",
333
- "scripts": {
334
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
335
- "sync": "git add . && git commit -am ",
336
- "preversion": "npm i --upgrade && npm test",
337
- "postversion": "git push && git push --tags",
338
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
339
- "start": "node app.js",
340
- "build": "exit 0"
341
- },
342
- "dependencies": {
343
- "qcobjects-ecommerce-amp": "latest",
344
- "qcobjects": "^${version.qcobjects}",
345
- "qcobjects-sdk": "^${version.sdk}"
346
- },
347
- "devDependencies": {
348
- "eslint": "^8.2.0",
349
- "eslint-config-qcobjects": "latest",
350
- "jasmine": "latest",
351
- "qcobjects-cli": "^${version.cli}",
352
- "grunt": "^1.4.1",
353
- "grunt-contrib-jasmine": "^2.0.2",
354
- "nyc": "^15.1.0"
355
- }
356
- }`;
357
-
358
- let createAppCommandPHP = `
359
- {
360
- "name": "${appName.toLowerCase()}",
361
- "version": "0.0.1",
362
- "repository": {
363
- "type": "git",
364
- "url": "${giturl}"
365
- },
366
- "description": "Awesome PHP application that will help you achieve your dreams.",
367
- "main": "js/init.js",
368
- "license": "LGPL-3.0-or-later",
369
- "scripts": {
370
- "test": "(npx eslint *.js js/*.js js/packages/*.js --fix) && (npx jasmine)",
371
- "sync": "git add . && git commit -am ",
372
- "preversion": "npm i --upgrade && npm test",
373
- "postversion": "git push && git push --tags",
374
- "coverage": "nyc --reporter=lcov --reporter=text-summary npm run test",
375
- "start": "node app.js",
376
- "build": "exit 0"
377
- },
378
- "dependencies": {
379
- "qcobjectsnewphp": "latest",
380
- "qcobjects": "^${version.qcobjects}",
381
- "qcobjects-sdk": "^${version.sdk}"
382
- },
383
- "devDependencies": {
384
- "eslint": "^8.2.0",
385
- "eslint-config-qcobjects": "latest",
386
- "jasmine": "latest",
387
- "qcobjects-cli": "^${version.cli}",
388
- "grunt": "^1.4.1",
389
- "grunt-contrib-jasmine": "^2.0.2",
390
- "nyc": "^15.1.0"
391
- }
392
- }`;
393
-
394
- let createAppCommand;
395
- let appTemplateName;
396
- let _package_json_content;
397
-
398
- if (options.createAmp){
399
- appTemplateName = "qcobjects-ecommerce-amp";
400
- _package_json_content = createAppCommandAMP;
401
- } else if (options.createPwa){
402
- appTemplateName = "qcobjectsnewapp";
403
- _package_json_content = createAppCommandPWA;
404
- } else if (options.createPhp){
405
- appTemplateName = "qcobjectsnewphp";
406
- _package_json_content = createAppCommandPHP;
407
- } else if (options.createCustom){
408
- appTemplateName = options.createCustom;
409
- _package_json_content = createAppCommandCustom;
410
- } else {
411
- appTemplateName = "qcobjectsnewapp";
412
- _package_json_content = createAppCommandPWA;
413
- }
414
- CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/"+appTemplateName);
415
- /* if (!process.platform.toLowerCase().startsWith("win")){
416
- _package_json_content = _package_json_content.replace(/(")/g, String.fromCharCode(92)+"\"");
417
- }*/
418
- createAppCommand = "npm init -y";
419
- let _package_json_file = path.resolve(CONFIG.get("projectPath"),"./package.json");
420
- logger.debug("_package_json_file: "+_package_json_file);
421
- logger.debug(createAppCommand);
422
-
423
- exec(createAppCommand, (err, stdout, stderr) => {
424
- if (err) {
425
- logger.warn(err);
426
- process.exit(1);
427
- return;
428
- }
429
- fs.writeFile(_package_json_file, _package_json_content, err => {
430
- if (err) {
431
- logger.warn(err);
432
- process.exit(1);
433
- return;
434
- }
435
-
436
- exec("npm cache verify && npm i --save-dev --legacy-peer-deps", (err, stdout, stderr) => {
437
- if (err) {
438
- logger.warn(err);
439
- process.exit(1);
440
- return;
441
- }
442
-
443
- Promise.resolve(switchCommander.copyTemplate())
444
- .then(()=>{
445
- logger.info("Good! Your application is getting done. You can play with QCObjects now!");
446
- logger.info("In about five seconds your server will start...");
447
- exec("qcobjects-createcert",(err,stdout,stderr)=>{
448
- logger.info("Test certificates generated");
449
-
450
- exec("npm uninstall "+appTemplateName+" --save && npm cache verify",(err,stdout,stderr)=>{
451
- switchCommander.generateServiceWorker(appName);
452
- });
453
-
454
- }).stdout.on("data", function(data) {
455
- console.log(data);
456
- });
457
- });
458
- }).stdout.on("data", function(data) {
459
- console.log(data);
460
- });
461
-
462
- });
463
-
464
- }).stdout.on("data", function(data) {
465
- console.log("App generation started...");
466
- });
467
-
468
- });
490
+ }
469
491
 
470
- },
471
- publish: function (_appName){
472
- logger.debug("publish is not yet implemented");
473
- },
474
- upgradeToEnterprise (){
475
- let switchCommander = this;
476
- QCObjectsEnterprise.upgrade(switchCommander);
477
- }
478
- },
479
- initCommand: function (){
492
+ initCommand(){
480
493
  let switchCommander = this;
481
494
  if (process.argv.length>1){
482
495
 
@@ -507,11 +520,9 @@ Package("org.quickcorp.qcobjects.cli",[
507
520
 
508
521
  let importPluginCommands = function (){
509
522
  this.pluginCommandsList = [];
510
- let _pluginCommandsList = global.ClassesList.filter(c=>c.packageName.startsWith("org.quickcorp.qcobjects.cli.commands."));
511
- _pluginCommandsList.filter(pluginCommand=>pluginCommand.className.endsWith(".CommandHandler")).map(pluginCommand => {
512
- this.pluginCommandsList.push(New(pluginCommand.classFactory,{
513
- switchCommander:this
514
- }));
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}));
515
526
  });
516
527
  };
517
528
  importPluginCommands.call(switchCommander);
@@ -569,5 +580,7 @@ Package("org.quickcorp.qcobjects.cli",[
569
580
  }
570
581
 
571
582
  }
572
- })
583
+
584
+ }
585
+
573
586
  ]);