zcatalyst-cli 1.26.1 → 1.27.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 +1 -0
- package/lib/appsail-utils.d.ts +1 -1
- package/lib/appsail-utils.js +170 -129
- package/lib/authentication/credential.d.ts +2 -1
- package/lib/authentication/credential.js +20 -3
- package/lib/authentication/crypt.d.ts +7 -3
- package/lib/authentication/crypt.js +87 -16
- package/lib/authentication/index.js +1 -0
- package/lib/authentication/key-manager.d.ts +7 -0
- package/lib/authentication/key-manager.js +62 -0
- package/lib/authentication/login.js +20 -20
- package/lib/bin/catalyst.js +1 -15
- package/lib/client.d.ts +3 -1
- package/lib/client.js +16 -5
- package/lib/command_needs/rc.js +13 -3
- package/lib/commands/appsail/add.js +10 -0
- package/lib/commands/client/delete.js +18 -6
- package/lib/commands/client/setup.js +7 -0
- package/lib/commands/deploy/index.js +3 -3
- package/lib/commands/deploy/slate.js +65 -4
- package/lib/commands/functions/add.js +7 -0
- package/lib/commands/functions/delete.js +22 -4
- package/lib/commands/functions/execute.js +39 -71
- package/lib/commands/functions/setup.js +13 -0
- package/lib/commands/functions/shell.js +15 -1
- package/lib/commands/iac/import.js +2 -2
- package/lib/commands/init.js +34 -20
- package/lib/commands/login.js +1 -0
- package/lib/commands/pull.js +22 -1
- package/lib/commands/serve.js +2 -1
- package/lib/commands/slate/create.js +7 -4
- package/lib/commands/slate/link.js +11 -5
- package/lib/commands/slate/unlink.js +7 -0
- package/lib/commands/zest/generate/index.js +28 -35
- package/lib/deploy/features/appsail/index.js +2 -1
- package/lib/deploy/features/slate.d.ts +3 -1
- package/lib/deploy/features/slate.js +204 -5
- package/lib/docs/client-utils.toml +0 -5
- package/lib/docs/command_needs/rc.toml +9 -1
- package/lib/docs/commands/client/delete.toml +4 -0
- package/lib/docs/commands/deploy/slate.toml +3 -0
- package/lib/docs/commands/functions/delete.toml +10 -0
- package/lib/docs/commands/functions/execute.toml +1 -16
- package/lib/docs/commands/functions/setup.toml +3 -0
- package/lib/docs/commands/functions/shell.toml +8 -0
- package/lib/docs/commands/init.toml +3 -0
- package/lib/docs/commands/pull.toml +6 -0
- package/lib/docs/commands/slate/unlink.toml +6 -0
- package/lib/docs/execute/command-utils.toml +14 -0
- package/lib/docs/execute/execute-input-resolver.toml +37 -0
- package/lib/docs/init/features/project.toml +20 -0
- package/lib/docs/init/util/client.toml +4 -0
- package/lib/docs/prompt/index.toml +15 -0
- package/lib/docs/pull/features/apig.toml +6 -0
- package/lib/docs/pull/features/client.toml +20 -0
- package/lib/docs/pull/features/functions/index.toml +24 -0
- package/lib/endpoints/lib/slate.d.ts +14 -1
- package/lib/endpoints/lib/slate.js +35 -0
- package/lib/error/context-help.js +1 -1
- package/lib/error/index.js +9 -13
- package/lib/execute/command-utils.d.ts +5 -0
- package/lib/execute/command-utils.js +86 -0
- package/lib/execute/execute-input-resolver.d.ts +29 -0
- package/lib/execute/execute-input-resolver.js +207 -0
- package/lib/execute/index.d.ts +4 -1
- package/lib/execute/index.js +3 -2
- package/lib/fn-utils/lib/integ.js +22 -17
- package/lib/index.js +1 -0
- package/lib/init/dependencies/package-json.js +11 -7
- package/lib/init/features/appsail/index.js +75 -26
- package/lib/init/features/appsail/prompt-fields.d.ts +43 -0
- package/lib/init/features/appsail/prompt-fields.js +55 -0
- package/lib/init/features/appsail/utils/custom-runtime.d.ts +3 -0
- package/lib/init/features/appsail/utils/custom-runtime.js +161 -0
- package/lib/init/features/appsail/{utils.d.ts → utils/index.d.ts} +2 -2
- package/lib/init/features/appsail/utils/index.js +170 -0
- package/lib/init/features/client/index.js +4 -3
- package/lib/init/features/client/initializers/angular.js +3 -2
- package/lib/init/features/client/initializers/react.js +4 -3
- package/lib/init/features/client/prompt-fields.d.ts +37 -0
- package/lib/init/features/client/prompt-fields.js +48 -0
- package/lib/init/features/functions/index.js +37 -8
- package/lib/init/features/functions/languages/java.js +42 -7
- package/lib/init/features/functions/languages/node.js +42 -10
- package/lib/init/features/functions/languages/python.js +42 -7
- package/lib/init/features/functions/prompt-fields.d.ts +25 -0
- package/lib/init/features/functions/prompt-fields.js +34 -0
- package/lib/init/features/project.js +41 -6
- package/lib/init/features/slate/index.js +2 -0
- package/lib/init/features/slate/prompt-fields.d.ts +31 -0
- package/lib/init/features/slate/prompt-fields.js +41 -0
- package/lib/init/index.js +2 -1
- package/lib/init/util/client.js +11 -8
- package/lib/init/util/common.d.ts +2 -0
- package/lib/init/util/common.js +33 -3
- package/lib/init/util/prompt-fields.d.ts +7 -0
- package/lib/init/util/prompt-fields.js +13 -0
- package/lib/internal/command.d.ts +3 -0
- package/lib/internal/command.js +26 -3
- package/lib/migration/global/1.27.0.d.ts +2 -0
- package/lib/migration/global/1.27.0.js +39 -0
- package/lib/prompt/choice.d.ts +2 -0
- package/lib/prompt/choice.js +24 -0
- package/lib/prompt/cli-option-key.d.ts +1 -0
- package/lib/prompt/cli-option-key.js +10 -0
- package/lib/prompt/index.d.ts +6 -22
- package/lib/prompt/index.js +264 -67
- package/lib/prompt/overwrite-prompt.d.ts +11 -0
- package/lib/prompt/overwrite-prompt.js +16 -0
- package/lib/prompt/question-factory.d.ts +34 -0
- package/lib/prompt/question-factory.js +41 -0
- package/lib/prompt/register-fields.d.ts +24 -0
- package/lib/prompt/register-fields.js +37 -0
- package/lib/pull/features/apig.js +57 -6
- package/lib/pull/features/client.js +107 -24
- package/lib/pull/features/functions/index.js +100 -4
- package/lib/pull/index.js +1 -1
- package/lib/pull/utils.d.ts +13 -0
- package/lib/pull/utils.js +20 -0
- package/lib/repl-server.d.ts +4 -0
- package/lib/repl-server.js +9 -0
- package/lib/serve/features/appsail.js +2 -45
- package/lib/serve/server/lib/master/index.js +3 -3
- package/lib/serve/server/lib/slate/static-server.js +2 -2
- package/lib/serve/server/lib/web_client/server.js +2 -2
- package/lib/shell/format-functions.d.ts +4 -0
- package/lib/shell/format-functions.js +59 -0
- package/lib/shell/index.js +18 -0
- package/lib/util_modules/config/lib/appsail.d.ts +3 -2
- package/lib/util_modules/config/lib/appsail.js +21 -5
- package/lib/util_modules/config/lib/slate.d.ts +19 -0
- package/lib/util_modules/config-store.d.ts +1 -0
- package/lib/util_modules/config-store.js +29 -10
- package/lib/util_modules/constants/index.d.ts +0 -1
- package/lib/util_modules/constants/index.js +1 -3
- package/lib/util_modules/constants/lib/urls.d.ts +2 -0
- package/lib/util_modules/constants/lib/urls.js +4 -0
- package/lib/util_modules/dc.d.ts +6 -1
- package/lib/util_modules/dc.js +21 -8
- package/lib/util_modules/env.d.ts +3 -0
- package/lib/util_modules/env.js +41 -0
- package/lib/util_modules/fs/lib/sync.d.ts +1 -0
- package/lib/util_modules/fs/lib/sync.js +19 -0
- package/lib/util_modules/logger/utils.d.ts +1 -0
- package/lib/util_modules/logger/utils.js +5 -1
- package/lib/util_modules/option.d.ts +1 -0
- package/lib/util_modules/option.js +8 -0
- package/lib/util_modules/{server.js → server/index.js} +3 -3
- package/lib/util_modules/server/needed-scopes.d.ts +1 -0
- package/lib/util_modules/{constants/lib → server}/needed-scopes.js +7 -7
- package/package.json +3 -2
- package/lib/init/features/appsail/utils.js +0 -273
- package/lib/util_modules/constants/lib/needed-scopes.d.ts +0 -4
- /package/lib/docs/{dc.toml → util_modules/dc.toml} +0 -0
- /package/lib/util_modules/{server.d.ts → server/index.d.ts} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
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.getInputs = getInputs;
|
|
16
|
+
const path_1 = require("path");
|
|
17
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
18
|
+
const index_js_1 = require("../util_modules/constants/index.js");
|
|
19
|
+
const async_js_1 = require("../util_modules/fs/lib/async.js");
|
|
20
|
+
const sync_js_1 = require("../util_modules/fs/lib/sync.js");
|
|
21
|
+
const project_js_1 = require("../util_modules/project.js");
|
|
22
|
+
const error_1 = __importDefault(require("../error"));
|
|
23
|
+
const option_1 = require("../util_modules/option");
|
|
24
|
+
const index_js_2 = __importDefault(require("../prompt/index.js"));
|
|
25
|
+
function readInputFile(exeTarget) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const inputsFile = (0, path_1.resolve)(exeTarget.source, typeof exeTarget.inputs === 'string' ? exeTarget.inputs : index_js_1.FILENAME.catalyst_inputs);
|
|
28
|
+
const projectRoot = (0, project_js_1.getProjectRoot)();
|
|
29
|
+
if (!(0, sync_js_1.isPathInside)(projectRoot, inputsFile)) {
|
|
30
|
+
throw new error_1.default(`Input file path ${exeTarget.inputs} is outside the project directory.`, {
|
|
31
|
+
exit: 1,
|
|
32
|
+
context: {
|
|
33
|
+
resolvePath: inputsFile,
|
|
34
|
+
targetSource: projectRoot,
|
|
35
|
+
inputs: exeTarget.inputs
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return (0, async_js_1.readJSONFile)(inputsFile).catch((err) => {
|
|
40
|
+
throw new error_1.default('Unable to read the inputs file', {
|
|
41
|
+
original: err,
|
|
42
|
+
exit: 1,
|
|
43
|
+
errorId: 'FEXE-2',
|
|
44
|
+
arg: [(0, ansi_colors_1.italic)(inputsFile), ansi_colors_1.italic.red(err || '')]
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function getInputs(exeTarget, inputData) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
const targetInputs = inputData || (yield readInputFile(exeTarget));
|
|
52
|
+
if (!targetInputs || Object.keys(targetInputs).length === 0) {
|
|
53
|
+
throw new error_1.default('Empty inputs', {
|
|
54
|
+
exit: 0,
|
|
55
|
+
errorId: 'FEXE-3',
|
|
56
|
+
arg: [
|
|
57
|
+
(0, ansi_colors_1.bold)(index_js_1.FILENAME.catalyst_inputs),
|
|
58
|
+
(0, ansi_colors_1.bold)(index_js_1.FILENAME.catalyst_config),
|
|
59
|
+
(0, ansi_colors_1.bold)('execution.test_inputs')
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const inputKeys = Object.keys(targetInputs);
|
|
64
|
+
const keyOpt = (0, option_1.getOptionValue)('key', undefined);
|
|
65
|
+
if (keyOpt && !(keyOpt in targetInputs)) {
|
|
66
|
+
throw new error_1.default('Key not present in inputs', {
|
|
67
|
+
exit: 0,
|
|
68
|
+
errorId: 'FEXE-4',
|
|
69
|
+
arg: [
|
|
70
|
+
ansi_colors_1.bold.italic('--key ' + (0, ansi_colors_1.red)(keyOpt)),
|
|
71
|
+
(0, ansi_colors_1.bold)(inputKeys.map((key) => '* ' + key).join('\n'))
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const selectedKey = yield index_js_2.default.ask(index_js_2.default.question('key', 'Please select the input', {
|
|
76
|
+
type: 'list',
|
|
77
|
+
choices: inputKeys.map((key) => index_js_2.default.choice(key, { value: key, short: key })),
|
|
78
|
+
when: !keyOpt && inputKeys.length > 1
|
|
79
|
+
}));
|
|
80
|
+
return inputKeys.length === 1
|
|
81
|
+
? { key: inputKeys.at(0) || 'unknown', ip: targetInputs[inputKeys[0]] }
|
|
82
|
+
: targetInputs[selectedKey.key]
|
|
83
|
+
? { key: selectedKey.key, ip: targetInputs[selectedKey.key] }
|
|
84
|
+
: { key: keyOpt, ip: targetInputs[keyOpt] };
|
|
85
|
+
});
|
|
86
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readJSONFile, fileExists } from '../util_modules/fs/lib/async.js';
|
|
2
|
+
import { getStdinType } from '../util_modules/fs/lib/sync.js';
|
|
3
|
+
import CatalystError from '../error/index.js';
|
|
4
|
+
export type InputResolutionFailureReason = 'no-usable-input' | 'invalid-json' | 'file-not-found' | 'file-unreadable' | 'empty-stdin' | 'stdin-not-piped' | 'stdin-timeout';
|
|
5
|
+
type InputResolutionFailure = {
|
|
6
|
+
ok: false;
|
|
7
|
+
reason: InputResolutionFailureReason;
|
|
8
|
+
details?: string;
|
|
9
|
+
original?: unknown;
|
|
10
|
+
};
|
|
11
|
+
type InputResolutionSuccess = {
|
|
12
|
+
ok: true;
|
|
13
|
+
value: unknown;
|
|
14
|
+
};
|
|
15
|
+
export type InputResolutionResult = InputResolutionSuccess | InputResolutionFailure;
|
|
16
|
+
type ResolverDeps = {
|
|
17
|
+
stdin?: NodeJS.ReadableStream;
|
|
18
|
+
stdinTypeResolver?: typeof getStdinType;
|
|
19
|
+
jsonFileReader?: typeof readJSONFile;
|
|
20
|
+
fileExistsChecker?: typeof fileExists;
|
|
21
|
+
projectRoot?: string;
|
|
22
|
+
cwd?: string;
|
|
23
|
+
idleTimeoutMs?: number;
|
|
24
|
+
};
|
|
25
|
+
export declare function resolveExecuteInputOption(inputValue: string, deps?: ResolverDeps): Promise<InputResolutionResult>;
|
|
26
|
+
export declare function resolveInputError(resolvedInput: InputResolutionResult & {
|
|
27
|
+
ok: false;
|
|
28
|
+
}, inputOption: string): CatalystError;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,207 @@
|
|
|
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.resolveExecuteInputOption = resolveExecuteInputOption;
|
|
16
|
+
exports.resolveInputError = resolveInputError;
|
|
17
|
+
const path_1 = require("path");
|
|
18
|
+
const ansi_colors_1 = require("ansi-colors");
|
|
19
|
+
const async_js_1 = require("../util_modules/fs/lib/async.js");
|
|
20
|
+
const sync_js_1 = require("../util_modules/fs/lib/sync.js");
|
|
21
|
+
const project_js_1 = require("../util_modules/project.js");
|
|
22
|
+
const index_js_1 = __importDefault(require("../error/index.js"));
|
|
23
|
+
const STDIN_IDLE_TIMEOUT_MS = 5000;
|
|
24
|
+
function getFirstNonWhitespaceChar(value) {
|
|
25
|
+
const trimmed = value.trimStart();
|
|
26
|
+
return trimmed.length > 0 ? trimmed[0] : '';
|
|
27
|
+
}
|
|
28
|
+
function parseJSON(value) {
|
|
29
|
+
try {
|
|
30
|
+
return { ok: true, value: JSON.parse(value) };
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
reason: 'invalid-json',
|
|
36
|
+
details: value,
|
|
37
|
+
original: error
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function resolveFromStdin(_a) {
|
|
42
|
+
return __awaiter(this, arguments, void 0, function* ({ stdin, stdinTypeResolver, idleTimeoutMs }) {
|
|
43
|
+
const stdinType = stdinTypeResolver();
|
|
44
|
+
if (stdinType !== 'pipe' && stdinType !== 'file') {
|
|
45
|
+
return { ok: false, reason: 'stdin-not-piped' };
|
|
46
|
+
}
|
|
47
|
+
return new Promise((resolveResult) => {
|
|
48
|
+
const chunks = [];
|
|
49
|
+
let idleTimer;
|
|
50
|
+
const clearTimer = () => {
|
|
51
|
+
if (idleTimer) {
|
|
52
|
+
clearTimeout(idleTimer);
|
|
53
|
+
idleTimer = undefined;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const cleanup = () => {
|
|
57
|
+
clearTimer();
|
|
58
|
+
stdin.removeListener('data', onData);
|
|
59
|
+
stdin.removeListener('end', onEnd);
|
|
60
|
+
stdin.removeListener('error', onError);
|
|
61
|
+
if (typeof stdin.pause === 'function') {
|
|
62
|
+
stdin.pause();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const resetIdleTimer = () => {
|
|
66
|
+
clearTimer();
|
|
67
|
+
idleTimer = setTimeout(() => {
|
|
68
|
+
cleanup();
|
|
69
|
+
resolveResult({ ok: false, reason: 'stdin-timeout' });
|
|
70
|
+
}, idleTimeoutMs);
|
|
71
|
+
};
|
|
72
|
+
const onData = (chunk) => {
|
|
73
|
+
chunks.push(typeof chunk === 'string' ? chunk : chunk.toString());
|
|
74
|
+
resetIdleTimer();
|
|
75
|
+
};
|
|
76
|
+
const onEnd = () => {
|
|
77
|
+
cleanup();
|
|
78
|
+
const value = chunks.join('').trimEnd();
|
|
79
|
+
if (value.trim().length === 0) {
|
|
80
|
+
resolveResult({ ok: false, reason: 'empty-stdin' });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
resolveResult(parseJSON(value));
|
|
84
|
+
};
|
|
85
|
+
const onError = (error) => {
|
|
86
|
+
cleanup();
|
|
87
|
+
resolveResult({
|
|
88
|
+
ok: false,
|
|
89
|
+
reason: 'file-unreadable',
|
|
90
|
+
details: 'stdin',
|
|
91
|
+
original: error
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
stdin.on('data', onData);
|
|
95
|
+
stdin.once('end', onEnd);
|
|
96
|
+
stdin.once('error', onError);
|
|
97
|
+
resetIdleTimer();
|
|
98
|
+
if (typeof stdin.resume === 'function') {
|
|
99
|
+
stdin.resume();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function resolveExecuteInputOption(inputValue_1) {
|
|
105
|
+
return __awaiter(this, arguments, void 0, function* (inputValue, deps = {}) {
|
|
106
|
+
var _a;
|
|
107
|
+
const value = inputValue !== null && inputValue !== void 0 ? inputValue : '';
|
|
108
|
+
const trimmed = value.trim();
|
|
109
|
+
if (trimmed.length === 0) {
|
|
110
|
+
return { ok: false, reason: 'no-usable-input' };
|
|
111
|
+
}
|
|
112
|
+
if (trimmed === '-') {
|
|
113
|
+
return resolveFromStdin({
|
|
114
|
+
stdin: deps.stdin || process.stdin,
|
|
115
|
+
stdinTypeResolver: deps.stdinTypeResolver || sync_js_1.getStdinType,
|
|
116
|
+
idleTimeoutMs: (_a = deps.idleTimeoutMs) !== null && _a !== void 0 ? _a : STDIN_IDLE_TIMEOUT_MS
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const firstChar = getFirstNonWhitespaceChar(value);
|
|
120
|
+
if (firstChar === '{' || firstChar === '[') {
|
|
121
|
+
return parseJSON(value);
|
|
122
|
+
}
|
|
123
|
+
const cwd = deps.cwd || process.cwd();
|
|
124
|
+
const absolutePath = (0, path_1.resolve)(cwd, value);
|
|
125
|
+
const projectRoot = deps.projectRoot || (0, project_js_1.getProjectRoot)();
|
|
126
|
+
if (!(0, sync_js_1.isPathInside)(projectRoot, absolutePath)) {
|
|
127
|
+
return {
|
|
128
|
+
ok: false,
|
|
129
|
+
reason: 'file-unreadable',
|
|
130
|
+
details: `${value} (outside project directory)`
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const doesFileExist = deps.fileExistsChecker || async_js_1.fileExists;
|
|
134
|
+
if (!(yield doesFileExist(absolutePath))) {
|
|
135
|
+
return { ok: false, reason: 'file-not-found', details: value };
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
const jsonFileReader = deps.jsonFileReader || async_js_1.readJSONFile;
|
|
139
|
+
const parsedJSON = yield jsonFileReader(absolutePath);
|
|
140
|
+
return { ok: true, value: parsedJSON };
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
const message = (error === null || error === void 0 ? void 0 : error.message) || '';
|
|
144
|
+
if (/JSON|Unexpected token|parse/i.test(message)) {
|
|
145
|
+
return {
|
|
146
|
+
ok: false,
|
|
147
|
+
reason: 'invalid-json',
|
|
148
|
+
details: value,
|
|
149
|
+
original: error
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
ok: false,
|
|
154
|
+
reason: 'file-unreadable',
|
|
155
|
+
details: value,
|
|
156
|
+
original: error
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function resolveInputError(resolvedInput, inputOption) {
|
|
162
|
+
switch (resolvedInput.reason) {
|
|
163
|
+
case 'no-usable-input':
|
|
164
|
+
return new index_js_1.default('No usable input provided with --input', {
|
|
165
|
+
exit: 1,
|
|
166
|
+
errorId: 'FEXE-7',
|
|
167
|
+
arg: [ansi_colors_1.bold.italic('--input')]
|
|
168
|
+
});
|
|
169
|
+
case 'stdin-timeout':
|
|
170
|
+
return new index_js_1.default('Timed out waiting for stdin input', {
|
|
171
|
+
exit: 1,
|
|
172
|
+
errorId: 'FEXE-8',
|
|
173
|
+
arg: [ansi_colors_1.bold.italic('--input -')]
|
|
174
|
+
});
|
|
175
|
+
case 'stdin-not-piped':
|
|
176
|
+
return new index_js_1.default('Stdin is not piped', {
|
|
177
|
+
exit: 1,
|
|
178
|
+
errorId: 'FEXE-9',
|
|
179
|
+
arg: [ansi_colors_1.bold.italic('--input -')]
|
|
180
|
+
});
|
|
181
|
+
case 'empty-stdin':
|
|
182
|
+
return new index_js_1.default('Received empty stdin content', {
|
|
183
|
+
exit: 1,
|
|
184
|
+
errorId: 'FEXE-10',
|
|
185
|
+
arg: [ansi_colors_1.bold.italic('--input -')]
|
|
186
|
+
});
|
|
187
|
+
case 'file-not-found':
|
|
188
|
+
return new index_js_1.default('Input file not found', {
|
|
189
|
+
exit: 1,
|
|
190
|
+
errorId: 'FEXE-11',
|
|
191
|
+
arg: [(0, ansi_colors_1.italic)(resolvedInput.details || inputOption)]
|
|
192
|
+
});
|
|
193
|
+
case 'file-unreadable':
|
|
194
|
+
return new index_js_1.default('Unable to read input source', {
|
|
195
|
+
exit: 1,
|
|
196
|
+
errorId: 'FEXE-12',
|
|
197
|
+
arg: [(0, ansi_colors_1.italic)(resolvedInput.details || inputOption)]
|
|
198
|
+
});
|
|
199
|
+
case 'invalid-json':
|
|
200
|
+
default:
|
|
201
|
+
return new index_js_1.default('Error parsing the JSON input', {
|
|
202
|
+
exit: 1,
|
|
203
|
+
errorId: 'FEXE-6',
|
|
204
|
+
arg: [ansi_colors_1.italic.red(resolvedInput.details || inputOption)]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
package/lib/execute/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { IFnTarget } from '../fn-utils/lib/common.js';
|
|
2
|
-
declare const _default: (target: IFnTarget, input:
|
|
2
|
+
declare const _default: (target: IFnTarget, input: {
|
|
3
|
+
key: string;
|
|
4
|
+
ip?: Record<string, unknown>;
|
|
5
|
+
}) => Promise<void>;
|
|
3
6
|
export default _default;
|
package/lib/execute/index.js
CHANGED
|
@@ -33,7 +33,8 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
|
|
|
33
33
|
try {
|
|
34
34
|
(0, index_1.info)();
|
|
35
35
|
(0, index_1.info)((0, ansi_colors_1.bold)('=> Starting function execution'));
|
|
36
|
-
|
|
36
|
+
const exeInfo = ` name: ${(0, ansi_colors_1.green)(target.name)} | type: ${(0, ansi_colors_1.magenta)(target.type ? index_js_3.REMOTE_REF.functions.type[target.type] : '')} | stack: ${(0, ansi_colors_1.cyan)(target.stack || '')} | input: ${(0, ansi_colors_1.yellow)(input.key)}`;
|
|
37
|
+
(0, index_1.info)(exeInfo);
|
|
37
38
|
(0, index_1.info)();
|
|
38
39
|
if (yield index_js_4.ASYNC.isPathExists(buildFolder)) {
|
|
39
40
|
try {
|
|
@@ -84,7 +85,7 @@ exports.default = (target, input) => __awaiter(void 0, void 0, void 0, function*
|
|
|
84
85
|
isAlive: null
|
|
85
86
|
}, new stream_1.EventEmitter());
|
|
86
87
|
utils_1.serverEvent.once('stop', () => caller.kill());
|
|
87
|
-
yield caller.call(input);
|
|
88
|
+
yield caller.call(input.ip || {});
|
|
88
89
|
utils_1.serverEvent.emit('stop');
|
|
89
90
|
yield index_js_4.ASYNC.deleteDir(buildFolder).catch();
|
|
90
91
|
yield index_js_1.fnUtils.common.executeHook({ prefix: 'post', command: 'serve' });
|
|
@@ -23,6 +23,8 @@ const constants_1 = require("../../util_modules/constants");
|
|
|
23
23
|
const runtime_1 = __importDefault(require("../../util_modules/constants/lib/runtime"));
|
|
24
24
|
const fs_1 = require("../../util_modules/fs");
|
|
25
25
|
const js_1 = require("../../util_modules/js");
|
|
26
|
+
const prompt_fields_1 = require("../../init/features/functions/prompt-fields");
|
|
27
|
+
const env_js_1 = require("../../util_modules/env.js");
|
|
26
28
|
const serviceChoiceMap = {
|
|
27
29
|
[constants_1.INTEG.services.cliq]: prompt_1.default.choice('Cliq', {
|
|
28
30
|
value: constants_1.INTEG.services.cliq,
|
|
@@ -41,7 +43,7 @@ function integHelper(services) {
|
|
|
41
43
|
exit: 2
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
const serviceAns = yield prompt_1.default.ask(prompt_1.default.question('service', 'Select one of the services to continue:', {
|
|
46
|
+
const serviceAns = yield prompt_1.default.ask(prompt_1.default.question(prompt_fields_1.functionsAddPromptFields.get('service'), 'Select one of the services to continue:', {
|
|
45
47
|
type: 'list',
|
|
46
48
|
choices: serviceChoices
|
|
47
49
|
}));
|
|
@@ -55,23 +57,26 @@ function integHelper(services) {
|
|
|
55
57
|
checked: true
|
|
56
58
|
});
|
|
57
59
|
});
|
|
58
|
-
const handlerSelection =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
const handlerSelection = (0, env_js_1.isNonInteractiveMode)()
|
|
61
|
+
? { selectionAnswer: constants_1.CLIQ.component_handlers }
|
|
62
|
+
: yield prompt_1.default.ask(prompt_1.default.question('selectionAnswer', 'Pick the handlers to be initialized', {
|
|
63
|
+
type: 'checkbox',
|
|
64
|
+
defaultAns: constants_1.CLIQ.component_handlers,
|
|
65
|
+
choices: handlerChoice,
|
|
66
|
+
validate: (ansArr) => {
|
|
67
|
+
if (js_1.JS.isEmpty(ansArr)) {
|
|
68
|
+
return ('Must select at least one handler.\n' +
|
|
69
|
+
'(Press ' +
|
|
70
|
+
(0, ansi_colors_1.cyan)('<space>') +
|
|
71
|
+
' to select, ' +
|
|
72
|
+
(0, ansi_colors_1.cyan)('<a>') +
|
|
73
|
+
' to toggle all, ' +
|
|
74
|
+
(0, ansi_colors_1.cyan)('<i>') +
|
|
75
|
+
' to invert selection)');
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
71
78
|
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}));
|
|
79
|
+
}));
|
|
75
80
|
runtime_store_1.default.set('context.function.integration.cliq.handlers', handlerSelection.selectionAnswer);
|
|
76
81
|
break;
|
|
77
82
|
default:
|
package/lib/index.js
CHANGED
|
@@ -30,6 +30,7 @@ program.option('--token <token>', 'Supply an authentication token for a command'
|
|
|
30
30
|
program.option('--dc <us|eu|in|au>', 'Supply a data center for a command');
|
|
31
31
|
program.option('--org <org_id>', 'Supply a Org ID to be used for a command');
|
|
32
32
|
program.option('--verbose', 'Change the log level to verbose for debugging purposes');
|
|
33
|
+
program.option('-ni, --non-interactive', 'Do not prompt for input; fail if required answers are not supplied (see also ZCATALYST_NON_INTERACTIVE)');
|
|
33
34
|
program.helpOption('-h, --help', 'Display help for a Catalyst command');
|
|
34
35
|
program.showSuggestionAfterError();
|
|
35
36
|
program.showHelpAfterError(`For more usage information use the ${(0, ansi_colors_1.bold)('catalyst help')} command`);
|
|
@@ -20,11 +20,13 @@ const constants_1 = require("../../util_modules/constants");
|
|
|
20
20
|
const js_1 = require("../../util_modules/js");
|
|
21
21
|
const index_1 = require("../../util_modules/logger/index");
|
|
22
22
|
const project_1 = require("../../util_modules/project");
|
|
23
|
+
const prompt_fields_1 = require("../features/functions/prompt-fields");
|
|
24
|
+
const env_1 = require("../../util_modules/env");
|
|
23
25
|
exports.default = (keys) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
26
|
const qns = keys.map((qn) => {
|
|
25
27
|
switch (qn) {
|
|
26
28
|
case 'name':
|
|
27
|
-
return prompt_1.default.question('name', 'package name: ', {
|
|
29
|
+
return prompt_1.default.question(prompt_fields_1.functionsAddPromptFields.get('name'), 'package name: ', {
|
|
28
30
|
defaultAns: js_1.JS.snakeCase((0, project_1.getProjectName)('sample') + '_function'),
|
|
29
31
|
validate: (ans) => {
|
|
30
32
|
if (ans.match(constants_1.REGEX.functions.package.name)) {
|
|
@@ -51,11 +53,13 @@ exports.default = (keys) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
51
53
|
throw new error_1.default('unknown key provided', { exit: 2 });
|
|
52
54
|
}
|
|
53
55
|
});
|
|
54
|
-
(0,
|
|
55
|
-
(0,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(0,
|
|
59
|
-
|
|
56
|
+
if (!(0, env_1.isNonInteractiveMode)()) {
|
|
57
|
+
(0, index_1.info)('This utility will ask series of questions with sensible defaults for creating ' +
|
|
58
|
+
(0, ansi_colors_1.cyan)('package.json') +
|
|
59
|
+
'\nFeel free to modify them if needed.\n');
|
|
60
|
+
(0, index_1.info)('Use `' +
|
|
61
|
+
(0, ansi_colors_1.bold)('npm install <pkg> --save') +
|
|
62
|
+
'` afterwards to install a package and \nsave it as a dependency in the package.json file.\n');
|
|
63
|
+
}
|
|
60
64
|
return prompt_1.default.ask(...qns);
|
|
61
65
|
});
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const ansi_colors_1 = require("ansi-colors");
|
|
16
16
|
const path_1 = require("path");
|
|
17
|
+
const error_1 = __importDefault(require("../../../error"));
|
|
17
18
|
const prompt_1 = __importDefault(require("../../../prompt"));
|
|
18
19
|
const runtime_store_1 = __importDefault(require("../../../runtime-store"));
|
|
19
20
|
const constants_1 = require("../../../util_modules/constants");
|
|
@@ -23,9 +24,21 @@ const option_1 = require("../../../util_modules/option");
|
|
|
23
24
|
const common_1 = require("../../util/common");
|
|
24
25
|
const project_1 = require("../../../util_modules/project");
|
|
25
26
|
const utils_1 = require("./utils");
|
|
27
|
+
const prompt_fields_1 = require("./prompt-fields");
|
|
28
|
+
const env_1 = require("../../../util_modules/env");
|
|
29
|
+
const custom_runtime_1 = require("./utils/custom-runtime");
|
|
30
|
+
const prompt_fields_2 = require("../../util/prompt-fields");
|
|
26
31
|
exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
32
|
(0, index_1.info)();
|
|
28
33
|
(0, index_1.info)((0, ansi_colors_1.white)('=> ') + 'Configure AppSail');
|
|
34
|
+
const sourceFromOption = (0, option_1.getOptionValue)(prompt_fields_1.appsailAddPromptFields.get('source').optKey, undefined);
|
|
35
|
+
const sourceFromOptionTrimmed = typeof sourceFromOption === 'string' ? sourceFromOption.trim() : '';
|
|
36
|
+
if ((0, env_1.isNonInteractiveMode)() &&
|
|
37
|
+
(0, option_1.getCurrentCommand)() === 'appsail:add' &&
|
|
38
|
+
sourceFromOptionTrimmed === '') {
|
|
39
|
+
throw new error_1.default('Non-interactive mode requires --source. Pass an absolute path to the AppSail source directory, or a docker image/archive source (see catalyst appsail:add --help).', { exit: 2 });
|
|
40
|
+
}
|
|
41
|
+
const runtimeDetectedFromSource = (0, utils_1.detectRuntimeFromSourceOption)(sourceFromOption);
|
|
29
42
|
const descArr = [
|
|
30
43
|
'',
|
|
31
44
|
` Catalyst let's you choose the runtime of your choice for your AppSail. You can either select`,
|
|
@@ -35,9 +48,10 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
35
48
|
''
|
|
36
49
|
];
|
|
37
50
|
yield prompt_1.default.register('with-desc');
|
|
38
|
-
const runtimeQuestion = yield prompt_1.default.ask(prompt_1.default.question('
|
|
51
|
+
const runtimeQuestion = yield prompt_1.default.ask(prompt_1.default.question('runtimeType', 'Please select the runtime type for your AppSail to continue:', {
|
|
39
52
|
type: 'with-desc',
|
|
40
53
|
description: (0, ansi_colors_1.italic)(descArr.join('\n')),
|
|
54
|
+
when: !(0, env_1.isNonInteractiveMode)() && runtimeDetectedFromSource === undefined,
|
|
41
55
|
choices: [
|
|
42
56
|
prompt_1.default.choice('Catalyst-Managed Runtime', {
|
|
43
57
|
value: 'catalyst',
|
|
@@ -49,11 +63,32 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
49
63
|
})
|
|
50
64
|
]
|
|
51
65
|
}));
|
|
52
|
-
|
|
66
|
+
const effectiveRuntime = runtimeDetectedFromSource !== null && runtimeDetectedFromSource !== void 0 ? runtimeDetectedFromSource : runtimeQuestion.runtimeType;
|
|
67
|
+
if (effectiveRuntime === 'custom') {
|
|
68
|
+
const portOpt = (0, option_1.getOptionValue)(prompt_fields_1.appsailAddPromptFields.get('port').optKey, undefined);
|
|
69
|
+
const commandOpt = (0, option_1.getOptionValue)(prompt_fields_1.appsailAddPromptFields.get('command').optKey, undefined);
|
|
70
|
+
(0, common_1.niIgnorableOptsTest)([
|
|
71
|
+
prompt_fields_2.initCommonPromptFields.get('stack').optKey,
|
|
72
|
+
prompt_fields_1.appsailAddPromptFields.get('overwrite').optKey,
|
|
73
|
+
prompt_fields_1.appsailAddPromptFields.get('buildPath').optKey,
|
|
74
|
+
prompt_fields_1.appsailAddPromptFields.get('platform').optKey
|
|
75
|
+
], 'The following options are not applicable for the custom runtime in non-interactive mode and will be ignored.');
|
|
53
76
|
const payload = {
|
|
54
|
-
source: yield (0,
|
|
77
|
+
source: yield (0, custom_runtime_1.getCustomAppSailSource)(sourceFromOption),
|
|
55
78
|
name: yield (0, utils_1.getAppSailName)()
|
|
56
79
|
};
|
|
80
|
+
if (commandOpt) {
|
|
81
|
+
payload.command = commandOpt;
|
|
82
|
+
}
|
|
83
|
+
if (portOpt) {
|
|
84
|
+
const _port = parseInt(portOpt);
|
|
85
|
+
if (isNaN(_port) || _port < 1 || _port > 65535) {
|
|
86
|
+
throw new error_1.default(`Invalid port number provided: ${portOpt}. Please provide a valid port number between 1 and 65535.`, { exit: 1 });
|
|
87
|
+
}
|
|
88
|
+
payload.port = {
|
|
89
|
+
http: _port
|
|
90
|
+
};
|
|
91
|
+
}
|
|
57
92
|
runtime_store_1.default.set('context.payload.appsail.targets', [payload]);
|
|
58
93
|
return;
|
|
59
94
|
}
|
|
@@ -67,22 +102,25 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
67
102
|
const sourcePath = yield prompt_1.default.ask(prompt_1.default.question('currentDir', 'Do you want to initialize an AppSail in this directory?', {
|
|
68
103
|
type: 'confirm',
|
|
69
104
|
default: true,
|
|
70
|
-
when: !pulledSource
|
|
105
|
+
when: !pulledSource && !(0, env_1.isNonInteractiveMode)() && sourceFromOption === undefined
|
|
71
106
|
}));
|
|
72
107
|
const _appSailConfig = sourcePath.currentDir
|
|
73
108
|
? { source: runtime_store_1.default.get('cwd') }
|
|
74
|
-
: pulledSource ||
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
109
|
+
: pulledSource ||
|
|
110
|
+
(sourceFromOption !== undefined
|
|
111
|
+
? { source: yield (0, utils_1.resolveCatalystSourceFromOption)(sourceFromOption) }
|
|
112
|
+
: {
|
|
113
|
+
source: (yield prompt_1.default.ask(prompt_1.default.question(prompt_fields_1.appsailAddPromptFields.get('source'), "Please provide the exact path to your AppSail's source directory:", {
|
|
114
|
+
type: 'input',
|
|
115
|
+
validate: (pth) => __awaiter(void 0, void 0, void 0, function* () {
|
|
116
|
+
return (0, path_1.isAbsolute)(pth)
|
|
117
|
+
? (yield fs_1.ASYNC.dirExists(pth))
|
|
118
|
+
? true
|
|
119
|
+
: 'Provided path does not exists'
|
|
120
|
+
: 'Please provide an absolute path';
|
|
121
|
+
})
|
|
122
|
+
}))).source
|
|
123
|
+
});
|
|
86
124
|
const payload = {
|
|
87
125
|
source: (0, path_1.relative)((0, project_1.getProjectRoot)(), _appSailConfig.source) || '.',
|
|
88
126
|
name: yield (0, utils_1.getAppSailName)()
|
|
@@ -93,37 +131,48 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
93
131
|
(0, index_1.info)();
|
|
94
132
|
(0, index_1.warning)(`The ${(0, ansi_colors_1.bold)(constants_1.FILENAME.app_config)} file is already present in the appsail directory`);
|
|
95
133
|
}
|
|
96
|
-
const
|
|
134
|
+
const overwriteOpt = prompt_fields_1.appsailAddPromptFields.get('overwrite');
|
|
135
|
+
const overWrite = yield prompt_1.default.ask(prompt_1.default.question(overwriteOpt, 'Do you wish to overwrite the ' + constants_1.FILENAME.app_config + '?', {
|
|
97
136
|
type: 'confirm',
|
|
98
137
|
default: false,
|
|
99
138
|
when: isAppConfig
|
|
100
139
|
}));
|
|
101
|
-
const activeWrite = overWrite.
|
|
140
|
+
const activeWrite = overWrite[overwriteOpt.promptName] !== false;
|
|
102
141
|
if (!activeWrite) {
|
|
103
142
|
runtime_store_1.default.set('context.payload.appsail.targets', [payload]);
|
|
143
|
+
(0, index_1.info)();
|
|
144
|
+
(0, index_1.info)((0, ansi_colors_1.bold)(`${constants_1.FILENAME.app_config} will not be overwritten. Keeping the existing configuration file.`));
|
|
145
|
+
if ((0, env_1.isNonInteractiveMode)()) {
|
|
146
|
+
(0, index_1.info)();
|
|
147
|
+
(0, index_1.info)(`To overwrite the existing configuration file, use the ${(0, ansi_colors_1.bold)('--overwrite-config')} option.`);
|
|
148
|
+
}
|
|
149
|
+
(0, index_1.info)();
|
|
104
150
|
return;
|
|
105
151
|
}
|
|
106
|
-
const buildPath = yield prompt_1.default.ask(prompt_1.default.question('
|
|
152
|
+
const buildPath = yield prompt_1.default.ask(prompt_1.default.question(prompt_fields_1.appsailAddPromptFields.get('buildPath'), 'Please provide the build path of your AppSail:', {
|
|
107
153
|
type: 'input',
|
|
108
154
|
rootPath: _appSailConfig.source,
|
|
109
|
-
when: !_appSailConfig.build && activeWrite
|
|
155
|
+
when: !_appSailConfig.build && activeWrite,
|
|
156
|
+
defaultAns: './'
|
|
110
157
|
}));
|
|
158
|
+
const appCmdFromOpt = (0, option_1.getOptionValue)(prompt_fields_1.appsailAddPromptFields.get('command').optKey, 'echo Please specify the start-up command in the app-config.json file under the key command for AppSail $X_ZC_RESOURCE_NAME');
|
|
111
159
|
const appSailStack = _appSailConfig.stack ||
|
|
112
160
|
(yield (0, common_1.getRuntimePromptAnswer)('Please choose a stack for your AppSail: '));
|
|
161
|
+
const _buildPath = buildPath[prompt_fields_1.appsailAddPromptFields.get('buildPath').promptName];
|
|
162
|
+
(0, common_1.niIgnorableOptsTest)(prompt_fields_1.appsailAddPromptFields.get('port').optKey, 'The following option is not applicable for the Catalyst-Managed runtime in non-interactive mode and will be ignored.');
|
|
113
163
|
const appConfig = {
|
|
114
|
-
command: _appSailConfig.command ||
|
|
115
|
-
'echo Please specify the start-up command in the app-config.json file under the key command for AppSail $X_ZC_RESOURCE_NAME',
|
|
164
|
+
command: _appSailConfig.command || appCmdFromOpt,
|
|
116
165
|
build_path: _appSailConfig.build ||
|
|
117
|
-
((0, path_1.isAbsolute)(
|
|
118
|
-
? (0, path_1.relative)(_appSailConfig.source,
|
|
119
|
-
:
|
|
166
|
+
((0, path_1.isAbsolute)(_buildPath)
|
|
167
|
+
? (0, path_1.relative)(_appSailConfig.source, _buildPath) || '.'
|
|
168
|
+
: _buildPath),
|
|
120
169
|
stack: appSailStack.runtime,
|
|
121
170
|
env_variables: {},
|
|
122
171
|
memory: _appSailConfig.memory || 256,
|
|
123
172
|
scripts: _appSailConfig.scripts || {}
|
|
124
173
|
};
|
|
125
174
|
if (appSailStack.lang === 'java') {
|
|
126
|
-
const platformQ = yield prompt_1.default.ask(prompt_1.default.question('platform', 'Please choose a platform for your AppSail: ', {
|
|
175
|
+
const platformQ = yield prompt_1.default.ask(prompt_1.default.question(prompt_fields_1.appsailAddPromptFields.get('platform'), 'Please choose a platform for your AppSail: ', {
|
|
127
176
|
type: 'list',
|
|
128
177
|
choices: [
|
|
129
178
|
prompt_1.default.choice('JavaSE', {
|