zcatalyst-cli 1.17.4 → 1.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/command_needs/rc.toml +2 -2
- package/lib/command_needs/rc.js +8 -8
- package/lib/deploy/features/appsail/index.js +4 -3
- package/lib/deploy/features/appsail/utils.js +1 -1
- package/lib/init/features/appsail/index.js +2 -2
- package/lib/internal/api.js +4 -1
- package/lib/serve/server/lib/appsail/index.js +9 -8
- package/lib/shell/prepare/languages/java.js +1 -1
- package/lib/shell/prepare/languages/node.js +3 -1
- package/lib/shell/prepare/languages/python.js +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[RC-1]
|
|
2
|
-
context = '''The project(${arg[0]}) provided with the ${arg[1]} option is not available in the
|
|
3
|
-
aid = '''Please use one of the available projects with the ${arg[1]} option
|
|
2
|
+
context = '''The project(${arg[0]}) provided with the ${arg[1]} option is not available is not available in the ${arg[3]} org.'''
|
|
3
|
+
aid = '''Please use one of the available projects with the ${arg[1]} option or specify the correct org \nThe available projects in the ${arg[3]} org are: \n${arg[2]}'''
|
|
4
4
|
link = 'https://www.zoho.com/catalyst/help/cli-options.html#Project'
|
|
5
5
|
|
|
6
6
|
[RC-2]
|
package/lib/command_needs/rc.js
CHANGED
|
@@ -34,11 +34,6 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
|
|
|
34
34
|
const projectOpt = globProjectOpt
|
|
35
35
|
? globProjectOpt
|
|
36
36
|
: (0, env_1.getEnvVariable)('CATALYST_PROJECT', null);
|
|
37
|
-
if (projectOpt !== null && orgOpt === null) {
|
|
38
|
-
throw new error_1.default('Org option is needed when project option is supplied', {
|
|
39
|
-
exit: 2
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
37
|
const orgApi = yield (0, endpoints_1.orgAPI)();
|
|
43
38
|
if (orgOpt !== null) {
|
|
44
39
|
const orgList = yield orgApi.getAllOrgs();
|
|
@@ -50,8 +45,8 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
|
|
|
50
45
|
}
|
|
51
46
|
runtime_store_1.default.set('project.env.id', orgOpt + '');
|
|
52
47
|
}
|
|
53
|
-
let projectApi =
|
|
54
|
-
let envApi =
|
|
48
|
+
let projectApi = yield (0, endpoints_1.projectAPI)();
|
|
49
|
+
let envApi = yield (0, endpoints_1.envAPI)();
|
|
55
50
|
const convertProjectToProperties = (project) => {
|
|
56
51
|
project = (0, project_2.transformProject)(project);
|
|
57
52
|
runtime_store_1.default.set('project.name', project.name);
|
|
@@ -81,6 +76,9 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
|
|
|
81
76
|
const projectArr = (yield projectApi.getAllProjects());
|
|
82
77
|
const project = js_1.JS.find(projectArr, { project_name: projectOpt });
|
|
83
78
|
if (project === undefined) {
|
|
79
|
+
const allOrgs = yield orgApi.getAllOrgs();
|
|
80
|
+
const orgId = (0, project_2.getEnvId)();
|
|
81
|
+
const orgDetails = allOrgs.find((org) => (!orgId && org.is_default) || org.name === orgId || org.id === orgId);
|
|
84
82
|
throw new error_1.default('invalid project provided with the --project option', {
|
|
85
83
|
exit: 1,
|
|
86
84
|
errorId: 'RC-1',
|
|
@@ -91,7 +89,9 @@ exports.default = ({ optional = false, resolveOnNotFound = false, skipOrgCheck =
|
|
|
91
89
|
.filter((proj) => proj.project_type &&
|
|
92
90
|
project_1.default.accepted_types.includes(proj.project_type))
|
|
93
91
|
.map((project) => '* ' + project.project_name)
|
|
94
|
-
.join('\n'))
|
|
92
|
+
.join('\n')),
|
|
93
|
+
`${orgDetails === null || orgDetails === void 0 ? void 0 : orgDetails.name}(${orgDetails === null || orgDetails === void 0 ? void 0 : orgDetails.id})` +
|
|
94
|
+
((orgDetails === null || orgDetails === void 0 ? void 0 : orgDetails.is_default) ? ' [DEFAULT]' : '')
|
|
95
95
|
]
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -45,7 +45,7 @@ function getConfigJsonInputs() {
|
|
|
45
45
|
const stack = yield (0, utils_1.validateOptions)(utils_1.validateStack, 'stack', runtimeDetailsPromise);
|
|
46
46
|
const platform = yield (0, utils_1.validateOptions)(utils_1.validatePlatform, 'platform', stack);
|
|
47
47
|
const optValues = {
|
|
48
|
-
|
|
48
|
+
build_path: yield (0, utils_1.validateOptions)(utils_1.validateBuildPath, 'buildPath'),
|
|
49
49
|
stack,
|
|
50
50
|
platform,
|
|
51
51
|
command: (0, option_1.getOptionValue)('command', false)
|
|
@@ -54,7 +54,7 @@ function getConfigJsonInputs() {
|
|
|
54
54
|
yield prompt_1.default.register('file-path');
|
|
55
55
|
const appConfigAns = yield prompt_1.default.ask(prompt_1.default.question('buildPath', 'Please provide the build directory of your AppSail service', {
|
|
56
56
|
type: 'file-path',
|
|
57
|
-
when: () => optValues.
|
|
57
|
+
when: () => optValues.build_path === false,
|
|
58
58
|
rootPath: cwd,
|
|
59
59
|
validate: ({ value }) => __awaiter(this, void 0, void 0, function* () {
|
|
60
60
|
const pathRes = (0, utils_1.validateBuildPath)(value);
|
|
@@ -190,7 +190,8 @@ exports.default = (standAlone = false) => __awaiter(void 0, void 0, void 0, func
|
|
|
190
190
|
text: `Preparing AppSail[${targ.name}]`
|
|
191
191
|
});
|
|
192
192
|
const zip = new archiver_1.default();
|
|
193
|
-
const
|
|
193
|
+
const buildPath = targ.buildPath ? targ.buildPath : targ.build_path;
|
|
194
|
+
const folderPath = (0, project_1.resolveProjectPath)(buildPath);
|
|
194
195
|
const ignoreFile = yield fs_1.ASYNC.readFile((0, path_1.join)(folderPath, constants_1.FILENAME.catalyst_ignore));
|
|
195
196
|
const folderContents = yield fs_1.ASYNC.walk(folderPath, {
|
|
196
197
|
filter: {
|
|
@@ -36,7 +36,7 @@ function validateOptions(validationFn, option, ...args) {
|
|
|
36
36
|
exports.validateOptions = validateOptions;
|
|
37
37
|
function validateBuildPath(path) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const cwd =
|
|
39
|
+
const cwd = process.cwd();
|
|
40
40
|
if (path) {
|
|
41
41
|
const buildPath = (0, path_1.isAbsolute)(path) ? path : (0, path_1.resolve)(cwd, path);
|
|
42
42
|
return (yield fs_1.ASYNC.dirExists(buildPath)) ? path : false;
|
|
@@ -148,7 +148,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
148
148
|
const appSail = yield prompt_1.default.ask(prompt_1.default.question('buildPath', 'Please provide the build path of your AppSail service: ', {
|
|
149
149
|
type: 'file-path',
|
|
150
150
|
validate: (pth) => __awaiter(void 0, void 0, void 0, function* () {
|
|
151
|
-
const buildPath = (0, path_1.resolve)(
|
|
151
|
+
const buildPath = (0, path_1.resolve)(process.cwd(), pth.value);
|
|
152
152
|
if ((yield fs_1.ASYNC.dirExists(buildPath)) || (yield fs_1.ASYNC.fileExists(buildPath))) {
|
|
153
153
|
return true;
|
|
154
154
|
}
|
|
@@ -182,7 +182,7 @@ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
182
182
|
const appConfig = {
|
|
183
183
|
command: _appSailConfig.command ||
|
|
184
184
|
'echo Please specify the start-up command in the app-config.json file under the key command',
|
|
185
|
-
|
|
185
|
+
build_path: _appSailConfig.build || appSail.buildPath,
|
|
186
186
|
stack: appSailStack.runtime,
|
|
187
187
|
env_variables: {},
|
|
188
188
|
memory: _appSailConfig.memory || 256,
|
package/lib/internal/api.js
CHANGED
|
@@ -55,7 +55,10 @@ class API {
|
|
|
55
55
|
headers
|
|
56
56
|
};
|
|
57
57
|
if (!isExternal) {
|
|
58
|
-
this.requestOpts.headers = Object.assign(Object.assign({}, this.requestOpts.headers), { Accept: 'application/vnd.catalyst.v2+json', 'X-CATALYST-Environment': env
|
|
58
|
+
this.requestOpts.headers = Object.assign(Object.assign({}, this.requestOpts.headers), { Accept: 'application/vnd.catalyst.v2+json', 'X-CATALYST-Environment': env });
|
|
59
|
+
if (envId) {
|
|
60
|
+
this.requestOpts.headers['CATALYST-ORG'] = envId;
|
|
61
|
+
}
|
|
59
62
|
}
|
|
60
63
|
this.requestOpts.headers = Object.assign(Object.assign({}, this.requestOpts.headers), { 'User-Agent': runtime_store_1.default.get('context.cli.package.name') +
|
|
61
64
|
'/' +
|
|
@@ -45,7 +45,7 @@ const startAppSail = (port, opts) => {
|
|
|
45
45
|
}).RAW();
|
|
46
46
|
};
|
|
47
47
|
exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
var _a, _b, _c;
|
|
48
|
+
var _a, _b, _c, _d;
|
|
49
49
|
let child;
|
|
50
50
|
const targetSail = serverDetails.target;
|
|
51
51
|
if (!targetSail || !targetSail.appSail) {
|
|
@@ -54,16 +54,17 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
54
54
|
if ((_a = targetSail.appSail.scripts) === null || _a === void 0 ? void 0 : _a.preserve) {
|
|
55
55
|
executeHook(targetSail.appSail.scripts.preserve, `AppSail [PRESERVE] [${(_b = targetSail.appSail) === null || _b === void 0 ? void 0 : _b.name}]`, targetSail.appSail.source);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const buildPath = targetSail.appSail.buildPath
|
|
58
|
+
? targetSail.appSail.buildPath
|
|
59
|
+
: (_c = targetSail.appSail) === null || _c === void 0 ? void 0 : _c.build_path;
|
|
60
|
+
if (!(yield fs_1.ASYNC.isPathExists(buildPath))) {
|
|
61
|
+
throw new error_1.default(`Build path does not exists [${buildPath}]`, {
|
|
59
62
|
exit: 1,
|
|
60
63
|
errorId: 'SERVE-APPSAIL-1',
|
|
61
|
-
arg: [ansi_colors_1.italic.red(
|
|
64
|
+
arg: [ansi_colors_1.italic.red(buildPath), (0, ansi_colors_1.bold)(targetSail.appSail.name)]
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
|
-
const target = (yield fs_1.ASYNC.fileExists(
|
|
65
|
-
? (0, path_1.dirname)(targetSail.appSail.buildPath)
|
|
66
|
-
: targetSail.appSail.buildPath;
|
|
67
|
+
const target = (yield fs_1.ASYNC.fileExists(buildPath)) ? (0, path_1.dirname)(buildPath) : buildPath;
|
|
67
68
|
switch (true) {
|
|
68
69
|
case targetSail.appSail.stack.startsWith('node'): {
|
|
69
70
|
child = startAppSail(targetSail.port.appsail, {
|
|
@@ -139,7 +140,7 @@ exports.default = (serverDetails) => __awaiter(void 0, void 0, void 0, function*
|
|
|
139
140
|
}
|
|
140
141
|
});
|
|
141
142
|
});
|
|
142
|
-
if ((
|
|
143
|
+
if ((_d = targetSail.appSail.scripts) === null || _d === void 0 ? void 0 : _d.postserve) {
|
|
143
144
|
child.once('exit', () => {
|
|
144
145
|
var _a, _b, _c, _d;
|
|
145
146
|
if (!((_a = targetSail.appSail) === null || _a === void 0 ? void 0 : _a.scripts)) {
|
|
@@ -45,7 +45,7 @@ exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
45
45
|
}
|
|
46
46
|
const targetBuildPath = (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name);
|
|
47
47
|
if (yield fs_1.ASYNC.isPathExists(targetBuildPath)) {
|
|
48
|
-
yield fs_1.ASYNC.
|
|
48
|
+
yield fs_1.ASYNC.emptyDir(targetBuildPath);
|
|
49
49
|
}
|
|
50
50
|
if (target.type === constants_1.FN_TYPE.advanced ||
|
|
51
51
|
target.type === constants_1.FN_TYPE.applogic ||
|
|
@@ -36,7 +36,9 @@ exports.default = (targets) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
36
36
|
return target;
|
|
37
37
|
});
|
|
38
38
|
return Promise.all(nodeTargets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
-
|
|
39
|
+
const buildPath = (0, path_1.join)(runtime_store_1.default.get('project.root'), constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name);
|
|
40
|
+
yield fs_1.ASYNC.emptyDir(buildPath);
|
|
41
|
+
yield fs_1.ASYNC.copyDir(target.source, buildPath);
|
|
40
42
|
throbber.remove('function_serve_' + target.name);
|
|
41
43
|
return target;
|
|
42
44
|
})));
|
|
@@ -57,6 +57,7 @@ exports.default = (targets, fnWatchEvent) => __awaiter(void 0, void 0, void 0, f
|
|
|
57
57
|
target.failure_reason = error.message;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
yield fs_1.ASYNC.emptyDir(buildPath);
|
|
60
61
|
yield fs_1.ASYNC.copyDir(target.source, buildPath);
|
|
61
62
|
throbber.remove('function_serve_' + target.name);
|
|
62
63
|
return target;
|