qcobjects-cli 2.4.32 → 2.4.35

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 (41) hide show
  1. package/.dockerignore +2 -0
  2. package/.eslintignore +4 -0
  3. package/.eslintrc.cjs +6 -0
  4. package/README.md +1 -0
  5. package/VERSION +1 -1
  6. package/package.json +47 -24
  7. package/{backend → src/backend}/com.qcobjects.backend.microservice.static.js +26 -26
  8. package/{backend → src/backend}/org.qcobjects.backend.php.js +45 -38
  9. package/{com.qcobjects.cli.commands.jira.js → src/com.qcobjects.cli.commands.jira.js} +1 -1
  10. package/{com.qcobjects.cli.commands.js → src/com.qcobjects.cli.commands.js} +1 -1
  11. package/{com.qcobjects.cli.commands.version.js → src/com.qcobjects.cli.commands.version.js} +1 -1
  12. package/src/index.cjs +2 -0
  13. package/src/index.d.ts +2 -0
  14. package/src/index.mjs +2 -0
  15. package/src/index.ts +2 -0
  16. package/{org.qcobjects.enterprise.commands.js → src/org.qcobjects.enterprise.commands.js} +1 -1
  17. package/src/org.quickcorp.qcobjects.cli.js +483 -0
  18. package/src/org.quickcorp.qcobjects.defaultsettings.js +349 -0
  19. package/{qcobjects-cli.js → src/qcobjects-cli.js} +5 -3
  20. package/tsconfig.d.json +5 -0
  21. package/tsconfig.json +10 -0
  22. package/.eslintrc.json +0 -15
  23. package/org.quickcorp.qcobjects.cli.js +0 -586
  24. package/org.quickcorp.qcobjects.defaultsettings.js +0 -242
  25. /package/{com.qcobjects.cli.commands.jira.client_services.js → src/com.qcobjects.cli.commands.jira.client_services.js} +0 -0
  26. /package/{org.qcobjects.common.pipelog.js → src/org.qcobjects.common.pipelog.js} +0 -0
  27. /package/{org.quickcorp.qcobjects.api.client_services.js → src/org.quickcorp.qcobjects.api.client_services.js} +0 -0
  28. /package/{org.quickcorp.qcobjects.collab.server.js → src/org.quickcorp.qcobjects.collab.server.js} +0 -0
  29. /package/{org.quickcorp.qcobjects.main.file.js → src/org.quickcorp.qcobjects.main.file.js} +0 -0
  30. /package/{org.quickcorp.qcobjects.main.http.gae.server.js → src/org.quickcorp.qcobjects.main.http.gae.server.js} +0 -0
  31. /package/{org.quickcorp.qcobjects.main.http.server.js → src/org.quickcorp.qcobjects.main.http.server.js} +0 -0
  32. /package/{org.quickcorp.qcobjects.main.http2.server.js → src/org.quickcorp.qcobjects.main.http2.server.js} +0 -0
  33. /package/{qcobjects-collab.js → src/qcobjects-collab.js} +0 -0
  34. /package/{qcobjects-createcert.js → src/qcobjects-createcert.js} +0 -0
  35. /package/{qcobjects-gae-http-server.js → src/qcobjects-gae-http-server.js} +0 -0
  36. /package/{qcobjects-http-server.js → src/qcobjects-http-server.js} +0 -0
  37. /package/{qcobjects-http2-server.js → src/qcobjects-http2-server.js} +0 -0
  38. /package/{qcobjects-shell.js → src/qcobjects-shell.js} +0 -0
  39. /package/{templates → src/templates}/apps/spa-local.html +0 -0
  40. /package/{templates → src/templates}/apps/spa-local.js +0 -0
  41. /package/{templates → src/templates}/pwa/sw.js +0 -0
