zcatalyst-cli 1.9.1 → 1.11.1
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/README.md +3 -3
- package/docs/.DS_Store +0 -0
- package/docs/client-utils.toml +5 -0
- package/docs/command_needs/auth.toml +5 -0
- package/docs/commands/iac/export.toml +4 -0
- package/docs/commands/iac/import.toml +4 -0
- package/docs/commands/iac/status.toml +4 -0
- package/docs/commands/project/use.toml +6 -0
- package/docs/iac/status/bundle.toml +4 -0
- 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/api-timer.js +81 -0
- package/lib/apig-utils.js +17 -14
- package/lib/archiver.js +83 -45
- package/lib/authentication/login.js +4 -2
- package/lib/bin/catalyst.js +0 -1
- package/lib/client-utils.js +28 -26
- package/lib/client.js +0 -3
- package/lib/command_needs/auth.js +12 -3
- package/lib/command_needs/rc.js +12 -7
- package/lib/commands/apig/status.js +6 -4
- package/lib/commands/client/delete.js +3 -4
- package/lib/commands/client/setup.js +1 -1
- package/lib/commands/deploy.js +3 -1
- package/lib/commands/ds/export.js +3 -1
- package/lib/commands/ds/import.js +3 -1
- package/lib/commands/ds/status.js +145 -149
- package/lib/commands/event/generate/index.js +4 -13
- package/lib/commands/functions/config.js +1 -1
- package/lib/commands/functions/setup.js +1 -1
- package/lib/commands/help.js +1 -23
- package/lib/commands/iac/export.js +85 -0
- package/lib/commands/iac/import.js +210 -0
- package/lib/commands/iac/pack.js +129 -0
- package/lib/commands/iac/status.js +63 -0
- package/lib/commands/index.js +4 -0
- package/lib/commands/init.js +34 -27
- package/lib/commands/project/list.js +10 -6
- package/lib/commands/project/use.js +42 -25
- package/lib/commands/pull.js +1 -1
- package/lib/commands/serve.js +2 -1
- package/lib/deploy/features/functions/index.js +2 -1
- package/lib/deploy/index.js +3 -1
- package/lib/endpoints/lib/iac.js +134 -0
- package/lib/endpoints/lib/sdk.js +2 -2
- package/lib/error.js +33 -3
- package/lib/errorOut.js +4 -3
- package/lib/fn-utils/lib/common.js +37 -16
- package/lib/fn-utils/lib/java.js +7 -9
- package/lib/fn-utils/lib/node.js +7 -1
- package/lib/iac/status/bundle.js +82 -0
- package/lib/iac/status/deploy.js +74 -0
- package/lib/iac/status/util/index.js +26 -0
- package/lib/index.js +8 -14
- 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 +106 -0
- package/lib/init/features/client/initializers/basic.js +50 -0
- package/lib/init/features/client/initializers/lyte.js +61 -0
- package/lib/init/features/client/initializers/react.js +77 -0
- package/lib/init/features/functions/languages/java.js +2 -5
- package/lib/init/features/functions/languages/node.js +5 -6
- package/lib/init/features/index.js +18 -6
- package/lib/init/features/project.js +72 -34
- package/lib/init/util/client.js +96 -0
- package/lib/init/util/functions.js +20 -0
- package/lib/init/util/project.js +35 -0
- package/lib/internal/api.js +6 -9
- package/lib/internal/command.js +6 -3
- package/lib/internal/config.js +7 -4
- package/lib/migration/index.js +10 -6
- package/lib/option-filter.js +4 -1
- package/lib/optional-import.js +11 -25
- package/lib/plugin-loader.js +8 -2
- package/lib/port-resolver.js +20 -16
- package/lib/prompt/index.js +92 -0
- package/lib/prompt/types/file-path.js +95 -0
- package/lib/pull/features/client.js +1 -1
- package/lib/pull/features/functions/index.js +5 -7
- package/lib/pull/index.js +4 -1
- package/lib/serve/features/index.js +3 -1
- package/lib/serve/index.js +6 -1
- package/lib/serve/server/index.js +52 -8
- package/lib/serve/server/lib/master.js +24 -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/shell/dependencies/http-functions.js +1 -1
- package/lib/shell/index.js +3 -1
- package/lib/track.js +3 -1
- 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 +5 -1
- package/lib/util_modules/constants/lib/file-names.js +2 -1
- package/lib/util_modules/constants/lib/iac.js +8 -0
- package/lib/util_modules/constants/lib/placeholders.js +1 -0
- package/lib/util_modules/constants/lib/plugin.js +28 -0
- package/lib/util_modules/constants/lib/regex.js +2 -1
- package/lib/util_modules/constants/lib/scopes.js +5 -0
- package/lib/util_modules/constants/lib/template.js +11 -1
- package/lib/util_modules/constants/lib/urls.js +12 -4
- package/lib/util_modules/constants/project.js +6 -0
- package/lib/util_modules/{contextHelp.js → context-help.js} +5 -1
- package/lib/util_modules/env.js +14 -16
- package/lib/util_modules/fs/lib/async.js +29 -22
- package/lib/util_modules/fs/utils.js +8 -0
- package/lib/util_modules/global-space.js +99 -0
- package/lib/util_modules/js.js +6 -0
- package/lib/util_modules/option.js +5 -1
- package/lib/util_modules/parser/toml.js +5 -1
- package/lib/util_modules/project.js +3 -0
- package/lib/util_modules/shell.js +9 -8
- package/lib/winston.js +1 -1
- package/package.json +11 -5
- package/templates/.DS_Store +0 -0
- package/templates/iacSuccess.html +391 -0
- 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/init/functions/java/integ/cliq/com/handlers/BotHandler.java +94 -109
- package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +20 -27
- package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +143 -112
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +4 -7
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +4 -7
- package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +10 -12
- package/templates/init/functions/java/integ/cliq/com/handlers/WidgetHandler.java +100 -66
- package/templates/init/functions/java/integ/cliq/sample.java +5 -7
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +0 -1
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +46 -0
- package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +31 -0
- package/templates/web-socket.txt +21 -0
- package/lib/init/features/client.js +0 -51
- package/lib/prompt.js +0 -49
- package/lib/serve/server/lib/client.js +0 -30
|
@@ -75,7 +75,7 @@ function setFnConfig(featureName, add) {
|
|
|
75
75
|
const config = runtime_store_1.default.get('config');
|
|
76
76
|
featureContextArr.forEach((context) => {
|
|
77
77
|
var _a, _b;
|
|
78
|
-
const targetSourceDir = featureName === 'functions' ? path_1.dirname(context.source) :
|
|
78
|
+
const targetSourceDir = featureName === 'functions' ? path_1.dirname(context.source) : context.source;
|
|
79
79
|
const targetSource = path_1.relative(project_1.getProjectRoot(), targetSourceDir);
|
|
80
80
|
switch (featureName) {
|
|
81
81
|
case 'functions':
|
|
@@ -98,6 +98,13 @@ function setFnConfig(featureName, add) {
|
|
|
98
98
|
break;
|
|
99
99
|
case 'client':
|
|
100
100
|
config.set('client.source', targetSource);
|
|
101
|
+
const plugin = runtime_store_1.default.get('payload.client.plugin', false);
|
|
102
|
+
if (plugin) {
|
|
103
|
+
config.set('client.plugin', plugin);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
config.unset('client.plugin');
|
|
107
|
+
}
|
|
101
108
|
break;
|
|
102
109
|
case 'apig':
|
|
103
110
|
config.set('apig.rules', targetSource);
|
|
@@ -109,23 +116,23 @@ function setFnConfig(featureName, add) {
|
|
|
109
116
|
exports.setFnConfig = setFnConfig;
|
|
110
117
|
function functions(add = false) {
|
|
111
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
yield (yield Promise.resolve().then(() => __importStar(require('./functions')))).default();
|
|
119
|
+
yield (yield Promise.resolve().then(() => __importStar(require('./functions/index.js')))).default();
|
|
113
120
|
setFnConfig('functions', add);
|
|
114
121
|
});
|
|
115
122
|
}
|
|
116
123
|
exports.functions = functions;
|
|
117
124
|
function client() {
|
|
118
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
yield (yield Promise.resolve().then(() => __importStar(require('./client')))).default();
|
|
126
|
+
yield (yield Promise.resolve().then(() => __importStar(require('./client/index.js')))).default();
|
|
120
127
|
setFnConfig('client', false);
|
|
121
128
|
});
|
|
122
129
|
}
|
|
123
130
|
exports.client = client;
|
|
124
131
|
function project() {
|
|
125
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
yield (yield Promise.resolve().then(() => __importStar(require('./project')))).default();
|
|
133
|
+
yield (yield Promise.resolve().then(() => __importStar(require('./project.js')))).default();
|
|
127
134
|
const projectPayload = runtime_store_1.default.get('payload.project', null);
|
|
128
|
-
if (projectPayload
|
|
135
|
+
if (!projectPayload) {
|
|
129
136
|
return;
|
|
130
137
|
}
|
|
131
138
|
yield project_1.upsertProject(projectPayload, {
|
|
@@ -133,10 +140,15 @@ function project() {
|
|
|
133
140
|
active: true
|
|
134
141
|
});
|
|
135
142
|
yield upsertEnvArr(runtime_store_1.default.get('payload.env', null));
|
|
136
|
-
if (runtime_store_1.default.get('project.new', false)) {
|
|
143
|
+
if (runtime_store_1.default.get('payload.project.new', false)) {
|
|
137
144
|
logger_1.message('New Project has been successfully created and associated with this directory.');
|
|
138
145
|
}
|
|
139
146
|
logger_1.message(ansi_colors_1.bold(constants_1.FILENAME.rc) + ' file has be successfully created with project details.');
|
|
147
|
+
const isImport = runtime_store_1.default.get('payload.project.import', false);
|
|
148
|
+
if (isImport) {
|
|
149
|
+
setFnConfig('functions', true);
|
|
150
|
+
setFnConfig('client', false);
|
|
151
|
+
}
|
|
140
152
|
});
|
|
141
153
|
}
|
|
142
154
|
exports.project = project;
|
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const ansi_colors_1 = require("ansi-colors");
|
|
16
|
+
const import_1 = require("../../commands/iac/import");
|
|
16
17
|
const endpoints_1 = require("../../endpoints");
|
|
17
18
|
const error_1 = __importDefault(require("../../error"));
|
|
18
19
|
const prompt_1 = __importDefault(require("../../prompt"));
|
|
@@ -21,43 +22,53 @@ const constants_1 = require("../../util_modules/constants");
|
|
|
21
22
|
const js_1 = require("../../util_modules/js");
|
|
22
23
|
const logger_1 = require("../../util_modules/logger");
|
|
23
24
|
const option_1 = require("../../util_modules/option");
|
|
25
|
+
const yaml_1 = __importDefault(require("yaml"));
|
|
24
26
|
const project_1 = require("../../util_modules/project");
|
|
27
|
+
const path_1 = require("path");
|
|
28
|
+
const functions_1 = require("../util/functions");
|
|
29
|
+
const project_2 = require("../util/project");
|
|
30
|
+
const client_1 = require("../util/client");
|
|
31
|
+
const runtime_1 = __importDefault(require("../../util_modules/constants/lib/runtime"));
|
|
32
|
+
const fn_utils_1 = require("../../fn-utils");
|
|
33
|
+
const client_utils_1 = require("../../client-utils");
|
|
25
34
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
35
|
+
var _a, _b;
|
|
26
36
|
const projectAPI = yield endpoints_1.projectAPI();
|
|
27
37
|
const defaultRCProjectName = project_1.getDefaultProjectName(null);
|
|
28
38
|
const defaultRCProjectId = project_1.getDefaultProjectId(null);
|
|
29
39
|
if (defaultRCProjectName !== null &&
|
|
30
40
|
defaultRCProjectId !== null &&
|
|
31
41
|
!option_1.getOptionValue('force', false)) {
|
|
32
|
-
logger_1.message(constants_1.FILENAME.rc +
|
|
33
|
-
' already has ' +
|
|
34
|
-
ansi_colors_1.bold(defaultRCProjectName) +
|
|
35
|
-
' as a default project. To overwrite use ' +
|
|
36
|
-
ansi_colors_1.bold('--force') +
|
|
37
|
-
' option');
|
|
42
|
+
logger_1.message(constants_1.FILENAME.rc + ' already has ' + ansi_colors_1.bold(defaultRCProjectName) + ' as a default project.');
|
|
38
43
|
try {
|
|
39
44
|
yield projectAPI.getProject(defaultRCProjectId);
|
|
40
|
-
|
|
41
|
-
return;
|
|
45
|
+
throw new error_1.default('Skipping project setup, since project directory contains a default project. To overwrite use --force option');
|
|
42
46
|
}
|
|
43
47
|
catch (err) {
|
|
44
|
-
if (js_1.JS.get(err, 'context.response.statusCode')
|
|
45
|
-
|
|
48
|
+
if (js_1.JS.get(err, 'context.response.statusCode') !== 404) {
|
|
49
|
+
throw err;
|
|
46
50
|
}
|
|
47
|
-
|
|
51
|
+
logger_1.warning('cleaning up ' +
|
|
52
|
+
constants_1.FILENAME.rc +
|
|
53
|
+
' since the current default project for this folder is not found in remote');
|
|
54
|
+
yield project_1.removeProject(defaultRCProjectId + '');
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
|
-
logger_1.message('Setting up a default project for this folder\n');
|
|
57
|
+
logger_1.message('Setting up a new default project for this folder\n');
|
|
51
58
|
const allProjects = (yield projectAPI.getAllProjects());
|
|
52
59
|
if (allProjects.length === 0) {
|
|
53
60
|
throw new error_1.default('Visit ' +
|
|
54
|
-
ansi_colors_1.underline(constants_1.ORIGIN.
|
|
61
|
+
ansi_colors_1.underline(constants_1.ORIGIN.console) +
|
|
55
62
|
' for creation of your first project before you continue.', { exit: 1 });
|
|
56
63
|
}
|
|
57
64
|
const projectChoices = [
|
|
58
65
|
prompt_1.default.choice('[create a new project]', {
|
|
59
|
-
value:
|
|
66
|
+
value: 0,
|
|
60
67
|
short: 'New-Project'
|
|
68
|
+
}),
|
|
69
|
+
prompt_1.default.choice('[import a existing project]', {
|
|
70
|
+
value: 1,
|
|
71
|
+
short: 'Import-project'
|
|
61
72
|
})
|
|
62
73
|
];
|
|
63
74
|
allProjects.forEach((project) => {
|
|
@@ -66,32 +77,59 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
66
77
|
short: project.project_name
|
|
67
78
|
}));
|
|
68
79
|
});
|
|
69
|
-
const projectAns = yield prompt_1.default.ask(prompt_1.default.question('project', '
|
|
70
|
-
'Select a default Catalyst project for this directory: ', {
|
|
80
|
+
const projectAns = yield prompt_1.default.ask(prompt_1.default.question('project', 'Select a default Catalyst project for this directory: ', {
|
|
71
81
|
type: 'list',
|
|
72
82
|
choices: js_1.JS.reverse(projectChoices)
|
|
73
83
|
}));
|
|
74
84
|
let selectedProject = projectAns.project;
|
|
75
|
-
if (selectedProject
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return 'Invalid project name';
|
|
82
|
-
}
|
|
85
|
+
if (typeof selectedProject !== 'number') {
|
|
86
|
+
return project_2.fillProjectPayload(selectedProject);
|
|
87
|
+
}
|
|
88
|
+
if (selectedProject === 0) {
|
|
89
|
+
const projectNameAns = yield prompt_1.default.ask(prompt_1.default.question('projectName', 'Provide a name for your new project:', {
|
|
90
|
+
validate: (ans) => (ans.match(constants_1.REGEX.project.name) ? true : 'Invalid project name')
|
|
83
91
|
}));
|
|
84
92
|
selectedProject = yield projectAPI.createProject(projectNameAns.projectName);
|
|
85
|
-
|
|
93
|
+
return project_2.fillProjectPayload(selectedProject, true);
|
|
86
94
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
const [zipArchive, template, importRes] = yield import_1.iacImport();
|
|
96
|
+
yield zipArchive
|
|
97
|
+
.extract(runtime_store_1.default.get('cwd'), '/', { recursive: true, ignoreInitial: false })
|
|
98
|
+
.finalize();
|
|
99
|
+
const parsedJSON = js_1.JS.parseJSON(template);
|
|
100
|
+
const templateJson = parsedJSON ? parsedJSON : yaml_1.default.parse(template);
|
|
101
|
+
const functions = ((_a = templateJson.components) === null || _a === void 0 ? void 0 : _a.Functions) || [];
|
|
102
|
+
const client = ((_b = templateJson.components) === null || _b === void 0 ? void 0 : _b.WebClient) || [];
|
|
103
|
+
yield Promise.all(functions.map(({ properties }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
+
const source = properties.code.path.replace('/', path_1.sep).replace('.zip', '');
|
|
105
|
+
const stack = properties.stack.toLowerCase();
|
|
106
|
+
const refinedTargets = yield fn_utils_1.fnUtils.common.refineTargets([source], false);
|
|
107
|
+
const fnUtil = stack.startsWith(runtime_1.default.language.nodejs)
|
|
108
|
+
? fn_utils_1.fnUtils.node
|
|
109
|
+
: stack.startsWith(runtime_1.default.language.java)
|
|
110
|
+
? fn_utils_1.fnUtils.java
|
|
111
|
+
: null;
|
|
112
|
+
if (fnUtil === null) {
|
|
113
|
+
logger_1.warning(`skipping setup of function(${refinedTargets[0].name}) since provided stack ${stack} is not supported.`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
yield fnUtil.validate(refinedTargets, 0);
|
|
117
|
+
if (!refinedTargets[0].valid) {
|
|
118
|
+
logger_1.debug('Invalid target : ' +
|
|
119
|
+
refinedTargets[0].name +
|
|
120
|
+
' reason : ' +
|
|
121
|
+
refinedTargets[0].failure_reason);
|
|
122
|
+
logger_1.warning(`skipping setup of function(${refinedTargets[0].name}) since the package is invalid. \nContact catalyst support with debug log.`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
functions_1.fillFunctionsInitPayload(source, properties.name, properties.stack, properties.type);
|
|
126
|
+
})));
|
|
127
|
+
if (client.length > 0) {
|
|
128
|
+
const { properties } = client[0];
|
|
129
|
+
const source = properties.code.path.replace('/', path_1.sep).replace('.zip', '');
|
|
130
|
+
yield client_utils_1.clientUtils.validate(source);
|
|
131
|
+
client_1.fillClientInitPayload(source, properties.app_name);
|
|
94
132
|
}
|
|
95
|
-
|
|
96
|
-
|
|
133
|
+
const projectDetails = yield projectAPI.getProject(importRes.project_details.id);
|
|
134
|
+
return project_2.fillProjectPayload(projectDetails, true, true);
|
|
97
135
|
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.addDevDep = exports.clientNamePrompt = exports.directoryOverridePrompt = exports.fillClientInitPayload = void 0;
|
|
35
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
36
|
+
const runtime_store_js_1 = __importDefault(require("../../runtime-store.js"));
|
|
37
|
+
const error_js_1 = __importDefault(require("../../error.js"));
|
|
38
|
+
const index_js_1 = __importDefault(require("../../prompt/index.js"));
|
|
39
|
+
const regex_js_1 = __importDefault(require("../../util_modules/constants/lib/regex.js"));
|
|
40
|
+
const ASYNC = __importStar(require("../../util_modules/fs/lib/async.js"));
|
|
41
|
+
const logger_js_1 = require("../../util_modules/logger.js");
|
|
42
|
+
const js_js_1 = require("../../util_modules/js.js");
|
|
43
|
+
const fillClientInitPayload = (source, name) => {
|
|
44
|
+
runtime_store_js_1.default.set('payload.client.source', source);
|
|
45
|
+
runtime_store_js_1.default.set('payload.client.name', name);
|
|
46
|
+
};
|
|
47
|
+
exports.fillClientInitPayload = fillClientInitPayload;
|
|
48
|
+
function directoryOverridePrompt(dir) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const foldeExists = yield ASYNC.dirExists(dir);
|
|
51
|
+
if (foldeExists) {
|
|
52
|
+
const overwriteAns = yield index_js_1.default.ask(index_js_1.default.question('overwrite', 'Directory ' + ansi_colors_1.underline(dir) + ' already exists. Overwrite ?', {
|
|
53
|
+
type: 'confirm',
|
|
54
|
+
defaultAns: false
|
|
55
|
+
}));
|
|
56
|
+
if (!overwriteAns.overwrite) {
|
|
57
|
+
throw new error_js_1.default('Skipping client setup since unable to override the already existing client', { exit: 0, errorId: 'CLIENT-UTILS-6', arg: [ansi_colors_1.italic.red(dir)] });
|
|
58
|
+
}
|
|
59
|
+
yield ASYNC.deleteDir(dir);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
exports.directoryOverridePrompt = directoryOverridePrompt;
|
|
64
|
+
function clientNamePrompt(question, defaultAns) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const namePrompt = yield index_js_1.default.ask(index_js_1.default.question('name', question, {
|
|
67
|
+
type: 'input',
|
|
68
|
+
defaultAns,
|
|
69
|
+
validate: (ans) => {
|
|
70
|
+
if (ans.match(regex_js_1.default.client.package_name)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return 'Invalid client name';
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
return namePrompt.name;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
exports.clientNamePrompt = clientNamePrompt;
|
|
80
|
+
function addDevDep(filePath, dep, depPath = []) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
try {
|
|
83
|
+
const packageJson = yield ASYNC.readJSONFile(filePath);
|
|
84
|
+
if (packageJson) {
|
|
85
|
+
depPath.push('devDependencies');
|
|
86
|
+
js_js_1.JS.set(packageJson, depPath, dep);
|
|
87
|
+
yield ASYNC.writeJSONFile(filePath, packageJson);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
const err = error_js_1.default.getErrorInstance(e, { skipHelp: true });
|
|
92
|
+
logger_js_1.debug(`unable to write to ${filePath}: ${err.message}`);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
exports.addDevDep = addDevDep;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fillFunctionsInitPayload = void 0;
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
9
|
+
const fillFunctionsInitPayload = (source, name, stack, type) => {
|
|
10
|
+
const existingFns = runtime_store_1.default.get('payload.functions.targets', []);
|
|
11
|
+
existingFns.push({
|
|
12
|
+
source,
|
|
13
|
+
name,
|
|
14
|
+
stack,
|
|
15
|
+
type
|
|
16
|
+
});
|
|
17
|
+
runtime_store_1.default.set('payload.functions.targets', existingFns);
|
|
18
|
+
runtime_store_1.default.set('payload.functions.source', path_1.dirname(source));
|
|
19
|
+
};
|
|
20
|
+
exports.fillFunctionsInitPayload = fillFunctionsInitPayload;
|
|
@@ -0,0 +1,35 @@
|
|
|
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.fillProjectPayload = void 0;
|
|
16
|
+
const endpoints_1 = require("../../endpoints");
|
|
17
|
+
const error_1 = __importDefault(require("../../error"));
|
|
18
|
+
const runtime_store_1 = __importDefault(require("../../runtime-store"));
|
|
19
|
+
const constants_1 = require("../../util_modules/constants");
|
|
20
|
+
const project_1 = require("../../util_modules/project");
|
|
21
|
+
const fillProjectPayload = (selectedProject, isNew = false, isImport = false) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
runtime_store_1.default.set('payload.project', selectedProject);
|
|
23
|
+
runtime_store_1.default.set('project', project_1.transformProject(selectedProject));
|
|
24
|
+
const envAPI = yield endpoints_1.envAPI();
|
|
25
|
+
const envArr = (yield envAPI.getEnvs(project_1.getProjectId()));
|
|
26
|
+
const envObj = envArr.find((env) => env.env_name === constants_1.DEFAULT.env_name);
|
|
27
|
+
if (envObj === undefined) {
|
|
28
|
+
throw new error_1.default('There is no development environment found for this project. Kindly contact support.', { exit: 2 });
|
|
29
|
+
}
|
|
30
|
+
runtime_store_1.default.set('payload.env', envArr);
|
|
31
|
+
runtime_store_1.default.set('project.env', project_1.transformEnv(envObj));
|
|
32
|
+
runtime_store_1.default.set('payload.project.new', isNew);
|
|
33
|
+
runtime_store_1.default.set('payload.project.import', isImport);
|
|
34
|
+
});
|
|
35
|
+
exports.fillProjectPayload = fillProjectPayload;
|
package/lib/internal/api.js
CHANGED
|
@@ -116,7 +116,8 @@ class API {
|
|
|
116
116
|
body = JSON.parse(rawResponseData.toString());
|
|
117
117
|
}
|
|
118
118
|
catch (e) {
|
|
119
|
-
|
|
119
|
+
const err = error_1.default.getErrorInstance(e);
|
|
120
|
+
logger_1.debug('API Parsing Error: ' + err.message);
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
if (resp.statusCode >= 400 && !this.logOpts.skipRespBody) {
|
|
@@ -165,14 +166,10 @@ class API {
|
|
|
165
166
|
try {
|
|
166
167
|
resolve(yield this._retry(err));
|
|
167
168
|
}
|
|
168
|
-
catch (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
reject(new error_1.default('API Error: ' + err.message, {
|
|
173
|
-
original: error,
|
|
174
|
-
exit: 2
|
|
175
|
-
}));
|
|
169
|
+
catch (e) {
|
|
170
|
+
const error = error_1.default.getErrorInstance(e);
|
|
171
|
+
error.exit = 2;
|
|
172
|
+
reject(error);
|
|
176
173
|
}
|
|
177
174
|
break;
|
|
178
175
|
}
|
package/lib/internal/command.js
CHANGED
|
@@ -127,15 +127,15 @@ class Command {
|
|
|
127
127
|
try {
|
|
128
128
|
yield runner.apply(this, programArgs);
|
|
129
129
|
const duration = Date.now() - start;
|
|
130
|
+
errorOut_1.default();
|
|
130
131
|
yield track_1.default(this.cmdName, 'success', duration);
|
|
131
|
-
process.exitCode = 0;
|
|
132
132
|
}
|
|
133
133
|
catch (err) {
|
|
134
134
|
const duration = Date.now() - start;
|
|
135
135
|
const errorEvent = err.exit === 1 ? 'Error (User)' : 'Error (Unexpected)';
|
|
136
136
|
const preppedMessage = strip_ansi_1.default(err.message || '');
|
|
137
|
+
errorOut_1.default(err);
|
|
137
138
|
yield track_1.default(errorEvent, preppedMessage, duration);
|
|
138
|
-
return errorOut_1.default(err);
|
|
139
139
|
}
|
|
140
140
|
}));
|
|
141
141
|
return cmd;
|
|
@@ -167,7 +167,10 @@ class Command {
|
|
|
167
167
|
args.push({});
|
|
168
168
|
}
|
|
169
169
|
const [opts, command] = args.slice(-2);
|
|
170
|
-
|
|
170
|
+
const unknownOpts = this.allowUnknownOptions
|
|
171
|
+
? command.parseOptions(process.argv).unknown
|
|
172
|
+
: undefined;
|
|
173
|
+
runtime_store_1.default.set('opts', Object.assign({ _name: command.name(), unknownOpts }, opts));
|
|
171
174
|
this._prepare(command);
|
|
172
175
|
try {
|
|
173
176
|
yield migration_1.default(runtime_store_1.default.get('context.cli.package.version'));
|
package/lib/internal/config.js
CHANGED
|
@@ -68,11 +68,14 @@ class Config {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
catch (e) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const err = error_1.default.getErrorInstance(e, {
|
|
72
|
+
message: 'There was an error loading a file',
|
|
73
|
+
skipHelp: false,
|
|
74
|
+
fileName: __filename
|
|
75
75
|
});
|
|
76
|
+
err.errorId = 'CONFIG-1';
|
|
77
|
+
err.arg = [ansi_colors_1.bold(constants_1.FILENAME.config), err.message];
|
|
78
|
+
throw err;
|
|
76
79
|
}
|
|
77
80
|
if (canIgnore) {
|
|
78
81
|
return new Config(path_1.join(pd, constants_1.FILENAME.config));
|
package/lib/migration/index.js
CHANGED
|
@@ -63,10 +63,12 @@ const runMigration = (rc, migFiles, idx = 0) => __awaiter(void 0, void 0, void 0
|
|
|
63
63
|
completed: false
|
|
64
64
|
});
|
|
65
65
|
rc.syncSave();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const err = error_1.default.getErrorInstance(e, {
|
|
67
|
+
message: 'Unable to run migration file ' + migFile,
|
|
68
|
+
skipHelp: false
|
|
69
69
|
});
|
|
70
|
+
err.exit = 2;
|
|
71
|
+
throw err;
|
|
70
72
|
}
|
|
71
73
|
rc.set(['migration', currentMigFileVersion], {
|
|
72
74
|
completed: true
|
|
@@ -102,10 +104,12 @@ const runGlobalMigration = (migFiles) => __awaiter(void 0, void 0, void 0, funct
|
|
|
102
104
|
error: util_1.inspect(e),
|
|
103
105
|
completed: false
|
|
104
106
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
const err = error_1.default.getErrorInstance(e, {
|
|
108
|
+
message: 'Unable to run migration file ' + migFile,
|
|
109
|
+
skipHelp: false
|
|
108
110
|
});
|
|
111
|
+
err.exit = 2;
|
|
112
|
+
throw err;
|
|
109
113
|
}
|
|
110
114
|
config_store_1.default.set('migration.' + currentMigFileVersion.replace(new RegExp('\\.', 'g'), '\\.'), {
|
|
111
115
|
completed: true
|
package/lib/option-filter.js
CHANGED
|
@@ -175,7 +175,7 @@ function filterPorts() {
|
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
exports.filterPorts = filterPorts;
|
|
178
|
-
function filterTargets() {
|
|
178
|
+
function filterTargets(pathSense = true) {
|
|
179
179
|
const validTargetResultants = validateTargets();
|
|
180
180
|
const config = runtime_store_1.default.get('config');
|
|
181
181
|
let targets = validGlobalTargets.filter((t) => config.has(t));
|
|
@@ -185,6 +185,9 @@ function filterTargets() {
|
|
|
185
185
|
if (target === 'apig' && option_1.getCurrentCommand() === 'serve') {
|
|
186
186
|
return true;
|
|
187
187
|
}
|
|
188
|
+
if (!pathSense) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
188
191
|
const targetRoot = project_1.resolveProjectPath(CONFIG[(target + 'Config')].source());
|
|
189
192
|
return (fs_1.SYNC.isPathInside(targetRoot, runtime_store_1.default.get('cwd')) ||
|
|
190
193
|
runtime_store_1.default.get('cwd') === targetRoot);
|
package/lib/optional-import.js
CHANGED
|
@@ -31,34 +31,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
-
const path_1 = __importDefault(require("path"));
|
|
35
34
|
const app_module_path_1 = __importDefault(require("app-module-path"));
|
|
36
|
-
const logger_1 = require("./util_modules/logger");
|
|
37
35
|
const project_1 = require("./util_modules/project");
|
|
38
|
-
const
|
|
36
|
+
const global_space_1 = __importDefault(require("./util_modules/global-space"));
|
|
37
|
+
const path_1 = require("path");
|
|
39
38
|
exports.default = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
for (const manager of ['npm', 'yarn']) {
|
|
48
|
-
try {
|
|
49
|
-
const packageName = path_1.default.join(global_dirs_1.default[manager].packages, name);
|
|
50
|
-
app_module_path_1.default.addPath(packageName);
|
|
51
|
-
return Promise.resolve().then(() => __importStar(require(packageName)));
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
logger_1.debug(e);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
39
|
+
if (name !== path_1.basename(name)) {
|
|
40
|
+
const projectModulePath = project_1.resolveProjectPath(name);
|
|
41
|
+
app_module_path_1.default.addPath(projectModulePath);
|
|
42
|
+
return Promise.resolve().then(() => __importStar(require(projectModulePath)));
|
|
59
43
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
const packageName = yield global_space_1.default(name);
|
|
45
|
+
if (typeof packageName === 'string') {
|
|
46
|
+
app_module_path_1.default.addPath(packageName);
|
|
47
|
+
return Promise.resolve().then(() => __importStar(require(packageName)));
|
|
63
48
|
}
|
|
49
|
+
return;
|
|
64
50
|
});
|
package/lib/plugin-loader.js
CHANGED
|
@@ -31,6 +31,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
31
31
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
32
32
|
};
|
|
33
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
35
|
+
const error_1 = __importDefault(require("./error"));
|
|
34
36
|
const optional_import_1 = __importDefault(require("./optional-import"));
|
|
35
37
|
const runtime_store_1 = __importDefault(require("./runtime-store"));
|
|
36
38
|
const config = __importStar(require("./util_modules/config"));
|
|
@@ -57,10 +59,14 @@ function pluginLoader(feature, name, source) {
|
|
|
57
59
|
pluginMod = loadedPlugins[specificPlugin];
|
|
58
60
|
}
|
|
59
61
|
else {
|
|
60
|
-
pluginMod =
|
|
62
|
+
pluginMod = yield optional_import_1.default(specificPlugin);
|
|
61
63
|
}
|
|
62
64
|
if (pluginMod === undefined) {
|
|
63
|
-
|
|
65
|
+
throw new error_1.default(`Configured plugin could not be found for [${feature}:${name}] - ${specificPlugin}`, {
|
|
66
|
+
exit: 1,
|
|
67
|
+
errorId: 'PLG-LDR-1',
|
|
68
|
+
arg: [ansi_colors_1.italic.red(specificPlugin), ansi_colors_1.bold(name), ansi_colors_1.bold(feature)]
|
|
69
|
+
});
|
|
64
70
|
}
|
|
65
71
|
loadedPlugins[specificPlugin] = pluginMod;
|
|
66
72
|
if (typeof pluginMod === 'function') {
|
package/lib/port-resolver.js
CHANGED
|
@@ -68,25 +68,29 @@ class PortResolver {
|
|
|
68
68
|
}
|
|
69
69
|
catch (e) {
|
|
70
70
|
if (searchSpan === 0) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
arg: [
|
|
76
|
-
ansi_colors_1.bold.red(port + ''),
|
|
77
|
-
type === 'debug' ? 'debugging' : 'serving',
|
|
78
|
-
ansi_colors_1.bold(feature),
|
|
79
|
-
name,
|
|
80
|
-
type
|
|
81
|
-
]
|
|
71
|
+
const err = error_1.default.getErrorInstance(e, {
|
|
72
|
+
message: `Provided port '${port}' is not available`,
|
|
73
|
+
skipHelp: false,
|
|
74
|
+
fileName: __filename
|
|
82
75
|
});
|
|
76
|
+
err.errorId = 'PORT-RESOLVER-1';
|
|
77
|
+
err.arg = [
|
|
78
|
+
ansi_colors_1.bold.red(port + ''),
|
|
79
|
+
type === 'debug' ? 'debugging' : 'serving',
|
|
80
|
+
ansi_colors_1.bold(feature),
|
|
81
|
+
name,
|
|
82
|
+
type
|
|
83
|
+
];
|
|
84
|
+
throw err;
|
|
83
85
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
arg: [ansi_colors_1.bold(port + ''), ansi_colors_1.bold(port + searchSpan + ''), ansi_colors_1.bold('--' + type)]
|
|
86
|
+
const cerr = error_1.default.getErrorInstance(e, {
|
|
87
|
+
message: `No ports from '${port}' to ${port + searchSpan} is free to use as a ${type} port.`,
|
|
88
|
+
skipHelp: false,
|
|
89
|
+
fileName: __filename
|
|
89
90
|
});
|
|
91
|
+
cerr.errorId = 'PORT-RESOLVER-2';
|
|
92
|
+
cerr.arg = [ansi_colors_1.bold(port + ''), ansi_colors_1.bold(port + searchSpan + ''), ansi_colors_1.bold('--' + type)];
|
|
93
|
+
throw cerr;
|
|
90
94
|
}
|
|
91
95
|
if (finalPort !== port) {
|
|
92
96
|
logger_1.debug(`${type} port : '${port}' is not available. Hence port '${finalPort}' will be used instead.`);
|