zcatalyst-cli 1.18.0-beta.9 → 1.19.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/README.md +11 -6
- package/docs/commands/signals/generate/index.toml +19 -0
- package/docs/commands/slate/unlink.toml +9 -0
- package/docs/endpoints/lib/env.toml +3 -1
- package/docs/endpoints/lib/slate.toml +3 -0
- package/docs/serve/server/lib/slate/index.toml +14 -0
- package/docs/slate-utils.toml +4 -0
- package/docs/util_modules/config/lib/slate.toml +4 -0
- package/lib/archiver.js +18 -9
- package/lib/authentication/login.js +6 -5
- package/lib/code-deck.js +5 -6
- package/lib/command_needs/auth.js +1 -1
- package/lib/command_needs/rc.js +40 -3
- package/lib/commands/codelib/install.js +1 -0
- package/lib/commands/deploy/index.js +4 -0
- package/lib/commands/deploy/slate.js +58 -0
- package/lib/commands/event/generate/index.js +8 -2
- package/lib/commands/index.js +3 -3
- package/lib/commands/init.js +0 -10
- package/lib/commands/signals/generate/index.js +214 -0
- package/lib/commands/slate/create.js +59 -0
- package/lib/commands/slate/link.js +59 -0
- package/lib/commands/slate/unlink.js +75 -0
- package/lib/commands/zest/generate/index.js +1 -6
- package/lib/config-store.js +2 -1
- package/lib/deploy/features/index.js +3 -0
- package/lib/deploy/features/slate.js +123 -0
- package/lib/endpoints/index.js +8 -1
- package/lib/endpoints/lib/env.js +2 -1
- package/lib/endpoints/lib/sdk.js +2 -2
- package/lib/endpoints/lib/slate.js +107 -0
- package/lib/event_generate/cache.js +35 -33
- package/lib/event_generate/custom.js +15 -19
- package/lib/event_generate/datastore.js +60 -56
- package/lib/event_generate/filestore.js +51 -47
- package/lib/event_generate/github.js +19 -18
- package/lib/event_generate/stratus.js +52 -38
- package/lib/event_generate/user.js +33 -29
- package/lib/event_generate/webapp.js +33 -32
- package/lib/fn-utils/lib/common.js +1 -1
- package/lib/iac/status/deploy.js +1 -5
- package/lib/index.js +1 -1
- package/lib/init/features/appsail/index.js +3 -4
- package/lib/init/features/index.js +13 -1
- package/lib/init/features/project.js +1 -1
- package/lib/init/features/slate/index.js +313 -0
- package/lib/internal/api.js +1 -1
- package/lib/internal/command.js +10 -6
- package/lib/port-resolver.js +7 -0
- package/lib/prompt/index.js +22 -6
- package/lib/prompt/types/file-path.js +10 -7
- package/lib/serve/features/index.js +8 -1
- package/lib/serve/features/slate.js +47 -0
- package/lib/serve/server/index.js +61 -1
- package/lib/serve/server/lib/appsail/index.js +1 -1
- package/lib/serve/server/lib/master/appsail.js +7 -2
- package/lib/serve/server/lib/master/index.js +25 -21
- package/lib/serve/server/lib/master/slate.js +45 -0
- package/lib/serve/server/lib/master/utils.js +9 -3
- package/lib/serve/server/lib/slate/index.js +115 -0
- package/lib/serve/server/lib/slate/static-server.js +194 -0
- package/lib/serve/server/lib/web_client/server.js +2 -1
- package/lib/shell/dependencies/local-function.js +1 -1
- package/lib/slate-utils.js +212 -0
- package/lib/util_modules/config/index.js +3 -1
- package/lib/util_modules/config/lib/slate.js +98 -0
- package/lib/util_modules/constants/index.js +7 -1
- package/lib/util_modules/constants/lib/cliq-handlers.js +18 -10
- package/lib/util_modules/constants/lib/dc-type.js +8 -0
- package/lib/util_modules/constants/lib/default.js +4 -0
- package/lib/util_modules/constants/lib/file-names.js +7 -1
- package/lib/util_modules/constants/lib/folder-names.js +1 -0
- package/lib/util_modules/constants/lib/placeholders.js +18 -1
- package/lib/util_modules/constants/lib/scopes.js +1 -6
- package/lib/util_modules/constants/lib/signals-api-names.js +19 -0
- package/lib/util_modules/constants/lib/signals-publishers-type.js +27 -0
- package/lib/util_modules/constants/lib/signals-publishers.js +10 -0
- package/lib/util_modules/constants/lib/template.js +1 -0
- package/lib/util_modules/context-help.js +2 -2
- package/lib/util_modules/fs/lib/async.js +14 -3
- package/lib/util_modules/fs/lib/sync.js +6 -1
- package/lib/util_modules/parser/toml.js +20 -5
- package/package.json +3 -3
- package/templates/event/integ/cliq/bot/action_handler.json +13 -4
- package/templates/event/integ/cliq/bot/call_handler.json +41 -0
- package/templates/event/integ/cliq/bot/context_handler.json +11 -3
- package/templates/event/integ/cliq/bot/incomingwebhook_handler.json +11 -3
- package/templates/event/integ/cliq/bot/mention_handler.json +12 -4
- package/templates/event/integ/cliq/bot/message_handler.json +13 -4
- package/templates/event/integ/cliq/bot/participation_handler.json +13 -3
- package/templates/event/integ/cliq/bot/welcome_handler.json +12 -8
- package/templates/event/integ/cliq/command/execution_handler.json +12 -3
- package/templates/event/integ/cliq/command/suggestion_handler.json +18 -4
- package/templates/event/integ/cliq/{installation → extension}/installation_handler.json +13 -4
- package/templates/event/integ/cliq/{installation → extension}/installation_validator.json +13 -5
- package/templates/event/integ/cliq/extension/uninstallation_handler.json +37 -0
- package/templates/event/integ/cliq/function/button_handler.json +13 -5
- package/templates/event/integ/cliq/function/form_change_handler.json +9 -3
- package/templates/event/integ/cliq/function/form_handler.json +11 -3
- package/templates/event/integ/cliq/function/form_values_handler.json +9 -3
- package/templates/event/integ/cliq/function/form_view_handler.json +26 -0
- package/templates/event/integ/cliq/function/widget_button_handler.json +14 -5
- package/templates/event/integ/cliq/link_preview/action_handler.json +54 -0
- package/templates/event/integ/cliq/link_preview/after_send_handler.json +47 -0
- package/templates/event/integ/cliq/link_preview/menu_handler.json +47 -0
- package/templates/event/integ/cliq/link_preview/preview_handler.json +47 -0
- package/templates/event/integ/cliq/messageaction/execution_handler.json +11 -3
- package/templates/event/integ/cliq/widget/view_handler.json +12 -4
- package/templates/event/signals.json +26 -0
- package/templates/init/client/react/react_js/template/src/index.js +3 -3
- package/templates/init/client/react/react_ts/template/src/index.tsx +3 -3
- package/templates/init/client/react/react_ts/template.json +3 -3
- package/templates/init/functions/java/event/sample.java +4 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +29 -23
- package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +14 -17
- package/templates/init/functions/java/integ/cliq/com/handlers/ExtensionHandler.java +41 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +74 -22
- package/templates/init/functions/java/integ/cliq/com/handlers/LinkPreviewHandler.java +108 -0
- package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +6 -8
- package/templates/init/functions/java/integ/cliq/sample.java +10 -0
- package/templates/init/functions/node/aio/package.json +1 -1
- package/templates/init/functions/node/bio/package.json +1 -1
- package/templates/init/functions/node/cron/package.json +1 -1
- package/templates/init/functions/node/event/package.json +1 -1
- package/templates/init/functions/node/event/sample.js +1 -0
- package/templates/init/functions/node/event/types/event.d.ts +7 -0
- package/templates/init/functions/node/integ/cliq/handlers/bot-handler.js +4 -0
- package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +3 -5
- package/templates/init/functions/node/integ/cliq/handlers/{installation-validator.js → extension-handler.js} +20 -3
- package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +42 -0
- package/templates/init/functions/node/integ/cliq/handlers/link-preview-handler.js +73 -0
- package/templates/init/functions/node/integ/cliq/package.json +1 -1
- package/templates/init/functions/node/integ/convokraft/package.json +1 -1
- package/templates/init/functions/node/job/package.json +1 -1
- package/templates/init/functions/python/event/sample.py +9 -5
- package/templates/init/functions/python/integ/cliq/handlers/bot_handler.py +13 -3
- package/templates/init/functions/python/integ/cliq/handlers/command_handler.py +7 -7
- package/templates/init/functions/python/integ/cliq/handlers/extension_handler.py +25 -0
- package/templates/init/functions/python/integ/cliq/handlers/function_handler.py +54 -10
- package/templates/init/functions/python/integ/cliq/handlers/link_preview_handler.py +76 -0
- package/templates/init/functions/python/integ/cliq/handlers/widget_handler.py +10 -9
- package/templates/init/functions/python/integ/cliq/sample.py +2 -2
- package/templates/init.txt +2 -1
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +0 -20
- package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +0 -22
- package/templates/init/functions/node/integ/cliq/handlers/installation-handler.js +0 -15
- package/templates/init/functions/python/integ/cliq/handlers/installation_handler.py +0 -12
- package/templates/init/functions/python/integ/cliq/handlers/installation_validator.py +0 -16
|
@@ -12,36 +12,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getData = exports.sourceId = void 0;
|
|
15
16
|
const moment_1 = __importDefault(require("moment"));
|
|
16
17
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
17
|
-
const constants_1 = require("../util_modules/constants");
|
|
18
18
|
const js_1 = require("../util_modules/js");
|
|
19
|
-
exports.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
exports.sourceId = 'NULL';
|
|
20
|
+
function getData() {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mockTime = (0, moment_1.default)().format('MMM DD, YYYY hh:mm A');
|
|
23
|
+
return {
|
|
24
|
+
platform_type: 'web',
|
|
25
|
+
user_details: {
|
|
26
|
+
email_id: runtime_store_1.default.get('user.Email'),
|
|
27
|
+
created_time: mockTime,
|
|
28
|
+
is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
|
|
29
|
+
last_name: '',
|
|
30
|
+
source: '',
|
|
31
|
+
zuid: js_1.JS.randomNumber(10),
|
|
32
|
+
role_details: {
|
|
33
|
+
role_name: 'App User',
|
|
34
|
+
role_id: js_1.JS.randomNumber(10)
|
|
35
|
+
},
|
|
36
|
+
zaaid: js_1.JS.randomNumber(10),
|
|
37
|
+
invited_time: mockTime,
|
|
38
|
+
modified_time: mockTime,
|
|
39
|
+
user_type: 'App User',
|
|
40
|
+
user_id: js_1.JS.randomNumber(10),
|
|
41
|
+
org_id: js_1.JS.randomNumber(10),
|
|
42
|
+
first_name: js_1.JS.randomString(10),
|
|
43
|
+
status: 'ACTIVE'
|
|
28
44
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
first_name: js_1.JS.randomString(10),
|
|
37
|
-
zuid: js_1.JS.randomNumber(10),
|
|
38
|
-
status: 'ACTIVE'
|
|
39
|
-
},
|
|
40
|
-
org_id: js_1.JS.randomNumber(10),
|
|
41
|
-
zaid: js_1.JS.randomNumber(10),
|
|
42
|
-
redirect_url: null
|
|
43
|
-
};
|
|
44
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
|
|
45
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
|
|
46
|
-
return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
|
|
47
|
-
});
|
|
45
|
+
org_id: js_1.JS.randomNumber(10),
|
|
46
|
+
zaid: js_1.JS.randomNumber(10),
|
|
47
|
+
redirect_url: ''
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.getData = getData;
|
|
@@ -12,41 +12,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getData = exports.sourceId = void 0;
|
|
15
16
|
const moment_1 = __importDefault(require("moment"));
|
|
16
17
|
const endpoints_1 = require("../endpoints");
|
|
17
18
|
const runtime_store_1 = __importDefault(require("../runtime-store"));
|
|
18
|
-
const constants_1 = require("../util_modules/constants");
|
|
19
19
|
const js_1 = require("../util_modules/js");
|
|
20
20
|
const project_1 = require("../util_modules/project");
|
|
21
|
-
exports.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
exports.sourceId = 'NULL';
|
|
22
|
+
function getData() {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const webappDetails = (yield (yield (0, endpoints_1.clientAPI)()).getWebappDetails());
|
|
25
|
+
const selectedWebapp = webappDetails !== undefined && Object.keys(webappDetails).length > 0
|
|
26
|
+
? webappDetails
|
|
27
|
+
: {
|
|
28
|
+
app_name: js_1.JS.randomString(js_1.JS.random(5, 10)),
|
|
29
|
+
app_id: js_1.JS.randomNumber(15),
|
|
30
|
+
url_prefix: (0, project_1.getDomainPrefix)()
|
|
31
|
+
};
|
|
32
|
+
const userDetails = {
|
|
33
|
+
email_id: runtime_store_1.default.get('user.Email'),
|
|
34
|
+
user_id: js_1.JS.randomNumber(15),
|
|
35
|
+
is_confirmed: js_1.JS.random(0, 1) === 1 ? true : false,
|
|
36
|
+
last_name: js_1.JS.randomString(5),
|
|
37
|
+
first_name: js_1.JS.randomString(10),
|
|
38
|
+
zuid: js_1.JS.randomNumber(10)
|
|
29
39
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
app_name: selectedWebapp.app_name,
|
|
45
|
-
uploaded_by: userDetails,
|
|
46
|
-
app_id: selectedWebapp.app_id,
|
|
47
|
-
url_prefix: selectedWebapp.url_prefix
|
|
48
|
-
};
|
|
49
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.source_id, 'g'), 'NULL');
|
|
50
|
-
eventJson = eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.rule_id, 'g'), 'NULL');
|
|
51
|
-
return eventJson.replace(new RegExp(constants_1.PLACEHOLDER.event_data.data, 'g'), JSON.stringify(data));
|
|
52
|
-
});
|
|
40
|
+
return {
|
|
41
|
+
uploaded_time: (0, moment_1.default)().format('MMM DD, YYYY hh:mm A'),
|
|
42
|
+
project_details: {
|
|
43
|
+
id: (0, project_1.getProjectId)(),
|
|
44
|
+
project_name: (0, project_1.getProjectName)()
|
|
45
|
+
},
|
|
46
|
+
app_name: selectedWebapp.app_name,
|
|
47
|
+
uploaded_by: userDetails,
|
|
48
|
+
app_id: selectedWebapp.app_id,
|
|
49
|
+
url_prefix: selectedWebapp.url_prefix
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
exports.getData = getData;
|
|
@@ -506,7 +506,7 @@ function getSDK(fnType, dest, stack, options = {}) {
|
|
|
506
506
|
}
|
|
507
507
|
yield new archiver_1.default()
|
|
508
508
|
.load(sdkZip)
|
|
509
|
-
.extract(dest, new RegExp(`catalyst-${stack}`), {
|
|
509
|
+
.extract(dest, new RegExp(`catalyst-${stack}`), { ignoreLevel: 1 })
|
|
510
510
|
.finalize();
|
|
511
511
|
});
|
|
512
512
|
}
|
package/lib/iac/status/deploy.js
CHANGED
|
@@ -19,7 +19,6 @@ const error_1 = __importDefault(require("../../error"));
|
|
|
19
19
|
const throbber_1 = __importDefault(require("../../throbber"));
|
|
20
20
|
const logger_1 = require("../../util_modules/logger");
|
|
21
21
|
const util_1 = require("./util");
|
|
22
|
-
const env_1 = require("../../util_modules/env");
|
|
23
22
|
const ansi_colors_1 = require("ansi-colors");
|
|
24
23
|
const code_deck_1 = require("../../code-deck");
|
|
25
24
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -76,10 +75,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
76
75
|
timerAPI.on('error', (e) => {
|
|
77
76
|
(0, logger_1.debug)('Error encountered : ', e);
|
|
78
77
|
});
|
|
79
|
-
timerAPI.on('end', (
|
|
80
|
-
if (data === true && !(0, env_1.isPrimaryShell)() && process.send) {
|
|
81
|
-
process.send('success');
|
|
82
|
-
}
|
|
78
|
+
timerAPI.on('end', () => {
|
|
83
79
|
throbber.stopAll();
|
|
84
80
|
});
|
|
85
81
|
process.env.PARENT_COMMAND === 'codedeck' &&
|
package/lib/index.js
CHANGED
|
@@ -23,6 +23,6 @@ program.helpOption('-h, --help', 'Display help for a Catalyst command');
|
|
|
23
23
|
program.showSuggestionAfterError();
|
|
24
24
|
program.showHelpAfterError(`For more usage information use the ${(0, ansi_colors_1.bold)('catalyst help')} command`);
|
|
25
25
|
program.addHelpText('before', fs_1.SYNC.readFile(constants_1.TEMPLATE.banner, 'utf-8') || '');
|
|
26
|
-
program.addHelpText('afterAll', `\nFor detailed documentations please visit ${(0, ansi_colors_1.underline)('https://
|
|
26
|
+
program.addHelpText('afterAll', `\nFor detailed documentations please visit ${(0, ansi_colors_1.underline)('https://docs.catalyst.zoho.com/en/cli/v1/cli-command-reference/')}`);
|
|
27
27
|
const cli = new client_1.Client(program);
|
|
28
28
|
exports.default = cli;
|
|
@@ -97,7 +97,7 @@ function getAppSailZip() {
|
|
|
97
97
|
zip.load(code);
|
|
98
98
|
zip.extract(repoDir, '/', {
|
|
99
99
|
isFolder: true,
|
|
100
|
-
|
|
100
|
+
ignoreLevel: 1
|
|
101
101
|
});
|
|
102
102
|
yield zip.finalize();
|
|
103
103
|
(0, logger_1.success)(`Successfully downloaded the code to ${ansi_colors_1.bold.green(gitRepo.repo.source)}`);
|
|
@@ -114,7 +114,7 @@ function getAppSailZip() {
|
|
|
114
114
|
}
|
|
115
115
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
116
|
const curCommand = (0, option_1.getCurrentCommand)();
|
|
117
|
-
const gitPrompt = yield prompt_1.default.ask(prompt_1.default.question('gitClone', 'Do you want to get-started with a list of
|
|
117
|
+
const gitPrompt = yield prompt_1.default.ask(prompt_1.default.question('gitClone', 'Do you want to get-started with a list of example AppSails?', {
|
|
118
118
|
type: 'confirm',
|
|
119
119
|
default: true,
|
|
120
120
|
when: curCommand === 'init'
|
|
@@ -196,8 +196,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
196
196
|
stack: appSailStack.runtime,
|
|
197
197
|
env_variables: {},
|
|
198
198
|
memory: _appSailConfig.memory || 256,
|
|
199
|
-
scripts: _appSailConfig.scripts || {}
|
|
200
|
-
raw: {}
|
|
199
|
+
scripts: _appSailConfig.scripts || {}
|
|
201
200
|
};
|
|
202
201
|
if (appSailStack.lang === 'java') {
|
|
203
202
|
const platform = yield prompt_1.default.ask(prompt_1.default.question('value', 'Please choose a platform for your AppSail: ', {
|
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.appsail = exports.project = exports.client = exports.functions = exports.setCatalystConfig = void 0;
|
|
38
|
+
exports.appsail = exports.project = exports.slate = exports.client = exports.functions = exports.setCatalystConfig = void 0;
|
|
39
39
|
const ansi_colors_1 = require("ansi-colors");
|
|
40
40
|
const path_1 = require("path");
|
|
41
41
|
const error_1 = __importDefault(require("../../error"));
|
|
@@ -118,6 +118,11 @@ function setCatalystConfig(featureName, add) {
|
|
|
118
118
|
config.unset('client.plugin');
|
|
119
119
|
}
|
|
120
120
|
break;
|
|
121
|
+
case 'slate': {
|
|
122
|
+
const targetArr = config.get('slate', []);
|
|
123
|
+
config.set('slate', js_1.JS.uniq(targetArr.concat([context])));
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
121
126
|
case 'apig':
|
|
122
127
|
config.set('apig.rules', targetSource);
|
|
123
128
|
config.set('apig.enabled', true);
|
|
@@ -140,6 +145,13 @@ function client() {
|
|
|
140
145
|
});
|
|
141
146
|
}
|
|
142
147
|
exports.client = client;
|
|
148
|
+
function slate(add = false) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
yield (yield Promise.resolve().then(() => __importStar(require('./slate/index.js')))).default(add);
|
|
151
|
+
setCatalystConfig('slate', false);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
exports.slate = slate;
|
|
143
155
|
function project() {
|
|
144
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
157
|
yield (yield Promise.resolve().then(() => __importStar(require('./project.js')))).default();
|
|
@@ -103,7 +103,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
103
103
|
}
|
|
104
104
|
const [zipArchive, template, importRes] = yield (0, import_1.iacImport)();
|
|
105
105
|
yield zipArchive
|
|
106
|
-
.extract(runtime_store_1.default.get('cwd'), '/', { recursive: true,
|
|
106
|
+
.extract(runtime_store_1.default.get('cwd'), '/', { recursive: true, ignoreLevel: 0 })
|
|
107
107
|
.finalize();
|
|
108
108
|
const parsedJSON = js_1.JS.parseJSON(template);
|
|
109
109
|
const templateJson = parsedJSON ? parsedJSON : (0, yaml_1.parse)(template);
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const prompt_1 = __importDefault(require("../../../prompt"));
|
|
39
|
+
const logger_1 = require("../../../util_modules/logger");
|
|
40
|
+
const endpoints_1 = require("../../../endpoints");
|
|
41
|
+
const archiver_1 = __importDefault(require("../../../archiver"));
|
|
42
|
+
const option_1 = require("../../../util_modules/option");
|
|
43
|
+
const path_1 = __importStar(require("path"));
|
|
44
|
+
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
45
|
+
const fs_1 = require("../../../util_modules/fs");
|
|
46
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
47
|
+
const config_1 = require("../../../util_modules/config");
|
|
48
|
+
const console_1 = require("console");
|
|
49
|
+
const error_1 = __importDefault(require("../../../error"));
|
|
50
|
+
const constants_1 = require("../../../util_modules/constants");
|
|
51
|
+
const project_1 = require("../../../util_modules/project");
|
|
52
|
+
const toml_1 = require("../../../util_modules/parser/toml");
|
|
53
|
+
const async_1 = require("../../../util_modules/fs/lib/async");
|
|
54
|
+
function getFrameworkOption(frameworks, source) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
let frameworkOpt = (0, option_1.getOptionValue)('framework');
|
|
57
|
+
if (frameworkOpt &&
|
|
58
|
+
frameworks.findIndex((framework) => framework.name === frameworkOpt) === -1) {
|
|
59
|
+
(0, logger_1.warning)('Given framework is not supported in Slate.');
|
|
60
|
+
frameworkOpt = '';
|
|
61
|
+
}
|
|
62
|
+
if (!frameworkOpt) {
|
|
63
|
+
const filteredFrameworks = frameworks.filter((framework) => framework.name !== 'other');
|
|
64
|
+
const { selectedFramework } = yield prompt_1.default.ask(prompt_1.default.question('selectedFramework', 'Select a framework to start with: ', {
|
|
65
|
+
type: 'list',
|
|
66
|
+
choices: filteredFrameworks.map(({ label, name }) => prompt_1.default.choice(label, { value: name, short: label }))
|
|
67
|
+
}));
|
|
68
|
+
frameworkOpt = selectedFramework;
|
|
69
|
+
}
|
|
70
|
+
return { name: frameworkOpt, source };
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function validateAppName(appName) {
|
|
74
|
+
if (appName.length === 0) {
|
|
75
|
+
return 'App name cannot be empty';
|
|
76
|
+
}
|
|
77
|
+
if (appName.length > 45) {
|
|
78
|
+
return 'App name cannot be more than 45 characters';
|
|
79
|
+
}
|
|
80
|
+
if (!appName.match(/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/)) {
|
|
81
|
+
return 'App name must be alphanumeric and contain only a single hyphen in the middle.';
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
function getAppName(existingSlates, frameworkOpt) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
let appName = (0, option_1.getOptionValue)('name');
|
|
88
|
+
if (!appName) {
|
|
89
|
+
const { name } = yield prompt_1.default.ask(prompt_1.default.question('name', 'Please provide the name for your app:', {
|
|
90
|
+
type: 'input',
|
|
91
|
+
default: frameworkOpt,
|
|
92
|
+
validate: (name) => {
|
|
93
|
+
if (existingSlates.findIndex((targ) => targ.name === name) !== -1)
|
|
94
|
+
return 'Slate already configured with this name.';
|
|
95
|
+
return validateAppName(name);
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
appName = name;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
if (existingSlates.findIndex((targ) => targ.name === appName) !== -1) {
|
|
102
|
+
throw new error_1.default('Slate already configured with this name.');
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
const isValidApp = validateAppName(appName);
|
|
106
|
+
if (isValidApp !== true) {
|
|
107
|
+
throw new error_1.default(isValidApp + '');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return appName;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function handleTemplate(appName, { templateName, frameworkName } = {}) {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
const projectRoot = (0, project_1.getProjectRoot)();
|
|
117
|
+
const appPath = path_1.default.join(projectRoot, appName);
|
|
118
|
+
const folderExists = yield fs_1.ASYNC.dirExists(appPath);
|
|
119
|
+
const overwriteAns = folderExists
|
|
120
|
+
? yield prompt_1.default.ask(prompt_1.default.question('overwrite', `Directory ${(0, ansi_colors_1.underline)(appPath)} already exists. Overwrite?`, {
|
|
121
|
+
type: 'confirm',
|
|
122
|
+
default: false
|
|
123
|
+
}))
|
|
124
|
+
: { overwrite: true };
|
|
125
|
+
if (!overwriteAns.overwrite) {
|
|
126
|
+
(0, logger_1.warning)('Skipping slate template setup');
|
|
127
|
+
return appPath;
|
|
128
|
+
}
|
|
129
|
+
yield fs_1.ASYNC.deleteDir(appPath).catch(console_1.error);
|
|
130
|
+
const templatePath = 'slate-main' + (templateName ? `/templates/${templateName}` : `/examples/${frameworkName}`);
|
|
131
|
+
const responseZip = (yield (yield (0, endpoints_1.slateAPI)()).downloadTemplate());
|
|
132
|
+
yield new archiver_1.default()
|
|
133
|
+
.load(responseZip)
|
|
134
|
+
.extract(appPath, templatePath, {
|
|
135
|
+
ignoreLevel: 3
|
|
136
|
+
})
|
|
137
|
+
.finalize();
|
|
138
|
+
return appPath;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function addExistingSlate(existingSlates) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
yield prompt_1.default.register('file-path');
|
|
144
|
+
const projectRoot = (0, project_1.getProjectRoot)();
|
|
145
|
+
const { sourcePath } = yield prompt_1.default.ask(prompt_1.default.question('sourcePath', 'Please provide the source path of your slate service: ', {
|
|
146
|
+
type: 'file-path',
|
|
147
|
+
validate: (pth) => __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
const buildPath = (0, path_1.resolve)(projectRoot, pth.value);
|
|
149
|
+
if (existingSlates.findIndex((targ) => targ.source === buildPath) !== -1)
|
|
150
|
+
return 'Path is already linked.';
|
|
151
|
+
if (yield fs_1.ASYNC.dirExists(buildPath)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
return 'Path does not exist';
|
|
155
|
+
}),
|
|
156
|
+
depth: 5,
|
|
157
|
+
empTxt: ' ',
|
|
158
|
+
rootPath: projectRoot,
|
|
159
|
+
ignoreFiles: true,
|
|
160
|
+
excludeDir: true,
|
|
161
|
+
exclude: ['**/node_modules', '**/.git', '**/.catalyst']
|
|
162
|
+
}));
|
|
163
|
+
prompt_1.default.deregister('file-path');
|
|
164
|
+
return sourcePath;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function detectFramework(source, frameworkList) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const frameworkOpt = (0, option_1.getOptionValue)('framework');
|
|
170
|
+
if (frameworkOpt &&
|
|
171
|
+
frameworkList.findIndex((framework) => framework.name === frameworkOpt) === -1) {
|
|
172
|
+
return { name: frameworkOpt, source };
|
|
173
|
+
}
|
|
174
|
+
const packageJsonPath = (0, path_1.join)(source, constants_1.FILENAME.package_json);
|
|
175
|
+
const packageJsonExists = yield fs_1.ASYNC.fileExists(packageJsonPath);
|
|
176
|
+
if (!packageJsonExists) {
|
|
177
|
+
(0, logger_1.warning)('Unable to find the package.json file at the given source path');
|
|
178
|
+
return getFrameworkOption(frameworkList, source);
|
|
179
|
+
}
|
|
180
|
+
const data = yield fs_1.ASYNC.readJSONFile(packageJsonPath);
|
|
181
|
+
const dependencies = Object.assign(Object.assign({}, data === null || data === void 0 ? void 0 : data.dependencies), data === null || data === void 0 ? void 0 : data.devDependencies);
|
|
182
|
+
if (!dependencies) {
|
|
183
|
+
(0, logger_1.warning)('The package.json file does not contain dependencies');
|
|
184
|
+
return getFrameworkOption(frameworkList, source);
|
|
185
|
+
}
|
|
186
|
+
const isReact = dependencies['react'] !== undefined && dependencies['react-dom'] !== undefined;
|
|
187
|
+
const isVite = dependencies['vite'] !== undefined || dependencies['@vitejs/plugin-react'] !== undefined;
|
|
188
|
+
if (isReact && isVite) {
|
|
189
|
+
return { name: 'react-vite', source };
|
|
190
|
+
}
|
|
191
|
+
const isNextJs = dependencies['react'] !== undefined && dependencies['next'] !== undefined;
|
|
192
|
+
if (isNextJs) {
|
|
193
|
+
return { name: 'nextjs', source };
|
|
194
|
+
}
|
|
195
|
+
frameworkList = frameworkList.filter((framework) => !['static', 'react-vite', 'nextjs'].includes(framework.name));
|
|
196
|
+
const framework = frameworkList.find(({ keywords }) => keywords.every((keyword) => dependencies[keyword] !== undefined));
|
|
197
|
+
if (!framework) {
|
|
198
|
+
(0, logger_1.warning)('No matching framework found in package.json dependencies');
|
|
199
|
+
return getFrameworkOption(frameworkList);
|
|
200
|
+
}
|
|
201
|
+
return { name: framework.name, source };
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function getConfigDetails(frameworkOpt, frameworks) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
const slateConfigs = frameworks.find((framework) => frameworkOpt.toLowerCase() === framework.name);
|
|
207
|
+
if (frameworkOpt === 'static') {
|
|
208
|
+
return { framework: 'static' };
|
|
209
|
+
}
|
|
210
|
+
const slateConfigDetails = {
|
|
211
|
+
framework: frameworkOpt,
|
|
212
|
+
install_command: slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings.install_command.value,
|
|
213
|
+
build_path: slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings.output_dir.value,
|
|
214
|
+
build_command: slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings.build_command.value,
|
|
215
|
+
root_path: './'
|
|
216
|
+
};
|
|
217
|
+
let editDefaultConfig;
|
|
218
|
+
if (!(0, option_1.getOptionValue)('default')) {
|
|
219
|
+
if (slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings) {
|
|
220
|
+
(0, console_1.log)(`Auto-detected App Configuration (${(0, ansi_colors_1.bold)(frameworkOpt)}):\n` +
|
|
221
|
+
`${(0, ansi_colors_1.grey)((0, ansi_colors_1.bold)('Install Command: ') +
|
|
222
|
+
(slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings.install_command.placeholder))}\n` +
|
|
223
|
+
`${(0, ansi_colors_1.grey)((0, ansi_colors_1.bold)('Build Command: ') + (slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings.build_command.placeholder))}\n` +
|
|
224
|
+
`${(0, ansi_colors_1.grey)((0, ansi_colors_1.bold)('Build Path: ') + (slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings.output_dir.placeholder))}`);
|
|
225
|
+
editDefaultConfig = yield prompt_1.default.ask(prompt_1.default.question('config', 'Do you want to modify these default configurations?', {
|
|
226
|
+
type: 'confirm',
|
|
227
|
+
default: false
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
(0, logger_1.warning)('Unable to detect the app configuration for the selected framework.');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (!(slateConfigs === null || slateConfigs === void 0 ? void 0 : slateConfigs.settings) || (editDefaultConfig === null || editDefaultConfig === void 0 ? void 0 : editDefaultConfig.config)) {
|
|
235
|
+
const config = yield prompt_1.default.ask(prompt_1.default.question('installCommand', 'Provide your Install Command:', {
|
|
236
|
+
type: 'input',
|
|
237
|
+
validate: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
value = value.trim();
|
|
239
|
+
if (value === '')
|
|
240
|
+
return 'Please provide a valid install command';
|
|
241
|
+
else if (value.length > 50)
|
|
242
|
+
return 'Cannot exceed 50 characters.';
|
|
243
|
+
return true;
|
|
244
|
+
})
|
|
245
|
+
}), prompt_1.default.question('buildCommand', 'Provide your Build Command:', {
|
|
246
|
+
type: 'input',
|
|
247
|
+
validate: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
value = value.trim();
|
|
249
|
+
if (value === '')
|
|
250
|
+
return 'Please provide a valid build command';
|
|
251
|
+
else if (value.length > 50)
|
|
252
|
+
return 'Cannot exceed 50 characters.';
|
|
253
|
+
return true;
|
|
254
|
+
})
|
|
255
|
+
}), prompt_1.default.question('buildPath', 'Provide your Build Path:', {
|
|
256
|
+
type: 'input',
|
|
257
|
+
validate: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
value = value.trim();
|
|
259
|
+
if (value === '')
|
|
260
|
+
return 'Please provide a valid build path';
|
|
261
|
+
else if (/[#%*$@?]/.test(value))
|
|
262
|
+
return 'Build path containing invalid characters.';
|
|
263
|
+
else if (value.length > 50)
|
|
264
|
+
return 'Cannot exceed 50 characters.';
|
|
265
|
+
return true;
|
|
266
|
+
})
|
|
267
|
+
}));
|
|
268
|
+
(slateConfigDetails.install_command = config.installCommand),
|
|
269
|
+
(slateConfigDetails.build_path = config.buildPath),
|
|
270
|
+
(slateConfigDetails.build_command = config.buildCommand);
|
|
271
|
+
}
|
|
272
|
+
return slateConfigDetails || {};
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
exports.default = (add) => __awaiter(void 0, void 0, void 0, function* () {
|
|
276
|
+
const frameworks = yield (yield (0, endpoints_1.slateAPI)()).getFrameworks();
|
|
277
|
+
const templateName = (0, option_1.getOptionValue)('template');
|
|
278
|
+
const frameworkOpt = add
|
|
279
|
+
? yield detectFramework(yield addExistingSlate(config_1.slateConfig.raw() || []), frameworks)
|
|
280
|
+
: yield getFrameworkOption(frameworks);
|
|
281
|
+
const appName = yield getAppName(config_1.slateConfig.raw() || [], frameworkOpt.name);
|
|
282
|
+
const payload = {
|
|
283
|
+
name: appName,
|
|
284
|
+
source: frameworkOpt.source ||
|
|
285
|
+
(yield handleTemplate(appName, { templateName, frameworkName: frameworkOpt.name }))
|
|
286
|
+
};
|
|
287
|
+
const slateConfigDetails = yield getConfigDetails(frameworkOpt.name, frameworks);
|
|
288
|
+
if (frameworkOpt.name !== 'static') {
|
|
289
|
+
const slateRunConfig = yield prompt_1.default.ask(prompt_1.default.question('devCommand', 'Please provide your Development Command:', {
|
|
290
|
+
type: 'input',
|
|
291
|
+
default: 'npm start',
|
|
292
|
+
validate: (value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
293
|
+
value = value.trim();
|
|
294
|
+
if (value === '')
|
|
295
|
+
return 'Please provide a valid development command';
|
|
296
|
+
else if (value.length > 50)
|
|
297
|
+
return 'Cannot exceed 50 characters.';
|
|
298
|
+
return true;
|
|
299
|
+
})
|
|
300
|
+
}));
|
|
301
|
+
yield fs_1.ASYNC.writeJSONFile((0, path_1.join)(payload.source, constants_1.FILENAME.cli_config), {
|
|
302
|
+
slate: {
|
|
303
|
+
dev_command: slateRunConfig.devCommand
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
const pth = path_1.default.join(payload.source, '.catalyst', constants_1.FILENAME.slate_config);
|
|
308
|
+
const warnContent = '# ⚠️ This file is automatically generated by the Catalyst CLI when you link or create a Slate app,and is used only for the initial deployment to the Catalyst console. \
|
|
309
|
+
\n# ⚠️ Please do not modify this file, as it is fully managed by the CLI.\n';
|
|
310
|
+
yield (0, async_1.ensureFile)(pth, true);
|
|
311
|
+
fs_1.ASYNC.writeFile(pth, warnContent + '\n' + (0, toml_1.convertTOML)(slateConfigDetails));
|
|
312
|
+
runtime_store_1.default.set('payload.slate.targets', [payload]);
|
|
313
|
+
});
|
package/lib/internal/api.js
CHANGED
|
@@ -54,7 +54,7 @@ class API {
|
|
|
54
54
|
json,
|
|
55
55
|
headers
|
|
56
56
|
};
|
|
57
|
-
const projectSecretKey = process.env.CATALYST_PROJECT_SECRET_KEY;
|
|
57
|
+
const projectSecretKey = process.env.CATALYST_PROJECT_SECRET_KEY || process.env.ZC_PROJECT_SECRET_KEY;
|
|
58
58
|
if (!isExternal) {
|
|
59
59
|
this.requestOpts.headers = Object.assign(Object.assign({}, this.requestOpts.headers), { Accept: 'application/vnd.catalyst.v2+json', 'X-CATALYST-Environment': env });
|
|
60
60
|
if (projectSecretKey) {
|
package/lib/internal/command.js
CHANGED
|
@@ -173,14 +173,18 @@ class Command {
|
|
|
173
173
|
yield runner.apply(this, programArgs);
|
|
174
174
|
const duration = Date.now() - start;
|
|
175
175
|
(0, errorOut_1.default)();
|
|
176
|
-
|
|
176
|
+
if (!env_1.isCI) {
|
|
177
|
+
yield (0, track_1.default)(this.cmdName, 'success', duration);
|
|
178
|
+
}
|
|
177
179
|
}
|
|
178
180
|
catch (err) {
|
|
179
|
-
const duration = Date.now() - start;
|
|
180
|
-
const errorEvent = err.exit === 1 ? 'Error (User)' : 'Error (Unexpected)';
|
|
181
|
-
const preppedMessage = (0, strip_ansi_1.default)(err.message || '');
|
|
182
181
|
(0, errorOut_1.default)(err);
|
|
183
|
-
|
|
182
|
+
if (!env_1.isCI) {
|
|
183
|
+
const duration = Date.now() - start;
|
|
184
|
+
const errorEvent = err.exit === 1 ? 'Error (User)' : 'Error (Unexpected)';
|
|
185
|
+
const preppedMessage = (0, strip_ansi_1.default)(err.message || '');
|
|
186
|
+
yield (0, track_1.default)(errorEvent, preppedMessage, duration);
|
|
187
|
+
}
|
|
184
188
|
}
|
|
185
189
|
}));
|
|
186
190
|
if (this.subCommand) {
|
|
@@ -237,5 +241,5 @@ class Command {
|
|
|
237
241
|
});
|
|
238
242
|
}
|
|
239
243
|
}
|
|
240
|
-
Command.globalOpts = ['project', 'token', 'dc', 'org'];
|
|
244
|
+
Command.globalOpts = ['project', 'token', 'dc', 'org', 'verbose'];
|
|
241
245
|
exports.default = Command;
|
package/lib/port-resolver.js
CHANGED
|
@@ -30,6 +30,7 @@ const featureRef = {
|
|
|
30
30
|
bio: 'basicio',
|
|
31
31
|
master: 'master',
|
|
32
32
|
appsail: 'appsail',
|
|
33
|
+
slate: 'slate',
|
|
33
34
|
browserlogic: 'browser_logic'
|
|
34
35
|
};
|
|
35
36
|
class PortResolver {
|
|
@@ -69,6 +70,12 @@ class PortResolver {
|
|
|
69
70
|
}
|
|
70
71
|
port = constants_1.DEFAULT.serve_port['http']['appsail'][server];
|
|
71
72
|
}
|
|
73
|
+
else if (feature === 'slate') {
|
|
74
|
+
if (!server || type !== 'http') {
|
|
75
|
+
throw new error_1.default('Invalid slate details', { exit: 2 });
|
|
76
|
+
}
|
|
77
|
+
port = constants_1.DEFAULT.serve_port['http']['slate'][server];
|
|
78
|
+
}
|
|
72
79
|
else {
|
|
73
80
|
port = constants_1.DEFAULT.serve_port[type][featureRef[feature]];
|
|
74
81
|
}
|