@@ -1,586 +0,0 @@
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 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
- logger.debugEnabled=false;
41
- CONFIG.set("node_modules_path","./node_modules/");
42
- CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/qcobjectsnewapp");
43
-
44
- require(absolutePath+"/org.qcobjects.enterprise.commands");
45
- require(absolutePath+"/org.quickcorp.qcobjects.api.client_services");
46
- require(absolutePath+"/com.qcobjects.cli.commands");
47
-
48
- let ImportCustomCommand = function (commandName, commandPackage){
49
- let _ret_;
50
- var standardPath = findPackageNodePath(commandPackage) || findPackageNodePath(commandPackage+".js");
51
- if (standardPath !== null){
52
- _ret_ = Import (commandPackage);
53
- } else {
54
- logger.debug(`${commandPackage} is not a valid package for ${commandName}!`);
55
- _ret_ = Promise.reject(new Error(`${commandName} does not exist!`));
56
- }
57
- return _ret_;
58
- };
59
-
60
-
61
- Package("org.quickcorp.qcobjects.cli",[
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){
328
- return new Promise(function (resolve_all,reject_all){
329
- var _promises_set = _shell_commands.map(
330
- function (shell_command){
331
- return (new Promise(
332
- function (resolve,reject){
333
- logger.debug(shell_command);
334
- exec(shell_command,(err,stdout,stderr)=>{
335
- if (!err){
336
- resolve(stdout);
337
- } else {
338
- logger.debug(`[FAILED]: ${shell_command}`);
339
- logger.debug(`${stderr}`);
340
- reject(stderr);
341
- }
342
- }).stdout.on("data", function(data) {
343
- logger.info(data);
344
- });
345
- })).catch(e=>reject_all(e));
346
- }
347
- );
348
- var _promise_all = Promise.all(_promises_set).then(function (response){
349
- resolve_all(response);
350
- }).catch(function (e){
351
- reject_all(e);
352
- });
353
- }).catch(e=>console.log(e));
354
- }
355
-
356
- fileListRecursive (dir) {
357
- var instance = this;
358
- return (fs.statSync(dir).isDirectory())
359
- ? (Array.prototype.concat(...fs.readdirSync(dir).map(f =>instance.fileListRecursive(path.join(dir, f))))
360
- .filter((f)=>{return !f.startsWith(".git")
361
- && f.lastIndexOf(".DS_Store")==-1;
362
- })
363
- )
364
- : (dir);
365
- }
366
-
367
- register(email,phonenumber){
368
- return new Promise (function (resolve,reject){
369
- logger.info("I'm going to register your profile on the cloud...");
370
- let cloudClient = New(QuickCorpCloud, {
371
- apiMethod: "register",
372
- data:{email:email,phonenumber:phonenumber}
373
- });
374
- // logger.debugEnabled = true;
375
- try {
376
- let service = serviceLoader(cloudClient).then(successResonse => {
377
- let template = successResonse.service.template;
378
- let response = JSON.parse(template);
379
- resolve(response);
380
- }).catch ((e)=>{
381
- console.log("\u{1F926} Something went wrong \u{1F926} when trying to register you in the cloud");
382
- reject();
383
- });
384
- } catch (e){
385
- console.log("\u{1F926} Something went wrong \u{1F926} when trying to register you in the cloud");
386
- reject();
387
- }
388
-
389
- });
390
- }
391
-
392
- generateServiceWorker(appName){
393
- var filelist = ["/"].concat(this.fileListRecursive("./"));
394
- filelist = filelist.filter(function (fl){return fl !== "sw.js" && (!fl.startsWith("node_modules/")); });
395
- filelist = filelist.filter(fname => !fname.endsWith(".pem"));
396
- filelist = filelist.filter(fname => !fname.endsWith(".sh"));
397
- filelist = filelist.filter(fname => !(new RegExp("^package(.*).json$")).test(fname));
398
- filelist = filelist.filter(fname => !fname.startsWith("."));
399
- var fileListString = "\n\t\""+filelist.join("\",\n\t\"")+"\"";
400
- var component = New(Component, {
401
- templateURI: "sw.js",
402
- basePath:templatePwaPath,
403
- name:"sw",
404
- cached:false,
405
- tplsource: "default",
406
- data: {
407
- appName: appName,
408
- appVersion: "0.0.1",
409
- filelist: fileListString
410
- },
411
- done ({request, component}) {
412
- fs.writeFile("./sw.js", component.parsedAssignmentText, err => {
413
- logger.info("Service Worker Generated");
414
- console.log("");
415
- console.log("Now simply put:");
416
- console.log("CONFIG.set('serviceWorkerURI','/sw.js');");
417
- console.log(" In your init.js file ");
418
- console.log("");
419
- console.log("To start your app in a local server ");
420
- console.log("Execute the command: ");
421
- console.log("> qcobjects launch <appname>");
422
- console.log("");
423
- process.exit(0);
424
- });
425
- return Promise.resolve({request, component});
426
- }
427
- });
428
- return component;
429
- }
430
-
431
- copyTemplate(){
432
- var map_files = function (pathname,callback){
433
- var _filenames = function (pathname){
434
- fs.readdir(pathname,{withFileTypes:true},function (err,files){
435
- if (typeof files !== "undefined"){
436
- files.filter((f)=>{return f.isFile();}).map((file)=>{
437
- callback(pathname+"/"+file.name);
438
- _filenames(pathname+"/"+file.name);
439
- });
440
- }
441
- });
442
- };
443
- return _filenames(pathname);
444
- };
445
- var map_dirnames = function (pathname,callback){
446
- var _main_pathnames = [];
447
- var _dirnames = function (pathname){
448
- fs.readdir(pathname,{withFileTypes:true},function (err,files){
449
- var _pathnames = [];
450
- if (typeof files !== "undefined"){
451
- files.filter((f)=>{return f.isDirectory();}).map((d)=>{
452
- _pathnames.push(pathname+"/"+d.name);
453
- callback(pathname+"/"+d.name);
454
- _dirnames(pathname+"/"+d.name);
455
- });
456
- }
457
- _main_pathnames = _main_pathnames.concat(_pathnames);
458
- });
459
- return _main_pathnames;
460
- };
461
- return _dirnames(pathname);
462
- };
463
- var relativePath = function (dirname){
464
- return dirname.replace(CONFIG.get("qcobjectsnewapp_path"),".");
465
- };
466
- var copyTemplateFile = function (sourceFileName, destFileName){
467
- fs.copyFile(sourceFileName, destFileName, (err) => {
468
- if (err) throw err;
469
- logger.debug("File "+destFileName+" was created successfully");
470
- });
471
- };
472
- map_dirnames(CONFIG.get("qcobjectsnewapp_path"),(dirname)=>{
473
- logger.info("Creating path: "+relativePath(dirname));
474
- fs.mkdir(relativePath(dirname),()=>{
475
- map_files(dirname,(filename)=>{
476
- logger.debug("Creating file: "+relativePath(filename));
477
- copyTemplateFile(filename,relativePath(filename));
478
- });
479
- });
480
- });
481
- map_files(CONFIG.get("qcobjectsnewapp_path"),(filename)=>{
482
- if (!["./package.json",
483
- "./package-lock.json",
484
- "./sw.js"].includes(relativePath(filename))){
485
- logger.info("Creating file: "+relativePath(filename));
486
- copyTemplateFile(filename,relativePath(filename));
487
- }
488
- });
489
-
490
- }
491
-
492
- initCommand(){
493
- let switchCommander = this;
494
- if (process.argv.length>1){
495
-
496
- switchCommander.program
497
- .version(global.__get_version_string__());
498
- switchCommander.program
499
- .command("create <appname>")
500
- .description("Creates an app with <appname>")
501
- .option("--pwa, --create-pwa", "Creates the progressive web app assets")
502
- .option("--amp, --create-amp", "Creates the accelerated mobile pages assets")
503
- .option("--php, --create-php", "Creates the PWA PHP assets")
504
- .option("--custom, --create-custom <templateappname>", "Creates an App from any NPM package template")
505
- .option("--tests, --create-tests", "Creates the test suite")
506
- .action(function(args, options){
507
- switchCommander.choiceOption.create.call(switchCommander,args,options);
508
- });
509
- switchCommander.program.command("publish <appname>")
510
- .description("Publishes an app with <appname>")
511
- .option("--pwa, --create-pwa", "Publishes the progressive web app assets")
512
- .option("--amp, --create-amp", "Publishes the accelerated mobile pages assets")
513
- .option("--php, --create-php", "Creates the PWA PHP assets")
514
- .option("--custom, --create-custom", "Creates an App from any NPM package template")
515
- .option("--tests, --create-tests", "Publishes the test suite")
516
- .action(function(args, options){
517
- switchCommander.choiceOption.publish.call(switchCommander,args,options);
518
- });
519
-
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
- switchCommander.program.command("upgrade-to-enterprise")
531
- .description("Upgrades to QCObjects Enterprise Edition")
532
- .action(function(args, options){
533
- switchCommander.choiceOption.upgradeToEnterprise.call(switchCommander,args,options);
534
- });
535
- switchCommander.program.command("generate-sw <appname>")
536
- .description("Generates the service worker <appname>")
537
- .action(function(args, options){
538
- switchCommander.choiceOption.generateSw.call(switchCommander,args,options);
539
- });
540
- switchCommander.program.command("launch <appname>")
541
- .description("Launches the application")
542
- .action(function (args,options){
543
- logger.info("Launching...");
544
- setTimeout(()=>{
545
- logger.info("Go to the browser and open https://localhost ");
546
- logger.info("Press Ctrl-C to stop serving ");
547
- exec("qcobjects-server",(err,stdout,stderr)=>{
548
- }).stdout.on("data", function(data) {
549
- console.log(data);
550
- });
551
- },5000);
552
- // setTimeout(()=>{
553
- // execSync("open -a \"google chrome\" https://localhost");
554
- // },6000);
555
-
556
- });
557
-
558
- switchCommander.program.on("--help", function(){
559
- console.log("");
560
- console.log("Use:");
561
- console.log(" $ qcobjects-cli [command] --help");
562
- console.log(" For detailed information of a command ");
563
- console.log("");
564
- process.exit(0);
565
- });
566
-
567
- switchCommander.program.on("command:*", function () {
568
- console.error("Invalid command: %s\nSee --help for a list of available commands.", switchCommander.program.args.join(" "));
569
- process.exit(1);
570
- });
571
- switchCommander.program.parse(process.argv);
572
- } else {
573
- console.log("");
574
- console.log("Use:");
575
- console.log(" $ qcobjects-cli [command] --help");
576
- console.log(" For detailed information of a command ");
577
- console.log("");
578
- process.exit(0);
579
-
580
- }
581
-
582
- }
583
-
584
- }
585
-
586
- ]);