zcatalyst-cli 1.10.1 → 1.11.0
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/docs/client-utils.toml +5 -0
- package/docs/command_needs/auth.toml +1 -1
- package/docs/plugin-loader.toml +4 -0
- package/docs/serve/server/index.toml +4 -0
- package/docs/serve/server/lib/web_client/server.toml +4 -0
- package/lib/apig-utils.js +2 -1
- package/lib/client-utils.js +35 -6
- package/lib/command_needs/auth.js +2 -2
- package/lib/commands/client/delete.js +1 -0
- package/lib/commands/event/generate/index.js +4 -13
- package/lib/commands/iac/import.js +3 -1
- package/lib/commands/init.js +1 -1
- package/lib/commands/pull.js +1 -1
- package/lib/commands/serve.js +2 -1
- package/lib/error.js +6 -5
- package/lib/errorOut.js +2 -2
- package/lib/fn-utils/lib/common.js +4 -4
- package/lib/fn-utils/lib/java.js +1 -1
- package/lib/init/dependencies/npm-install.js +2 -9
- package/lib/init/features/client/index.js +47 -0
- package/lib/init/features/client/initializers/angular.js +88 -0
- package/lib/init/features/client/initializers/basic.js +27 -0
- package/lib/init/features/client/initializers/lyte.js +44 -0
- package/lib/init/features/client/initializers/react.js +53 -0
- package/lib/init/features/functions/languages/node.js +3 -1
- package/lib/init/features/index.js +10 -3
- package/lib/init/features/project.js +1 -1
- package/lib/internal/command.js +4 -1
- package/lib/internal/config.js +2 -1
- package/lib/optional-import.js +11 -25
- package/lib/plugin-loader.js +8 -2
- package/lib/port-resolver.js +4 -2
- package/lib/serve/index.js +6 -1
- package/lib/serve/server/index.js +52 -8
- package/lib/serve/server/lib/master.js +28 -12
- package/lib/serve/server/lib/web_client/index.js +30 -0
- package/lib/serve/server/lib/web_client/server.js +171 -0
- package/lib/serve/server/lib/web_client/utils.js +10 -0
- package/lib/util_modules/char.js +1 -1
- package/lib/util_modules/config/lib/apig.js +2 -1
- package/lib/util_modules/constants/index.js +3 -1
- package/lib/util_modules/constants/lib/placeholders.js +3 -1
- package/lib/util_modules/constants/lib/plugin.js +28 -0
- package/lib/util_modules/constants/lib/template.js +11 -1
- package/lib/util_modules/constants/lib/urls.js +8 -0
- package/lib/util_modules/{contextHelp.js → context-help.js} +0 -0
- package/lib/util_modules/env.js +13 -12
- package/lib/util_modules/global-space.js +99 -0
- package/lib/util_modules/option.js +5 -1
- package/lib/util_modules/shell.js +10 -6
- package/lib/winston.js +1 -1
- package/package.json +6 -3
- package/templates/init/.DS_Store +0 -0
- package/templates/init/client/.DS_Store +0 -0
- package/templates/init/client/{client-package.json → basic/client-package.json} +0 -0
- package/templates/init/client/{index.html → basic/index.html} +0 -0
- package/templates/init/client/{main.css → basic/main.css} +0 -0
- package/templates/init/client/{main.js → basic/main.js} +0 -0
- package/templates/init/client/lyte/build/build.js +301 -0
- package/templates/init/client/lyte/build/scripts/cliDownloadScript.js +54 -0
- package/templates/init/client/lyte/client-package.json +5 -0
- package/templates/init/client/lyte/components/javascript/welcome-comp.js +13 -0
- package/templates/init/client/lyte/components/styles/welcome-comp.css +0 -0
- package/templates/init/client/lyte/components/templates/welcome-comp.html +8 -0
- package/templates/init/client/lyte/data-store/adapters/.gitkeep +0 -0
- package/templates/init/client/lyte/data-store/models/.gitkeep +0 -0
- package/templates/init/client/lyte/data-store/serializers/.gitkeep +0 -0
- package/templates/init/client/lyte/index.html +17 -0
- package/templates/init/client/lyte/package.json +12 -0
- package/templates/init/client/lyte/router.js +14 -0
- package/templates/init/client/lyte/routes/index.js +54 -0
- package/templates/init/client/react/.DS_Store +0 -0
- package/templates/init/client/react/react_js/package.json +11 -0
- package/templates/init/client/react/react_js/template/README.md +70 -0
- package/templates/init/client/react/react_js/template/client-package.json +5 -0
- package/templates/init/client/react/react_js/template/gitignore +23 -0
- package/templates/init/client/react/react_js/template/public/favicon.ico +0 -0
- package/templates/init/client/react/react_js/template/public/index.html +43 -0
- package/templates/init/client/react/react_js/template/public/logo192.png +0 -0
- package/templates/init/client/react/react_js/template/public/logo512.png +0 -0
- package/templates/init/client/react/react_js/template/public/manifest.json +25 -0
- package/templates/init/client/react/react_js/template/public/robots.txt +3 -0
- package/templates/init/client/react/react_js/template/src/App.css +38 -0
- package/templates/init/client/react/react_js/template/src/App.js +25 -0
- package/templates/init/client/react/react_js/template/src/App.test.js +8 -0
- package/templates/init/client/react/react_js/template/src/index.css +13 -0
- package/templates/init/client/react/react_js/template/src/index.js +17 -0
- package/templates/init/client/react/react_js/template/src/logo.svg +1 -0
- package/templates/init/client/react/react_js/template/src/reportWebVitals.js +13 -0
- package/templates/init/client/react/react_js/template/src/setupTests.js +5 -0
- package/templates/init/client/react/react_js/template.json +13 -0
- package/templates/init/client/react/react_ts/package.json +11 -0
- package/templates/init/client/react/react_ts/template/README.md +46 -0
- package/templates/init/client/react/react_ts/template/client-package.json +5 -0
- package/templates/init/client/react/react_ts/template/gitignore +23 -0
- package/templates/init/client/react/react_ts/template/public/favicon.ico +0 -0
- package/templates/init/client/react/react_ts/template/public/index.html +43 -0
- package/templates/init/client/react/react_ts/template/public/logo192.png +0 -0
- package/templates/init/client/react/react_ts/template/public/logo512.png +0 -0
- package/templates/init/client/react/react_ts/template/public/manifest.json +25 -0
- package/templates/init/client/react/react_ts/template/public/robots.txt +3 -0
- package/templates/init/client/react/react_ts/template/src/App.css +38 -0
- package/templates/init/client/react/react_ts/template/src/App.test.tsx +9 -0
- package/templates/init/client/react/react_ts/template/src/App.tsx +26 -0
- package/templates/init/client/react/react_ts/template/src/index.css +13 -0
- package/templates/init/client/react/react_ts/template/src/index.tsx +17 -0
- package/templates/init/client/react/react_ts/template/src/logo.svg +1 -0
- package/templates/init/client/react/react_ts/template/src/reportWebVitals.ts +15 -0
- package/templates/init/client/react/react_ts/template/src/setupTests.ts +5 -0
- package/templates/init/client/react/react_ts/template.json +18 -0
- package/templates/web-socket.txt +21 -0
- package/lib/init/features/client.js +0 -50
- package/lib/serve/server/lib/client.js +0 -30
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Object.freeze({
|
|
4
|
+
mangaer: {
|
|
5
|
+
npm: {
|
|
6
|
+
command: 'npm',
|
|
7
|
+
opts: ['config', 'get', 'prefix', '--json']
|
|
8
|
+
},
|
|
9
|
+
yarn: {
|
|
10
|
+
command: 'yarn',
|
|
11
|
+
opts: ['global', 'dir']
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
client: ['Angular', 'React', 'Basic'],
|
|
15
|
+
react: {
|
|
16
|
+
plugin: 'zcatalyst-cli-plugin-react',
|
|
17
|
+
runner_command: ['create-react-app']
|
|
18
|
+
},
|
|
19
|
+
lyte: {
|
|
20
|
+
plugin: 'zcatalyst-cli-plugin-lyte'
|
|
21
|
+
},
|
|
22
|
+
angular: {
|
|
23
|
+
plugin: 'zcatalyst-cli-plugin-angular',
|
|
24
|
+
runner_command: ['ng', 'new'],
|
|
25
|
+
collection_name: 'zcatalyst-angular-schematics',
|
|
26
|
+
runner_package: '@angular/cli@v12-lts'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -7,7 +7,17 @@ exports.default = Object.freeze({
|
|
|
7
7
|
banner: path_1.join(TEMPLATE_ROOT, 'banner.txt'),
|
|
8
8
|
login_success: path_1.join(TEMPLATE_ROOT, 'loginSuccess.html'),
|
|
9
9
|
login_fail: path_1.join(TEMPLATE_ROOT, 'loginFailure.html'),
|
|
10
|
-
client:
|
|
10
|
+
client: {
|
|
11
|
+
basic: {
|
|
12
|
+
new: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'basic'),
|
|
13
|
+
socket: path_1.join(TEMPLATE_ROOT, 'web-socket.txt')
|
|
14
|
+
},
|
|
15
|
+
lyte: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'lyte'),
|
|
16
|
+
react: {
|
|
17
|
+
js: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'react', 'react_js'),
|
|
18
|
+
ts: path_1.join(TEMPLATE_ROOT, 'init', 'client', 'react', 'react_ts')
|
|
19
|
+
}
|
|
20
|
+
},
|
|
11
21
|
applogic: {
|
|
12
22
|
node: path_1.join(TEMPLATE_ROOT, 'init', 'applogic', 'node')
|
|
13
23
|
},
|
|
@@ -31,9 +31,17 @@ class URL {
|
|
|
31
31
|
}
|
|
32
32
|
return URL._zoho.replace('.com', dc.ext);
|
|
33
33
|
}
|
|
34
|
+
static get console() {
|
|
35
|
+
const dc = dc_1.getActiveDCType();
|
|
36
|
+
if (dc === undefined) {
|
|
37
|
+
return URL._console;
|
|
38
|
+
}
|
|
39
|
+
return URL._console.replace('.com', dc.ext);
|
|
40
|
+
}
|
|
34
41
|
}
|
|
35
42
|
exports.default = URL;
|
|
36
43
|
URL._auth = env_1.envOverride('CATALYST_AUTH_URL', 'https://accounts.zoho.com');
|
|
37
44
|
URL._admin = env_1.envOverride('CATALYST_ADMIN_URL', 'https://api.catalyst.zoho.com');
|
|
38
45
|
URL._app = env_1.envOverride('CATALYST_APP_URL', 'https://catalystserverless.com');
|
|
39
46
|
URL._zoho = env_1.envOverride('ZOHO_URL', 'https://www.zoho.com');
|
|
47
|
+
URL._console = env_1.envOverride('CATALYST_CONSOLE_URL', 'https://console.catalyst.zoho.com');
|
|
File without changes
|
package/lib/util_modules/env.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEnvVariable = exports.envOverride = exports.isPrimaryShell = exports.isWindows = exports.isMac = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
exports.getEnvVariable = exports.envOverride = exports.isPrimaryShell = exports.isWindows = exports.isMac = exports.isCI = void 0;
|
|
4
|
+
exports.isCI = process &&
|
|
5
|
+
!!(process.env.CI ||
|
|
6
|
+
process.env.CONTINUOUS_INTEGRATION ||
|
|
7
|
+
process.env.BUILD_NUMBER ||
|
|
8
|
+
process.env.RUN_ID ||
|
|
9
|
+
exports.name ||
|
|
10
|
+
false);
|
|
11
|
+
exports.isMac = process && process.platform === 'darwin';
|
|
12
|
+
exports.isWindows = process &&
|
|
13
|
+
(process.platform === 'win32' ||
|
|
14
|
+
(process.env.OSTYPE !== undefined && /^(msys|cygwin)$/.test(process.env.OSTYPE)));
|
|
14
15
|
function isPrimaryShell() {
|
|
15
16
|
if (!process || process.env.CATALYST_SUB_PROCESS) {
|
|
16
17
|
return false;
|
|
17
18
|
}
|
|
18
|
-
if (!isWindows
|
|
19
|
+
if (!exports.isWindows && process.env.SHLVL) {
|
|
19
20
|
return parseInt(process.env.SHLVL) <= 1;
|
|
20
21
|
}
|
|
21
22
|
return false;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getYarnNodePth = exports.getNpmNodePth = void 0;
|
|
16
|
+
const shell_js_1 = require("./shell.js");
|
|
17
|
+
const plugin_js_1 = __importDefault(require("./constants/lib/plugin.js"));
|
|
18
|
+
const env_js_1 = require("./env.js");
|
|
19
|
+
const path_1 = require("path");
|
|
20
|
+
const index_js_1 = require("./fs/index.js");
|
|
21
|
+
const runtime_store_js_1 = __importDefault(require("../runtime-store.js"));
|
|
22
|
+
const logger_js_1 = require("./logger.js");
|
|
23
|
+
function getNpmNodePth() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const cachedPath = runtime_store_js_1.default.get('npm.nodePath', false);
|
|
26
|
+
if (cachedPath) {
|
|
27
|
+
return cachedPath;
|
|
28
|
+
}
|
|
29
|
+
const spawnres = yield shell_js_1.spawn(plugin_js_1.default.mangaer.npm.command, plugin_js_1.default.mangaer.npm.opts, {
|
|
30
|
+
stdio: 'pipe'
|
|
31
|
+
}).ASYNC();
|
|
32
|
+
const nodePath = spawnres.stdout.replace(/\n/g, env_js_1.isWindows ? '\\node_modules' : '/lib/node_modules');
|
|
33
|
+
runtime_store_js_1.default.set('npm.nodePath', nodePath);
|
|
34
|
+
return nodePath;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.getNpmNodePth = getNpmNodePth;
|
|
38
|
+
function getYarnNodePth() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const cachedPath = runtime_store_js_1.default.get('yarn.nodePath', false);
|
|
41
|
+
if (cachedPath) {
|
|
42
|
+
return cachedPath;
|
|
43
|
+
}
|
|
44
|
+
const spawnres = yield shell_js_1.spawn(plugin_js_1.default.mangaer.yarn.command, plugin_js_1.default.mangaer.yarn.opts, {
|
|
45
|
+
stdio: 'pipe'
|
|
46
|
+
}).ASYNC();
|
|
47
|
+
const nodePath = spawnres.stdout.replace(/\n/g, path_1.sep + 'node_modules');
|
|
48
|
+
runtime_store_js_1.default.set('yarn.nodePath', nodePath);
|
|
49
|
+
return nodePath;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
exports.getYarnNodePth = getYarnNodePth;
|
|
53
|
+
function findNpmPkg(pkgName, fallback) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
try {
|
|
56
|
+
const nodeModulesPath = yield getNpmNodePth().catch((err) => logger_js_1.debug(err));
|
|
57
|
+
const pkgPath = path_1.join(nodeModulesPath, pkgName);
|
|
58
|
+
return (yield index_js_1.ASYNC.dirExists(pkgPath)) ? pkgPath : fallback;
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
logger_js_1.debug('NPM pkg find error');
|
|
62
|
+
logger_js_1.debug(e);
|
|
63
|
+
}
|
|
64
|
+
return fallback;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function findYarnPkg(pkgName, fallback) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
try {
|
|
70
|
+
const nodeModulesPath = yield getYarnNodePth().catch((err) => logger_js_1.debug(err));
|
|
71
|
+
const pkgPath = path_1.join(nodeModulesPath, pkgName);
|
|
72
|
+
return (yield index_js_1.ASYNC.dirExists(pkgPath)) ? pkgPath : fallback;
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
logger_js_1.debug('YARN pkg find error');
|
|
76
|
+
logger_js_1.debug(e);
|
|
77
|
+
}
|
|
78
|
+
return fallback;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function findPkg(pkgName, fallback = false, pkgManager) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
if (pkgManager) {
|
|
84
|
+
return pkgManager === 'npm'
|
|
85
|
+
? findNpmPkg(pkgName, fallback)
|
|
86
|
+
: findYarnPkg(pkgName, fallback);
|
|
87
|
+
}
|
|
88
|
+
const npmPkg = yield findNpmPkg(pkgName, fallback);
|
|
89
|
+
if (npmPkg !== null) {
|
|
90
|
+
return npmPkg;
|
|
91
|
+
}
|
|
92
|
+
const yarnPkg = yield findYarnPkg(pkgName, fallback);
|
|
93
|
+
if (yarnPkg !== null) {
|
|
94
|
+
return yarnPkg;
|
|
95
|
+
}
|
|
96
|
+
return fallback;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
exports.default = findPkg;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getGlobalOptionValue = exports.setGlobalOption = exports.getOptionValue = exports.getCurrentCommand = void 0;
|
|
6
|
+
exports.getUnknownOpts = exports.getGlobalOptionValue = exports.setGlobalOption = exports.getOptionValue = exports.getCurrentCommand = void 0;
|
|
7
7
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
8
8
|
function getCurrentCommand(fallback) {
|
|
9
9
|
return runtime_store_1.default.get('opts._name', fallback);
|
|
@@ -21,3 +21,7 @@ function getGlobalOptionValue(key, fallback) {
|
|
|
21
21
|
return runtime_store_1.default.get('opts.globalOpts.' + key, fallback);
|
|
22
22
|
}
|
|
23
23
|
exports.getGlobalOptionValue = getGlobalOptionValue;
|
|
24
|
+
function getUnknownOpts(fallback) {
|
|
25
|
+
return runtime_store_1.default.get('opts.unknownOpts', fallback);
|
|
26
|
+
}
|
|
27
|
+
exports.getUnknownOpts = getUnknownOpts;
|
|
@@ -47,19 +47,23 @@ function spawn(command, opts, _a = {}) {
|
|
|
47
47
|
ASYNC: () => {
|
|
48
48
|
const childProcess = cross_spawn_1.default(command, opts, Object.assign({ cwd,
|
|
49
49
|
stdio,
|
|
50
|
-
shell }, otherOpts))
|
|
50
|
+
shell }, otherOpts));
|
|
51
51
|
return new Promise((res, rej) => {
|
|
52
|
+
var _a;
|
|
52
53
|
let message = '';
|
|
54
|
+
let stdout = '';
|
|
55
|
+
(_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (msg) => {
|
|
56
|
+
stdout += msg.toString();
|
|
57
|
+
});
|
|
53
58
|
childProcess.on('message', (msg) => {
|
|
54
59
|
message += msg.toString();
|
|
55
|
-
logger_1.debug(msg.toString());
|
|
56
60
|
});
|
|
57
|
-
childProcess.on('error', rej);
|
|
61
|
+
childProcess.on('error', (err) => rej(err));
|
|
58
62
|
childProcess.on('exit', (code) => {
|
|
59
63
|
if (code !== 0) {
|
|
60
64
|
rej(code);
|
|
61
65
|
}
|
|
62
|
-
res(message);
|
|
66
|
+
res({ message, stdout });
|
|
63
67
|
});
|
|
64
68
|
});
|
|
65
69
|
},
|
|
@@ -72,7 +76,7 @@ function spawn(command, opts, _a = {}) {
|
|
|
72
76
|
exports.spawn = spawn;
|
|
73
77
|
function which(commandName, { alwaysResolve = true }) {
|
|
74
78
|
let cleanedCmd = commandName;
|
|
75
|
-
if (env_1.isWindows
|
|
79
|
+
if (env_1.isWindows) {
|
|
76
80
|
const isPathName = /[\\]/.test(commandName);
|
|
77
81
|
if (isPathName) {
|
|
78
82
|
const dirname = '"' + path_1.default.dirname(commandName) + '"';
|
|
@@ -90,7 +94,7 @@ function which(commandName, { alwaysResolve = true }) {
|
|
|
90
94
|
.replace(/\\'''/g, "\\'");
|
|
91
95
|
}
|
|
92
96
|
return new Promise((resolve, reject) => {
|
|
93
|
-
if (env_1.isWindows
|
|
97
|
+
if (env_1.isWindows) {
|
|
94
98
|
if (/[\x00-\x1f<>:"|?*]/.test(commandName)) {
|
|
95
99
|
alwaysResolve ? resolve(false) : reject('controll char test failed');
|
|
96
100
|
}
|
package/lib/winston.js
CHANGED
|
@@ -60,7 +60,7 @@ exports.logger = winston_1.createLogger({
|
|
|
60
60
|
transports: [exports.transport.console],
|
|
61
61
|
exitOnError: false
|
|
62
62
|
});
|
|
63
|
-
if (env_1.isPrimaryShell()) {
|
|
63
|
+
if (env_1.isWindows || env_1.isPrimaryShell()) {
|
|
64
64
|
if (usage) {
|
|
65
65
|
exports.logger.add(exports.transport.http_log);
|
|
66
66
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcatalyst-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Command Line Tool for CATALYST",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=12.0.0"
|
|
11
11
|
},
|
|
12
|
+
"preferGlobal": true,
|
|
12
13
|
"keywords": [
|
|
13
14
|
"cli",
|
|
14
15
|
"cloud",
|
|
@@ -36,7 +37,6 @@
|
|
|
36
37
|
"express": "^4.17.1",
|
|
37
38
|
"fs-extra": "^10.0.0",
|
|
38
39
|
"fuzzy": "^0.1.3",
|
|
39
|
-
"global-dirs": "^3.0.0",
|
|
40
40
|
"http-proxy": "^1.18.1",
|
|
41
41
|
"inquirer": "^8.1.2",
|
|
42
42
|
"inquirer-autocomplete-prompt": "^1.4.0",
|
|
@@ -53,8 +53,10 @@
|
|
|
53
53
|
"toml": "^3.0.0",
|
|
54
54
|
"update-notifier": "^5.1.0",
|
|
55
55
|
"winston": "^3.3.3",
|
|
56
|
+
"ws": "^8.2.3",
|
|
56
57
|
"xml2js": "^0.4.23",
|
|
57
|
-
"yaml": "^1.10.2"
|
|
58
|
+
"yaml": "^1.10.2",
|
|
59
|
+
"zcatalyst-angular-schematics": "0.0.1"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
62
|
"@types/app-module-path": "^2.2.0",
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
"@types/request": "^2.48.7",
|
|
73
75
|
"@types/semver": "^7.3.8",
|
|
74
76
|
"@types/update-notifier": "^5.1.0",
|
|
77
|
+
"@types/ws": "^8.2.0",
|
|
75
78
|
"@types/xml2js": "^0.4.9",
|
|
76
79
|
"@typescript-eslint/eslint-plugin": "^4.29.1",
|
|
77
80
|
"@typescript-eslint/parser": "^4.29.1",
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path,
|
|
4
|
+
includeStyle,
|
|
5
|
+
fs,
|
|
6
|
+
sane,
|
|
7
|
+
buildUtils,
|
|
8
|
+
buildOptions;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
buildUtils contains all necessary functions for copying and building files.
|
|
12
|
+
---------------------------------------------------------------------------------------
|
|
13
|
+
* Available functions :
|
|
14
|
+
---------------------------------------------------------------------------------------
|
|
15
|
+
* buildUtils.copy.file({options})
|
|
16
|
+
-----options-----
|
|
17
|
+
src : source file
|
|
18
|
+
dist : destination file
|
|
19
|
+
minify : [optional] If file needs to be minified in production mode.
|
|
20
|
+
In development mode file will be copied.(default : false)
|
|
21
|
+
---------------------------------------------------------------------------------------
|
|
22
|
+
* buildUtils.copy.folder({options});
|
|
23
|
+
-----options-----
|
|
24
|
+
src : source folder
|
|
25
|
+
dist : destination folder
|
|
26
|
+
minify : [optional] If folder needs to be minified in production mode.
|
|
27
|
+
In development mode file will be copied.(default : false)
|
|
28
|
+
---------------------------------------------------------------------------------------
|
|
29
|
+
* buildUtils.consolidate({options})
|
|
30
|
+
-----options-----
|
|
31
|
+
configPath : path from which, consolidation mapping json can be retrived.(json file)
|
|
32
|
+
(OR)
|
|
33
|
+
config : consolidation mapping(mapping)
|
|
34
|
+
module : consolidating module name(any string). To store consolidation mapping json
|
|
35
|
+
In order to store mapping and reusing it on build watch and build serve
|
|
36
|
+
file : [optional] When a particular file is changed and needs to be re-consolidated.
|
|
37
|
+
---------------------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
**/
|
|
40
|
+
/**
|
|
41
|
+
For transpiling from es6 to es5 :
|
|
42
|
+
---------------------------------------------------------------------------------------
|
|
43
|
+
* var transpile = require(path.join(options.cliRoot,'lib','utilities','transpile'));
|
|
44
|
+
transpile({options})
|
|
45
|
+
----options---
|
|
46
|
+
file : single file path or path of the folder, that to convert from es6 to es5
|
|
47
|
+
(OR)
|
|
48
|
+
content : Content of the file to convert
|
|
49
|
+
dist : destination file or folder
|
|
50
|
+
strict : [[optional]] To enable strict mode (default : false)
|
|
51
|
+
|
|
52
|
+
---------------------------------------------------------------------------------------
|
|
53
|
+
**/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
For compiling the themes :
|
|
57
|
+
---------------------------------------------------------------------------------------
|
|
58
|
+
* buildUtils.compileThemes(buildOptions,{
|
|
59
|
+
src : Array of src File
|
|
60
|
+
dist : destination file
|
|
61
|
+
themeOptions : {
|
|
62
|
+
// list of less default options
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
---------------------------------------------------------------------------------------
|
|
67
|
+
**/
|
|
68
|
+
|
|
69
|
+
module.exports = {
|
|
70
|
+
version : 1,
|
|
71
|
+
configureFolders : function(options) {
|
|
72
|
+
path = options.path;
|
|
73
|
+
options.outputFolder = "dist"; /* Folder at which the built files are to be needed. */
|
|
74
|
+
options.autoBundle = true ;/* autoBundle is to bundle all (routes,components,models,mixins,helpers and router.js file)*/
|
|
75
|
+
options.theming = false;
|
|
76
|
+
options.useStrict = false;
|
|
77
|
+
options.eslint = false;
|
|
78
|
+
buildUtils = require(path.join(options.cliRoot,'lib','utilities','buildUtils'));
|
|
79
|
+
var folders = { /* Available modules and its folder structures.*/
|
|
80
|
+
build : 'build',
|
|
81
|
+
routes : 'routes',
|
|
82
|
+
routers : 'router.js',
|
|
83
|
+
components : 'components',
|
|
84
|
+
adapters : path.join('data-store','adapters'),
|
|
85
|
+
models : path.join('data-store','models'),
|
|
86
|
+
serializers :path.join('data-store','serializers'),
|
|
87
|
+
mixins :'mixins',
|
|
88
|
+
javascript : path.join('components','javascript'),
|
|
89
|
+
templates : path.join('components','templates'),
|
|
90
|
+
helpers : path.join('components','helpers'),
|
|
91
|
+
styles : path.join('components','styles'),
|
|
92
|
+
images : path.join('components','images'),
|
|
93
|
+
themes : path.join('css'),
|
|
94
|
+
tests : 'tests'
|
|
95
|
+
};
|
|
96
|
+
options.folders = {};
|
|
97
|
+
options.folders.src = {};
|
|
98
|
+
options.folders.dist = {};
|
|
99
|
+
for(var key in folders) {
|
|
100
|
+
options.folders.src[key] = path.join(options.root,folders[key]) /* Source folder of modules. */
|
|
101
|
+
options.folders.dist[key] = path.join(options.root,options.outputFolder,folders[key]) /* Destination folder of modules,
|
|
102
|
+
can be changed if needed. */
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
/*-----------------------------------------------Build Process Starts-------------------------------------------*/
|
|
107
|
+
build : async function (options,dependencies) {
|
|
108
|
+
fs = dependencies.fs; /* fs-extra */
|
|
109
|
+
sane = dependencies.sane; /* watcher */
|
|
110
|
+
buildOptions = options;
|
|
111
|
+
/*configuration for transpile*/
|
|
112
|
+
options.transpile = false;
|
|
113
|
+
if(options.transpile) {
|
|
114
|
+
options.ignoreFoldersFromTranspile = [
|
|
115
|
+
"bower_components",
|
|
116
|
+
"node_modules"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
/* Building of modules starts. Custom modules can be added in build function. */
|
|
120
|
+
await buildUtils.init(options); /* Provides options to buildUtils. */
|
|
121
|
+
await buildUtils.build(['copyAppDir','routes','components','models','helpers','mixins','services']);
|
|
122
|
+
},
|
|
123
|
+
/*-----------------------------------------------Build Process ends---------------------------------------------*/
|
|
124
|
+
|
|
125
|
+
builder : {
|
|
126
|
+
/*----------------------------------Copy Task---------------------------------------------------------------*/
|
|
127
|
+
copyAppDir : async function(module) {
|
|
128
|
+
/* Comment folders to skip copying folders from source folder to destination folder. */
|
|
129
|
+
/*By default outputFolder,routes,mixins,data-store,compdonents,build will be ignored from copying */
|
|
130
|
+
/*Given folder should be relative to the root path*/
|
|
131
|
+
var ignoreFolders = [
|
|
132
|
+
'node_modules'
|
|
133
|
+
];
|
|
134
|
+
await buildUtils._super(module,ignoreFolders);
|
|
135
|
+
await buildUtils._completed(module);
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
/*-----------------------------------------------------------------------------------------------------------*/
|
|
139
|
+
routes : async function(module) {
|
|
140
|
+
|
|
141
|
+
await buildUtils._super(module);
|
|
142
|
+
/** _super of routes
|
|
143
|
+
----------------------
|
|
144
|
+
* Copies route files from source folder to destination folder.
|
|
145
|
+
* Minifies route files if build is in production mode.
|
|
146
|
+
**/
|
|
147
|
+
await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
/*-----------------------------------------------------------------------------------------------------------*/
|
|
151
|
+
components : async function(module) {
|
|
152
|
+
includeStyle = true /* styles will be included to template by default. If not needed, toggle this property. */
|
|
153
|
+
await buildUtils._super(module,{includeStyle : includeStyle});
|
|
154
|
+
/** _super of components
|
|
155
|
+
-------------------------
|
|
156
|
+
* Compiles lyte files to html.
|
|
157
|
+
* Precompiles html files to get dynamic nodes.
|
|
158
|
+
* Appends style to template, if present. And then to component's javascript file.
|
|
159
|
+
* Copies component's files from source folder to destination folder.
|
|
160
|
+
* Minifies components files if build is in production mode.
|
|
161
|
+
**/
|
|
162
|
+
await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
/*-----------------------------------------------------------------------------------------------------------*/
|
|
166
|
+
helpers : async function(module) {
|
|
167
|
+
await buildUtils._super(module);
|
|
168
|
+
/** _super of helpers
|
|
169
|
+
----------------------
|
|
170
|
+
* Copies file from source folder to destination folder(minifies if build
|
|
171
|
+
is in production mode).
|
|
172
|
+
**/
|
|
173
|
+
await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
|
|
174
|
+
},
|
|
175
|
+
|
|
176
|
+
/*-----------------------------------------------------------------------------------------------------------*/
|
|
177
|
+
models : async function(module) {
|
|
178
|
+
await buildUtils._super(module);
|
|
179
|
+
/** _super of models
|
|
180
|
+
----------------------
|
|
181
|
+
* Concats model, adapter and serializer to a single file(minifies if build
|
|
182
|
+
is in production mode).
|
|
183
|
+
* Copies file from source folder to destination folder.
|
|
184
|
+
**/
|
|
185
|
+
await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
/*-----------------------------------------------------------------------------------------------------------*/
|
|
189
|
+
mixins : async function(module) {
|
|
190
|
+
await buildUtils._super(module);
|
|
191
|
+
/** _super of mixins
|
|
192
|
+
----------------------
|
|
193
|
+
* Copies mixins files from source folder to destination folder.
|
|
194
|
+
* Minifies mixins files if build is in production mode.
|
|
195
|
+
**/
|
|
196
|
+
await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
|
|
197
|
+
},
|
|
198
|
+
services : async function(module) {
|
|
199
|
+
|
|
200
|
+
await buildUtils._super(module);
|
|
201
|
+
/** _super of services
|
|
202
|
+
----------------------
|
|
203
|
+
* Copies services files from source folder to destination folder.
|
|
204
|
+
* Minifies services files if build is in production mode.
|
|
205
|
+
**/
|
|
206
|
+
await buildUtils._completed(module) /* Stops the timer and notifies that the module is completed. */
|
|
207
|
+
},
|
|
208
|
+
/*-----------------------------------------------------------------------------------------------------------*/
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
/*------------------------------------------Watch changes and build---------------------------------------------*/
|
|
212
|
+
watcher : {
|
|
213
|
+
copyAppDir : async function(module,file,modification) {
|
|
214
|
+
/* Comment folders to skip copying folders from source folder to destination folder. */
|
|
215
|
+
await buildUtils._super(module,{
|
|
216
|
+
file : file,
|
|
217
|
+
modification : modification
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
/*----------------------------------------------------------------------------------------------------------*/
|
|
221
|
+
routes : async function(module,file,modification) {
|
|
222
|
+
await buildUtils._super(module,{
|
|
223
|
+
file :file,
|
|
224
|
+
modification : modification
|
|
225
|
+
});
|
|
226
|
+
/** _super of routes on watcher
|
|
227
|
+
-------------------------------
|
|
228
|
+
* Copies specifed route files from source folder to destination folder.
|
|
229
|
+
* Minifies route files if build is in production mode.
|
|
230
|
+
**/
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
/*----------------------------------------------------------------------------------------------------------*/
|
|
234
|
+
components : async function(module,file,modification) {
|
|
235
|
+
await buildUtils._super(module,{
|
|
236
|
+
file : file,
|
|
237
|
+
modification :modification,
|
|
238
|
+
includeStyle : includeStyle
|
|
239
|
+
});
|
|
240
|
+
/** _super of components on watcher
|
|
241
|
+
-----------------------------------
|
|
242
|
+
* Compiles specified lyte files to html.
|
|
243
|
+
* Precompiles specified html files to get dynamic nodes.
|
|
244
|
+
* Appends style to template, if present. And then to component's javascript file.
|
|
245
|
+
* Copies specified component's files from source folder to destination folder.
|
|
246
|
+
* Minifies specified component files if build is in production mode.
|
|
247
|
+
**/
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
/*----------------------------------------------------------------------------------------------------------*/
|
|
251
|
+
helpers : async function(module,file,modification) {
|
|
252
|
+
await buildUtils._super(module,{
|
|
253
|
+
file : file,
|
|
254
|
+
modification : modification
|
|
255
|
+
});
|
|
256
|
+
/** _super of helpers on watcher
|
|
257
|
+
---------------------------------
|
|
258
|
+
* Copies modified file from source folder to destination folder(minifies if build is in production mode).
|
|
259
|
+
**/
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
/*----------------------------------------------------------------------------------------------------------*/
|
|
263
|
+
models : async function(module,file,modification) {
|
|
264
|
+
await buildUtils._super(module,{
|
|
265
|
+
file :file,
|
|
266
|
+
modification :modification
|
|
267
|
+
});
|
|
268
|
+
/** _super of models on watcher
|
|
269
|
+
-------------------------------
|
|
270
|
+
* Concats model, adapter and serializer to a single file(minifies if build
|
|
271
|
+
is in production mode).
|
|
272
|
+
* Copies file from source folder to destination folder.
|
|
273
|
+
**/
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
/*----------------------------------------------------------------------------------------------------------*/
|
|
277
|
+
mixins : async function(module,file,modification) {
|
|
278
|
+
await buildUtils._super(module,{
|
|
279
|
+
file : file,
|
|
280
|
+
modification :modification
|
|
281
|
+
});
|
|
282
|
+
/** _super of mixins on watcher
|
|
283
|
+
---------------------------------
|
|
284
|
+
* Copies modified file from source folder to destination folder(minifies if build is in production mode).
|
|
285
|
+
**/
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
services : async function(module,file,modification) {
|
|
289
|
+
await buildUtils._super(module,{
|
|
290
|
+
file : file,
|
|
291
|
+
modification :modification
|
|
292
|
+
});
|
|
293
|
+
/** _super of services on watcher
|
|
294
|
+
---------------------------------
|
|
295
|
+
* Copies modified file from source folder to destination folder(minifies if build is in production mode).
|
|
296
|
+
**/
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
}
|
|
301
|
+
};
|