qcobjects-cli 2.4.65 → 2.5.103-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npmpublish-beta.yml +4 -4
- package/.github/workflows/npmpublish-lts.yml +4 -4
- package/.github/workflows/npmpublish-main.yml +4 -4
- package/VERSION +1 -1
- package/build-esbuild.js +69 -0
- package/eslint.config.mjs +88 -0
- package/package.json +74 -46
- package/public/browser/backend/com.qcobjects.backend.microservice.static.js +318 -0
- package/public/browser/backend/com.qcobjects.backend.microservice.static.js.map +7 -0
- package/public/browser/backend/org.qcobjects.backend.php.js +290 -0
- package/public/browser/backend/org.qcobjects.backend.php.js.map +7 -0
- package/public/browser/com.qcobjects.cli.commands.jira.client_services.js +72 -0
- package/public/browser/com.qcobjects.cli.commands.jira.client_services.js.map +7 -0
- package/public/browser/com.qcobjects.cli.commands.jira.js +117 -0
- package/public/browser/com.qcobjects.cli.commands.jira.js.map +7 -0
- package/public/browser/com.qcobjects.cli.commands.js +30 -0
- package/public/browser/com.qcobjects.cli.commands.js.map +7 -0
- package/public/browser/com.qcobjects.cli.commands.version.js +241 -0
- package/public/browser/com.qcobjects.cli.commands.version.js.map +7 -0
- package/public/browser/index.js +97 -0
- package/public/browser/index.js.map +7 -0
- package/public/browser/org.qcobjects.common.pipelog.js +43 -0
- package/public/browser/org.qcobjects.common.pipelog.js.map +7 -0
- package/public/browser/org.qcobjects.enterprise.commands.js +169 -0
- package/public/browser/org.qcobjects.enterprise.commands.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.api.client_services.js +72 -0
- package/public/browser/org.quickcorp.qcobjects.api.client_services.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.cli.js +3185 -0
- package/public/browser/org.quickcorp.qcobjects.cli.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.collab.server.js +422 -0
- package/public/browser/org.quickcorp.qcobjects.collab.server.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.defaultsettings.js +383 -0
- package/public/browser/org.quickcorp.qcobjects.defaultsettings.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.main.file.js +248 -0
- package/public/browser/org.quickcorp.qcobjects.main.file.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.main.http.gae.server.js +538 -0
- package/public/browser/org.quickcorp.qcobjects.main.http.gae.server.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.main.http.server.js +600 -0
- package/public/browser/org.quickcorp.qcobjects.main.http.server.js.map +7 -0
- package/public/browser/org.quickcorp.qcobjects.main.http2.server.js +465 -0
- package/public/browser/org.quickcorp.qcobjects.main.http2.server.js.map +7 -0
- package/public/browser/qcobjects-cli.js +89 -0
- package/public/browser/qcobjects-cli.js.map +7 -0
- package/public/browser/qcobjects-collab.js +41 -0
- package/public/browser/qcobjects-collab.js.map +7 -0
- package/public/browser/qcobjects-createcert.js +67 -0
- package/public/browser/qcobjects-createcert.js.map +7 -0
- package/public/browser/qcobjects-gae-http-server.js +41 -0
- package/public/browser/qcobjects-gae-http-server.js.map +7 -0
- package/public/browser/qcobjects-http-server.js +41 -0
- package/public/browser/qcobjects-http-server.js.map +7 -0
- package/public/browser/qcobjects-http2-server.js +44 -0
- package/public/browser/qcobjects-http2-server.js.map +7 -0
- package/public/browser/qcobjects-shell.js +50 -0
- package/public/browser/qcobjects-shell.js.map +7 -0
- package/public/browser/types/global/index.d.js +15 -0
- package/public/browser/types/global/index.d.js.map +7 -0
- package/public/cjs/backend/com.qcobjects.backend.microservice.static.cjs +305 -0
- package/public/cjs/backend/com.qcobjects.backend.microservice.static.cjs.map +7 -0
- package/public/cjs/backend/org.qcobjects.backend.php.cjs +273 -0
- package/public/cjs/backend/org.qcobjects.backend.php.cjs.map +7 -0
- package/public/cjs/com.qcobjects.cli.commands.cjs +13 -0
- package/public/cjs/com.qcobjects.cli.commands.cjs.map +7 -0
- package/public/cjs/com.qcobjects.cli.commands.jira.cjs +100 -0
- package/public/cjs/com.qcobjects.cli.commands.jira.cjs.map +7 -0
- package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs +55 -0
- package/public/cjs/com.qcobjects.cli.commands.jira.client_services.cjs.map +7 -0
- package/public/cjs/com.qcobjects.cli.commands.version.cjs +224 -0
- package/public/cjs/com.qcobjects.cli.commands.version.cjs.map +7 -0
- package/public/cjs/index.cjs +89 -0
- package/public/cjs/index.cjs.map +7 -0
- package/public/cjs/org.qcobjects.common.pipelog.cjs +26 -0
- package/public/cjs/org.qcobjects.common.pipelog.cjs.map +7 -0
- package/public/cjs/org.qcobjects.enterprise.commands.cjs +152 -0
- package/public/cjs/org.qcobjects.enterprise.commands.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs +55 -0
- package/public/cjs/org.quickcorp.qcobjects.api.client_services.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.cli.cjs +3172 -0
- package/public/cjs/org.quickcorp.qcobjects.cli.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.collab.server.cjs +405 -0
- package/public/cjs/org.quickcorp.qcobjects.collab.server.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs +366 -0
- package/public/cjs/org.quickcorp.qcobjects.defaultsettings.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.main.file.cjs +235 -0
- package/public/cjs/org.quickcorp.qcobjects.main.file.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.main.http.gae.server.cjs +525 -0
- package/public/cjs/org.quickcorp.qcobjects.main.http.gae.server.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.main.http.server.cjs +587 -0
- package/public/cjs/org.quickcorp.qcobjects.main.http.server.cjs.map +7 -0
- package/public/cjs/org.quickcorp.qcobjects.main.http2.server.cjs +452 -0
- package/public/cjs/org.quickcorp.qcobjects.main.http2.server.cjs.map +7 -0
- package/public/cjs/qcobjects-cli.cjs +81 -0
- package/public/cjs/qcobjects-cli.cjs.map +7 -0
- package/public/cjs/qcobjects-collab.cjs +24 -0
- package/public/cjs/qcobjects-collab.cjs.map +7 -0
- package/public/cjs/qcobjects-createcert.cjs +50 -0
- package/public/cjs/qcobjects-createcert.cjs.map +7 -0
- package/public/cjs/qcobjects-gae-http-server.cjs +24 -0
- package/public/cjs/qcobjects-gae-http-server.cjs.map +7 -0
- package/public/cjs/qcobjects-http-server.cjs +24 -0
- package/public/cjs/qcobjects-http-server.cjs.map +7 -0
- package/public/cjs/qcobjects-http2-server.cjs +27 -0
- package/public/cjs/qcobjects-http2-server.cjs.map +7 -0
- package/public/cjs/qcobjects-shell.cjs +34 -0
- package/public/cjs/qcobjects-shell.cjs.map +7 -0
- package/public/cjs/types/global/index.d.cjs +2 -0
- package/public/cjs/types/global/index.d.cjs.map +7 -0
- package/public/esm/backend/com.qcobjects.backend.microservice.static.mjs +315 -0
- package/public/esm/backend/com.qcobjects.backend.microservice.static.mjs.map +7 -0
- package/public/esm/backend/org.qcobjects.backend.php.mjs +287 -0
- package/public/esm/backend/org.qcobjects.backend.php.mjs.map +7 -0
- package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs +69 -0
- package/public/esm/com.qcobjects.cli.commands.jira.client_services.mjs.map +7 -0
- package/public/esm/com.qcobjects.cli.commands.jira.mjs +114 -0
- package/public/esm/com.qcobjects.cli.commands.jira.mjs.map +7 -0
- package/public/esm/com.qcobjects.cli.commands.mjs +27 -0
- package/public/esm/com.qcobjects.cli.commands.mjs.map +7 -0
- package/public/esm/com.qcobjects.cli.commands.version.mjs +238 -0
- package/public/esm/com.qcobjects.cli.commands.version.mjs.map +7 -0
- package/public/esm/index.mjs +78 -0
- package/public/esm/index.mjs.map +7 -0
- package/public/esm/org.qcobjects.common.pipelog.mjs +40 -0
- package/public/esm/org.qcobjects.common.pipelog.mjs.map +7 -0
- package/public/esm/org.qcobjects.enterprise.commands.mjs +166 -0
- package/public/esm/org.qcobjects.enterprise.commands.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs +69 -0
- package/public/esm/org.quickcorp.qcobjects.api.client_services.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.cli.mjs +3182 -0
- package/public/esm/org.quickcorp.qcobjects.cli.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.collab.server.mjs +419 -0
- package/public/esm/org.quickcorp.qcobjects.collab.server.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs +380 -0
- package/public/esm/org.quickcorp.qcobjects.defaultsettings.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.main.file.mjs +245 -0
- package/public/esm/org.quickcorp.qcobjects.main.file.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.main.http.gae.server.mjs +535 -0
- package/public/esm/org.quickcorp.qcobjects.main.http.gae.server.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.main.http.server.mjs +597 -0
- package/public/esm/org.quickcorp.qcobjects.main.http.server.mjs.map +7 -0
- package/public/esm/org.quickcorp.qcobjects.main.http2.server.mjs +462 -0
- package/public/esm/org.quickcorp.qcobjects.main.http2.server.mjs.map +7 -0
- package/public/esm/qcobjects-cli.mjs +68 -0
- package/public/esm/qcobjects-cli.mjs.map +7 -0
- package/public/esm/qcobjects-collab.mjs +38 -0
- package/public/esm/qcobjects-collab.mjs.map +7 -0
- package/public/esm/qcobjects-createcert.mjs +64 -0
- package/public/esm/qcobjects-createcert.mjs.map +7 -0
- package/public/esm/qcobjects-gae-http-server.mjs +38 -0
- package/public/esm/qcobjects-gae-http-server.mjs.map +7 -0
- package/public/esm/qcobjects-http-server.mjs +38 -0
- package/public/esm/qcobjects-http-server.mjs.map +7 -0
- package/public/esm/qcobjects-http2-server.mjs +41 -0
- package/public/esm/qcobjects-http2-server.mjs.map +7 -0
- package/public/esm/qcobjects-shell.mjs +26 -0
- package/public/esm/qcobjects-shell.mjs.map +7 -0
- package/public/esm/types/global/index.d.mjs +12 -0
- package/public/esm/types/global/index.d.mjs.map +7 -0
- package/public/index.d.ts +35 -0
- package/spec/support/jasmine.json +7 -4
- package/src/backend/{com.qcobjects.backend.microservice.static.js → com.qcobjects.backend.microservice.static.ts} +48 -37
- package/src/backend/org.qcobjects.backend.php.ts +348 -0
- package/src/{com.qcobjects.cli.commands.jira.client_services.js → com.qcobjects.cli.commands.jira.client_services.ts} +49 -33
- package/src/com.qcobjects.cli.commands.jira.ts +147 -0
- package/src/com.qcobjects.cli.commands.version.ts +293 -0
- package/src/{index.mjs → index.cts} +1 -1
- package/src/index.mts +2 -0
- package/src/index.ts +1 -1
- package/src/{org.qcobjects.common.pipelog.js → org.qcobjects.common.pipelog.ts} +4 -4
- package/src/org.qcobjects.enterprise.commands.ts +195 -0
- package/src/{org.quickcorp.qcobjects.api.client_services.js → org.quickcorp.qcobjects.api.client_services.ts} +49 -32
- package/src/org.quickcorp.qcobjects.cli.ts +533 -0
- package/src/org.quickcorp.qcobjects.collab.server.ts +420 -0
- package/src/{org.quickcorp.qcobjects.defaultsettings.js → org.quickcorp.qcobjects.defaultsettings.ts} +118 -95
- package/src/org.quickcorp.qcobjects.main.file.ts +180 -0
- package/src/org.quickcorp.qcobjects.main.http.gae.server.ts +507 -0
- package/src/org.quickcorp.qcobjects.main.http.server.ts +551 -0
- package/src/org.quickcorp.qcobjects.main.http2.server.ts +419 -0
- package/src/{qcobjects-cli.js → qcobjects-cli.ts} +7 -8
- package/src/{qcobjects-collab.js → qcobjects-collab.ts} +4 -4
- package/src/{qcobjects-createcert.js → qcobjects-createcert.ts} +5 -3
- package/src/{qcobjects-gae-http-server.js → qcobjects-gae-http-server.ts} +4 -4
- package/src/{qcobjects-http-server.js → qcobjects-http-server.ts} +4 -4
- package/src/{qcobjects-http2-server.js → qcobjects-http2-server.ts} +6 -8
- package/src/{qcobjects-shell.js → qcobjects-shell.ts} +11 -14
- package/src/types/global/index.d.ts +2 -0
- package/tsconfig.d.json +45 -3
- package/tsconfig.jasmine.json +39 -0
- package/tsconfig.json +50 -7
- package/.eslintignore +0 -5
- package/.eslintrc.cjs +0 -6
- package/src/backend/org.qcobjects.backend.php.js +0 -334
- package/src/com.qcobjects.cli.commands.jira.js +0 -144
- package/src/com.qcobjects.cli.commands.version.js +0 -285
- package/src/index.cjs +0 -2
- package/src/index.d.ts +0 -2
- package/src/org.qcobjects.enterprise.commands.js +0 -194
- package/src/org.quickcorp.qcobjects.cli.js +0 -523
- package/src/org.quickcorp.qcobjects.collab.server.js +0 -415
- package/src/org.quickcorp.qcobjects.main.file.js +0 -159
- package/src/org.quickcorp.qcobjects.main.http.gae.server.js +0 -495
- package/src/org.quickcorp.qcobjects.main.http.server.js +0 -529
- package/src/org.quickcorp.qcobjects.main.http2.server.js +0 -392
- /package/spec/{testsSpec.js → testsSpec.ts} +0 -0
- /package/src/{com.qcobjects.cli.commands.js → com.qcobjects.cli.commands.ts} +0 -0
|
@@ -1,523 +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
|
-
CONFIG.set("node_modules_path","./node_modules/");
|
|
41
|
-
CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/qcobjectsnewapp");
|
|
42
|
-
|
|
43
|
-
require(absolutePath+"/org.qcobjects.enterprise.commands");
|
|
44
|
-
require(absolutePath+"/org.quickcorp.qcobjects.api.client_services");
|
|
45
|
-
require(absolutePath+"/com.qcobjects.cli.commands");
|
|
46
|
-
|
|
47
|
-
let ImportCustomCommand = function (commandName, commandPackage){
|
|
48
|
-
let _ret_;
|
|
49
|
-
var standardPath = findPackageNodePath(commandPackage) || findPackageNodePath(commandPackage+".js");
|
|
50
|
-
if (standardPath !== null){
|
|
51
|
-
_ret_ = Import (commandPackage);
|
|
52
|
-
} else {
|
|
53
|
-
logger.debug(`${commandPackage} is not a valid package for ${commandName}!`);
|
|
54
|
-
_ret_ = Promise.reject(new Error(`${commandName} does not exist!`));
|
|
55
|
-
}
|
|
56
|
-
return _ret_;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Package("org.quickcorp.qcobjects.cli",[
|
|
61
|
-
|
|
62
|
-
class SwitchCommander extends InheritClass {
|
|
63
|
-
|
|
64
|
-
choiceOption = {
|
|
65
|
-
generateSw(_appName, options){
|
|
66
|
-
let dirPrefix = options.dir;
|
|
67
|
-
let switchCommander = this;
|
|
68
|
-
let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
|
|
69
|
-
switchCommander.generateServiceWorker(appName, dirPrefix);
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
create(_appName, options){
|
|
73
|
-
const version = global.__get_version__();
|
|
74
|
-
let switchCommander = this;
|
|
75
|
-
let appName = (typeof _appName ==="undefined" || _appName === true)?("MyAppName"):(_appName);
|
|
76
|
-
|
|
77
|
-
let _package_json_content;
|
|
78
|
-
|
|
79
|
-
_package_json_content = `{
|
|
80
|
-
"name": "${appName}"
|
|
81
|
-
"version": "1.0.0",
|
|
82
|
-
"dependencies":{
|
|
83
|
-
"qcobjectsnewphp": "latest",
|
|
84
|
-
"qcobjects": "${version.qcobjects}",
|
|
85
|
-
"qcobjects-sdk": "^${version.sdk}"
|
|
86
|
-
}
|
|
87
|
-
}`;
|
|
88
|
-
|
|
89
|
-
let createAppCommand;
|
|
90
|
-
let appTemplateName;
|
|
91
|
-
|
|
92
|
-
if (options.createAmp){
|
|
93
|
-
appTemplateName = "qcobjects-ecommerce-amp";
|
|
94
|
-
} else if (options.createPwa){
|
|
95
|
-
appTemplateName = "qcobjectsnewapp";
|
|
96
|
-
} else if (options.createPhp){
|
|
97
|
-
appTemplateName = "qcobjectsnewphp";
|
|
98
|
-
} else if (options.createCustom){
|
|
99
|
-
appTemplateName = options.createCustom;
|
|
100
|
-
} else {
|
|
101
|
-
appTemplateName = "qcobjectsnewapp";
|
|
102
|
-
}
|
|
103
|
-
CONFIG.set("qcobjectsnewapp_path",CONFIG.get("node_modules_path")+"/"+appTemplateName);
|
|
104
|
-
|
|
105
|
-
let _package_json_template_fname = path.resolve(CONFIG.get("qcobjectsnewapp_path", "qcobjectsnewapp"), "./package.json");
|
|
106
|
-
|
|
107
|
-
/* if (!process.platform.toLowerCase().startsWith("win")){
|
|
108
|
-
_package_json_content = _package_json_content.replace(/(")/g, String.fromCharCode(92)+"\"");
|
|
109
|
-
}*/
|
|
110
|
-
|
|
111
|
-
createAppCommand = "npm init -y";
|
|
112
|
-
let _package_json_file = path.resolve(CONFIG.get("projectPath"),"./package.json");
|
|
113
|
-
logger.debug("_package_json_file: "+_package_json_file);
|
|
114
|
-
logger.debug(createAppCommand);
|
|
115
|
-
|
|
116
|
-
exec(createAppCommand, (err, stdout, stderr) => {
|
|
117
|
-
if (err) {
|
|
118
|
-
throw Error (err.message);
|
|
119
|
-
process.exit(1);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
exec(`npm i --save-dev ${appTemplateName}`, ()=> {
|
|
124
|
-
let _package_json_template_file = require (_package_json_template_fname);
|
|
125
|
-
_package_json_template_file.name = appName;
|
|
126
|
-
_package_json_template_file.version = "1.0.0";
|
|
127
|
-
_package_json_template_file.repository = {};
|
|
128
|
-
fs.writeFileSync(_package_json_file, JSON.stringify(_package_json_template_file,null,4));
|
|
129
|
-
logger.info("Good! App Templates was installed!");
|
|
130
|
-
|
|
131
|
-
console.log(`Starting to copy files from app template ${appTemplateName} to your project...`);
|
|
132
|
-
|
|
133
|
-
switchCommander.copyTemplate(path.resolve(findPackageNodePath(appTemplateName),appTemplateName),path.resolve(CONFIG.get("projectPath"),"./") )
|
|
134
|
-
.then(()=>{
|
|
135
|
-
|
|
136
|
-
exec("npm uninstall "+appTemplateName+" --save && npm cache verify",(err,stdout,stderr)=>{
|
|
137
|
-
if (err) {
|
|
138
|
-
throw Error (err.message);
|
|
139
|
-
process.exit(1);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/*
|
|
144
|
-
switchCommander.generateServiceWorker(appName)
|
|
145
|
-
.then(()=>{
|
|
146
|
-
execSync("npm install --save-dev qcobjects-cli ");
|
|
147
|
-
});
|
|
148
|
-
*/
|
|
149
|
-
execSync("npm install --save-dev qcobjects-cli ");
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
exec("npm cache verify && npm i ", (err, stdout, stderr) => {
|
|
153
|
-
if (err) {
|
|
154
|
-
throw Error (err.message);
|
|
155
|
-
process.exit(1);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
logger.info("Good! Your application is done. You can play with QCObjects now!");
|
|
160
|
-
|
|
161
|
-
logger.info("I will create the SSL certificates now. It may take some time...");
|
|
162
|
-
exec("qcobjects-createcert",(err,stdout,stderr)=>{
|
|
163
|
-
logger.info("Test certificates generated");
|
|
164
|
-
|
|
165
|
-
let githubService = New(Service);
|
|
166
|
-
githubService.url= "https://raw.githubusercontent.com/QuickCorp/QCObjects/main/.gitignore";
|
|
167
|
-
githubService.headers= {
|
|
168
|
-
Accept: 'application/vnd.github+json',
|
|
169
|
-
'X-GitHub-Api-Version': '2022-11-28',
|
|
170
|
-
'User-Agent': 'qcobjects-cli'
|
|
171
|
-
};
|
|
172
|
-
githubService.done = ()=>{};
|
|
173
|
-
serviceLoader(githubService)
|
|
174
|
-
.then (({service})=> {
|
|
175
|
-
fs.writeFileSync(path.resolve(CONFIG.get("projectPath"),"./.gitignore"),service.template);
|
|
176
|
-
try {
|
|
177
|
-
execSync("git init");
|
|
178
|
-
logger.debug("Git initialized.");
|
|
179
|
-
} catch (e){
|
|
180
|
-
logger.debug("Could not initialize git.");
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
}).stdout.on("data", function(data) {
|
|
185
|
-
console.log(data);
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
}).stdout.on("data", function(data) {
|
|
189
|
-
console.log(data);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
})
|
|
193
|
-
.catch((e)=>{
|
|
194
|
-
console.log(e);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}).stdout.on("data", function(data) {
|
|
199
|
-
console.log(data);
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
}).stdout.on("data", function(data) {
|
|
203
|
-
console.log("App generation started...");
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
publish(_appName){
|
|
208
|
-
logger.debug("publish is not yet implemented");
|
|
209
|
-
},
|
|
210
|
-
upgradeToEnterprise (){
|
|
211
|
-
let switchCommander = this;
|
|
212
|
-
QCObjectsEnterprise.upgrade(switchCommander);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
constructor (){
|
|
217
|
-
super(...arguments);
|
|
218
|
-
this.program = require("commander");
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
shellCommands(_shell_commands){
|
|
222
|
-
return new Promise(function (resolve_all,reject_all){
|
|
223
|
-
var _promises_set = _shell_commands.map(
|
|
224
|
-
function (shell_command){
|
|
225
|
-
return (new Promise(
|
|
226
|
-
function (resolve,reject){
|
|
227
|
-
logger.debug(shell_command);
|
|
228
|
-
exec(shell_command,(err,stdout,stderr)=>{
|
|
229
|
-
if (!err){
|
|
230
|
-
resolve(stdout);
|
|
231
|
-
} else {
|
|
232
|
-
logger.debug(`[FAILED]: ${shell_command}`);
|
|
233
|
-
logger.debug(`${stderr}`);
|
|
234
|
-
reject(stderr);
|
|
235
|
-
}
|
|
236
|
-
}).stdout.on("data", function(data) {
|
|
237
|
-
logger.info(data);
|
|
238
|
-
});
|
|
239
|
-
})).catch(e=>reject_all(e));
|
|
240
|
-
}
|
|
241
|
-
);
|
|
242
|
-
var _promise_all = Promise.all(_promises_set).then(function (response){
|
|
243
|
-
resolve_all(response);
|
|
244
|
-
}).catch(function (e){
|
|
245
|
-
reject_all(e);
|
|
246
|
-
});
|
|
247
|
-
}).catch(e=>console.log(e));
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
fileListRecursive (dir) {
|
|
251
|
-
var instance = this;
|
|
252
|
-
return (fs.statSync(dir).isDirectory())
|
|
253
|
-
? (Array.prototype.concat(...fs.readdirSync(dir).map(f =>instance.fileListRecursive(path.join(dir, f))))
|
|
254
|
-
.filter((f)=>{return !f.startsWith(".git")
|
|
255
|
-
&& f.lastIndexOf(".DS_Store")==-1;
|
|
256
|
-
})
|
|
257
|
-
)
|
|
258
|
-
: (dir);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
register(email,phonenumber){
|
|
262
|
-
return new Promise (function (resolve,reject){
|
|
263
|
-
logger.info("I'm going to register your profile on the cloud...");
|
|
264
|
-
let cloudClient = New(QuickCorpCloud, {
|
|
265
|
-
apiMethod: "register",
|
|
266
|
-
data:{email:email,phonenumber:phonenumber}
|
|
267
|
-
});
|
|
268
|
-
// logger.debugEnabled = true;
|
|
269
|
-
try {
|
|
270
|
-
let service = serviceLoader(cloudClient).then(successResonse => {
|
|
271
|
-
let template = successResonse.service.template;
|
|
272
|
-
let response = JSON.parse(template);
|
|
273
|
-
resolve(response);
|
|
274
|
-
}).catch ((e)=>{
|
|
275
|
-
console.log("\u{1F926} Something went wrong \u{1F926} when trying to register you in the cloud");
|
|
276
|
-
reject();
|
|
277
|
-
});
|
|
278
|
-
} catch (e){
|
|
279
|
-
console.log("\u{1F926} Something went wrong \u{1F926} when trying to register you in the cloud");
|
|
280
|
-
reject();
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
generateServiceWorker(appName, dirPrefix = "./"){
|
|
287
|
-
const writeContent = (component) => {
|
|
288
|
-
const parsedText = component.parseTemplate(component.template);
|
|
289
|
-
logger.debug("Starting to write the sw file...");
|
|
290
|
-
fs.writeFile(`${dirPrefix}/sw.js`, parsedText , (err) => {
|
|
291
|
-
if (err){
|
|
292
|
-
throw Error (err);
|
|
293
|
-
}
|
|
294
|
-
logger.info("Service Worker Generated");
|
|
295
|
-
console.log("");
|
|
296
|
-
console.log("Now simply put:");
|
|
297
|
-
console.log("CONFIG.set('serviceWorkerURI','/sw.js');");
|
|
298
|
-
console.log(" In your init.js file ");
|
|
299
|
-
console.log("");
|
|
300
|
-
console.log("To start your app in a local server ");
|
|
301
|
-
console.log("Execute the command: ");
|
|
302
|
-
console.log("> qcobjects launch <appname>");
|
|
303
|
-
console.log("");
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
class ServiceWorkerComponent extends Component {
|
|
310
|
-
cached = false;
|
|
311
|
-
templateURI= "sw.js";
|
|
312
|
-
basePath = templatePwaPath;
|
|
313
|
-
name ="sw";
|
|
314
|
-
tplsource= "default";
|
|
315
|
-
template = "";
|
|
316
|
-
|
|
317
|
-
done ({request, component}){
|
|
318
|
-
super.done({request, component});
|
|
319
|
-
writeContent(this);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
return new Promise( (resolve, reject) => {
|
|
324
|
-
var filelist = ["/"].concat(this.fileListRecursive(`${dirPrefix}`));
|
|
325
|
-
if (typeof dirPrefix !== "undefined" && dirPrefix !== "./" && dirPrefix !== "."){
|
|
326
|
-
filelist = filelist.map(f=>f.replace(new RegExp(`${dirPrefix}/`), ""));
|
|
327
|
-
}
|
|
328
|
-
filelist = filelist.filter(function (fl){return fl !== "sw.js" && (!fl.startsWith("node_modules/")); });
|
|
329
|
-
filelist = filelist.filter(fname => !fname.endsWith(".pem"));
|
|
330
|
-
filelist = filelist.filter(fname => !fname.endsWith(".sh"));
|
|
331
|
-
filelist = filelist.filter(fname => !(new RegExp("^package(.*).json$")).test(fname));
|
|
332
|
-
filelist = filelist.filter(fname => !fname.startsWith("."));
|
|
333
|
-
var fileListString = "\n\t\""+filelist.join("\",\n\t\"")+"\"";
|
|
334
|
-
let component;
|
|
335
|
-
|
|
336
|
-
new Promise ((resolve, reject)=> {
|
|
337
|
-
component = new ServiceWorkerComponent({
|
|
338
|
-
name: "sw",
|
|
339
|
-
data: {
|
|
340
|
-
appName: appName,
|
|
341
|
-
appVersion: "1.0.0",
|
|
342
|
-
filelist: fileListString
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
setTimeout(()=> {
|
|
346
|
-
component.done({request:null, component});
|
|
347
|
-
}, 1000);
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
copyTemplate(source, dest){
|
|
353
|
-
return new Promise ((resolve, reject)=> {
|
|
354
|
-
|
|
355
|
-
const copyDir = (source, dest, exclude) => {
|
|
356
|
-
source = path.resolve(source);
|
|
357
|
-
dest = path.resolve(dest);
|
|
358
|
-
const dname = path.basename(source);
|
|
359
|
-
const dirExcluded = (exclude.includes(dname));
|
|
360
|
-
|
|
361
|
-
const isDir = (d) => {
|
|
362
|
-
return (fs.existsSync(d) && fs.statSync(d).isDirectory())?(true):(false);
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
const isFile = (d) => {
|
|
366
|
-
return (fs.existsSync(d) && fs.statSync(d).isFile())?(true):(false);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
if (isDir(source) && !dirExcluded){
|
|
370
|
-
fs.mkdirSync(dest, {recursive:true});
|
|
371
|
-
const paths = fs.readdirSync(source, {withFileTypes:true})
|
|
372
|
-
const dirs = paths.filter(d=>d.isDirectory());
|
|
373
|
-
const files = paths.filter(f=>f.isFile());
|
|
374
|
-
(async function (paths, dirs, files, exclude){
|
|
375
|
-
files.map((f)=>{
|
|
376
|
-
const sourceFile = path.resolve(source, f.name);
|
|
377
|
-
const destFile = path.resolve(dest, f.name);
|
|
378
|
-
const fileExcluded = exclude.includes(f.name);
|
|
379
|
-
if (isFile(sourceFile) && !fileExcluded){
|
|
380
|
-
logger.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude}...`);
|
|
381
|
-
fs.copyFileSync(sourceFile, destFile);
|
|
382
|
-
logger.debug(`[publish:static] Copying files from ${sourceFile} to ${destFile} excluding ${exclude}...DONE!`);
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
dirs.map((d)=>{
|
|
386
|
-
const sourceDir = path.resolve(source, d.name);
|
|
387
|
-
const destDir = path.resolve(dest, d.name);
|
|
388
|
-
copyDir(sourceDir,destDir, exclude);
|
|
389
|
-
});
|
|
390
|
-
})(paths, dirs, files, exclude);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
try {
|
|
396
|
-
const exclude = [
|
|
397
|
-
"package.json",
|
|
398
|
-
"node_modules",
|
|
399
|
-
".DS_Store"
|
|
400
|
-
]
|
|
401
|
-
logger.info(`[create] Copying files from ${source} to ${dest} excluding ${exclude}...`);
|
|
402
|
-
copyDir(source, dest, (typeof exclude !== "undefined") ? (exclude) : ([]));
|
|
403
|
-
resolve();
|
|
404
|
-
} catch (e) {
|
|
405
|
-
logger.warn(`Something went wrong trying to publish static files: ${e.message}`);
|
|
406
|
-
reject(e);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
initCommand(){
|
|
414
|
-
let switchCommander = this;
|
|
415
|
-
if (process.argv.length>1){
|
|
416
|
-
logger.debug("Installing Commands...");
|
|
417
|
-
|
|
418
|
-
switchCommander.program
|
|
419
|
-
.version(global.__get_version_string__());
|
|
420
|
-
switchCommander.program
|
|
421
|
-
.command("create <appname>")
|
|
422
|
-
.description("Creates an app with <appname>")
|
|
423
|
-
.option("--pwa, --create-pwa", "Creates the progressive web app assets")
|
|
424
|
-
.option("--amp, --create-amp", "Creates the accelerated mobile pages assets")
|
|
425
|
-
.option("--php, --create-php", "Creates the PWA PHP assets")
|
|
426
|
-
.option("--custom, --create-custom <templateappname>", "Creates an App from any NPM package template")
|
|
427
|
-
.option("--tests, --create-tests", "Creates the test suite")
|
|
428
|
-
.action(function(args, options){
|
|
429
|
-
switchCommander.choiceOption.create.call(switchCommander,args,options);
|
|
430
|
-
});
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
try {
|
|
434
|
-
logger.debug("Loading Plugin Commands...");
|
|
435
|
-
const importPluginCommands = function (switchCommander){
|
|
436
|
-
return global.ClassesList
|
|
437
|
-
.filter(c=>c.packageName.startsWith("com.qcobjects.cli.commands."))
|
|
438
|
-
.filter(p=>p.classFactory.name.endsWith("CommandHandler"))
|
|
439
|
-
.map(pluginCommand => {
|
|
440
|
-
try {
|
|
441
|
-
logger.debug(`Loading plugin ${pluginCommand.packageName}`);
|
|
442
|
-
const classFactory = pluginCommand.classFactory;
|
|
443
|
-
pluginCommand.plugin = New(classFactory,{switchCommander:switchCommander});
|
|
444
|
-
} catch (e){
|
|
445
|
-
throw Error(`Something went wrong loading ${pluginCommand.packageName}`);
|
|
446
|
-
}
|
|
447
|
-
return pluginCommand;
|
|
448
|
-
});
|
|
449
|
-
};
|
|
450
|
-
importPluginCommands(switchCommander);
|
|
451
|
-
} catch (e){
|
|
452
|
-
throw Error (`Something went wrong loading plugins: ${e.message}`);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
switchCommander.program.command("publish <appname>")
|
|
456
|
-
.description("Publishes an app with <appname>")
|
|
457
|
-
.option("--pwa, --create-pwa", "Publishes the progressive web app assets")
|
|
458
|
-
.option("--amp, --create-amp", "Publishes the accelerated mobile pages assets")
|
|
459
|
-
.option("--php, --create-php", "Creates the PWA PHP assets")
|
|
460
|
-
.option("--custom, --create-custom", "Creates an App from any NPM package template")
|
|
461
|
-
.option("--tests, --create-tests", "Publishes the test suite")
|
|
462
|
-
.action(function(args, options){
|
|
463
|
-
switchCommander.choiceOption.publish.call(switchCommander,args,options);
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
switchCommander.program.command("upgrade-to-enterprise")
|
|
467
|
-
.description("Upgrades to QCObjects Enterprise Edition")
|
|
468
|
-
.action(function(args, options){
|
|
469
|
-
switchCommander.choiceOption.upgradeToEnterprise.call(switchCommander,args,options);
|
|
470
|
-
});
|
|
471
|
-
switchCommander.program.command("generate-sw <appname>")
|
|
472
|
-
.option("-d, --dir <dirPrefix> ", "creates the service worker in a specific dir <dirPrefix>")
|
|
473
|
-
.description("Generates the service worker <appname>")
|
|
474
|
-
.action(function(args, options){
|
|
475
|
-
switchCommander.choiceOption.generateSw.call(switchCommander,args,options);
|
|
476
|
-
});
|
|
477
|
-
switchCommander.program.command("launch <appname>")
|
|
478
|
-
.description("Launches the application")
|
|
479
|
-
.action(function (args,options){
|
|
480
|
-
logger.info("Launching...");
|
|
481
|
-
setTimeout(()=>{
|
|
482
|
-
logger.info("Go to the browser and open https://localhost ");
|
|
483
|
-
logger.info("Press Ctrl-C to stop serving ");
|
|
484
|
-
exec("qcobjects-server",(err,stdout,stderr)=>{
|
|
485
|
-
}).stdout.on("data", function(data) {
|
|
486
|
-
console.log(data);
|
|
487
|
-
});
|
|
488
|
-
},5000);
|
|
489
|
-
// setTimeout(()=>{
|
|
490
|
-
// execSync("open -a \"google chrome\" https://localhost");
|
|
491
|
-
// },6000);
|
|
492
|
-
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
switchCommander.program.on("--help", function(){
|
|
496
|
-
console.log("");
|
|
497
|
-
console.log("Use:");
|
|
498
|
-
console.log(" $ qcobjects-cli [command] --help");
|
|
499
|
-
console.log(" For detailed information of a command ");
|
|
500
|
-
console.log("");
|
|
501
|
-
process.exit(0);
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
switchCommander.program.on("command:*", function () {
|
|
505
|
-
console.error("Invalid command: %s\nSee --help for a list of available commands.", switchCommander.program.args.join(" "));
|
|
506
|
-
process.exit(1);
|
|
507
|
-
});
|
|
508
|
-
switchCommander.program.parse(process.argv);
|
|
509
|
-
} else {
|
|
510
|
-
console.log("");
|
|
511
|
-
console.log("Use:");
|
|
512
|
-
console.log(" $ qcobjects-cli [command] --help");
|
|
513
|
-
console.log(" For detailed information of a command ");
|
|
514
|
-
console.log("");
|
|
515
|
-
process.exit(0);
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
]);
|