zcatalyst-cli 1.17.0 → 1.17.2

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.
@@ -17,9 +17,9 @@ const semver_1 = require("semver");
17
17
  const error_1 = __importDefault(require("../../error"));
18
18
  const runtime_store_1 = __importDefault(require("../../runtime-store"));
19
19
  const userConfig_1 = __importDefault(require("../../userConfig"));
20
- const env_1 = require("../../util_modules/env");
21
20
  const shell_1 = require("../../util_modules/shell");
22
21
  const java_1 = require("./java");
22
+ const path_1 = require("path");
23
23
  exports.stackVsVersions = {
24
24
  java8: {
25
25
  version: '1.8.0',
@@ -140,12 +140,6 @@ function getJavaSpawnCommand(spawnCommand, process, stack) {
140
140
  if (isUsingJavaDefaultPath === true) {
141
141
  return process;
142
142
  }
143
- if (env_1.isWindows) {
144
- spawnCommand = `"${spawnCommand}\\${process}"`;
145
- }
146
- else {
147
- spawnCommand = `${spawnCommand}/${process}`;
148
- }
149
- return spawnCommand;
143
+ return (0, path_1.join)(spawnCommand, process);
150
144
  }
151
145
  exports.getJavaSpawnCommand = getJavaSpawnCommand;
@@ -239,10 +239,11 @@ function compileTarget(target) {
239
239
  yield Promise.all(entries.map((file) => compileJavaFiles(file, spawnCommand, targetVersion, targetSource, outputFolder)
240
240
  .then((result) => {
241
241
  const [_stdout, stderr, code] = result;
242
- if (code === 1) {
242
+ if (code === null || code >= 1) {
243
243
  const error = [];
244
244
  error === null || error === void 0 ? void 0 : error.push(stderr);
245
245
  target.valid = false;
246
+ target.failure_reason = 'there was a Java compilation error';
246
247
  target.compilationError = error;
247
248
  }
248
249
  else if (stderr) {
@@ -250,6 +251,7 @@ function compileTarget(target) {
250
251
  }
251
252
  })
252
253
  .catch((error) => {
254
+ target.valid = false;
253
255
  target.failure_reason = error.message;
254
256
  })));
255
257
  const currentCommand = (0, option_1.getCurrentCommand)();
@@ -439,10 +441,7 @@ function validate(targets, idx) {
439
441
  skipHelp: !!(0, option_1.getOptionValue)('watch', false)
440
442
  });
441
443
  });
442
- if (currentTarget.valid === true && !currentTarget.failure_reason) {
443
- currentTarget.valid = true;
444
- return validate(targets, ++idx);
445
- }
444
+ return validate(targets, ++idx);
446
445
  }
447
446
  catch (err) {
448
447
  currentTarget.valid = false;
package/lib/fn-watcher.js CHANGED
@@ -40,16 +40,13 @@ exports.default = (target) => __awaiter(void 0, void 0, void 0, function* () {
40
40
  watcher.emit('preparing');
41
41
  target.failure_reason = undefined;
42
42
  target.valid = true;
43
+ target.compilationError = undefined;
44
+ target.compilationWarning = undefined;
43
45
  yield fs_1.ASYNC.chmod((0, path_1.join)(runtime_store_1.default.get('project.root'), constants_1.FOLDERNAME.build, constants_1.FOLDERNAME.functions, target.name), '755', { recursive: true });
44
46
  yield (0, languages_1.prepareFunctions)([target], latestEvent);
45
47
  if (currentLatestEvent.at === latestEvent.at) {
46
48
  latestEvent = undefined;
47
49
  }
48
- if (target.valid) {
49
- watcher.emit('compiled');
50
- return;
51
- }
52
- (0, logger_1.warning)('target [' + target.name + '] is not a valid one reason : ' + target.failure_reason);
53
50
  if (target.compilationError) {
54
51
  target.compilationError.forEach((error) => {
55
52
  console.log(`${(0, ansi_colors_1.red)(char_1.CHAR.error)} Error while compiling function[${target.name}]`);
@@ -62,6 +59,11 @@ exports.default = (target) => __awaiter(void 0, void 0, void 0, function* () {
62
59
  console.warn(warn);
63
60
  });
64
61
  }
62
+ if (target.valid) {
63
+ watcher.emit('compiled');
64
+ return;
65
+ }
66
+ (0, logger_1.warning)('target [' + target.name + '] is not a valid one reason : ' + target.failure_reason);
65
67
  (0, logger_1.info)('Waiting for correction..');
66
68
  (0, logger_1.info)('\n(To exit, press ^C)');
67
69
  watcher.emit('next');
@@ -24,6 +24,7 @@ const runtime_1 = __importDefault(require("../../../util_modules/constants/lib/r
24
24
  const env_1 = require("../../../util_modules/env");
25
25
  const ensure_python_1 = require("./ensure-python");
26
26
  const userConfig_1 = __importDefault(require("../../../userConfig"));
27
+ const logger_1 = require("../../../util_modules/logger");
27
28
  const sdkPipOpts = (0, env_1.envOverride)('CATALYST_SDK_PIP_OPTS', 'zcatalyst-sdk');
28
29
  const cliqSdkPipOpts = (0, env_1.envOverride)('CATALYST_CLIQ_SDK_PIP_OPTS', 'zcatalyst-cliq');
29
30
  const testPypi = (0, env_1.envOverride)('CATALYST_TEST_PYPI', 'false');
@@ -90,6 +91,7 @@ function ensurePyRuntime(pth, stack) {
90
91
  errData.push(chunk);
91
92
  });
92
93
  child.on('error', (err) => {
94
+ (0, logger_1.info)(Buffer.concat(errData).toString());
93
95
  reject(new error_1.default(`Error while installing python${stackVersion.replace('_', '.')} runtime`, {
94
96
  original: err,
95
97
  exit: 2
@@ -168,6 +170,7 @@ function installRequirements(reqFile, pth, stackVersion, linuxMode = false) {
168
170
  errData.push(chunk);
169
171
  });
170
172
  child.on('error', (err) => {
173
+ (0, logger_1.info)(Buffer.concat(errData).toString());
171
174
  reject(new error_1.default('unable to process requirements.txt', {
172
175
  exit: 2,
173
176
  original: err
@@ -19,8 +19,8 @@ const userConfig_1 = __importDefault(require("../../../../userConfig"));
19
19
  const constants_1 = require("../../../../util_modules/constants");
20
20
  const project_1 = require("../../../../util_modules/project");
21
21
  const shell_1 = require("../../../../util_modules/shell");
22
+ const error_1 = __importDefault(require("../../../../error"));
22
23
  const logger_1 = require("../../../../util_modules/logger");
23
- const util_1 = require("util");
24
24
  exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
25
25
  var _a, _b;
26
26
  const projectRoot = runtime_store_1.default.get('project.root');
@@ -31,7 +31,8 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
31
31
  '-u',
32
32
  (0, path_1.join)(runtimesDir, constants_1.RUNTIME.language.python.value, `zcatalyst_runtime_${stackVersion === null || stackVersion === void 0 ? void 0 : stackVersion.replace('_', '')}`, 'main.py')
33
33
  ];
34
- return new Promise((res) => {
34
+ return new Promise((resolve, reject) => {
35
+ var _a;
35
36
  const child = (0, shell_1.spawn)(userConfig_1.default.get(`python${stackVersion}.bin`), opts, {
36
37
  cwd: targetSource === null || targetSource === void 0 ? void 0 : targetSource.replace(projectRoot, (0, path_1.join)(projectRoot, constants_1.FOLDERNAME.build)),
37
38
  stdio: 'pipe',
@@ -40,10 +41,17 @@ exports.default = (details) => __awaiter(void 0, void 0, void 0, function* () {
40
41
  child.on('spawn', () => __awaiter(void 0, void 0, void 0, function* () {
41
42
  yield (0, http_functions_1.checkIfRuntimeServerRunning)(details.httpPort.toString());
42
43
  }));
44
+ const errData = [];
45
+ (_a = child.stderr) === null || _a === void 0 ? void 0 : _a.on('data', (chunk) => {
46
+ errData.push(chunk);
47
+ });
43
48
  child.on('error', (err) => {
44
- (0, logger_1.debug)('Python Child spawn error');
45
- (0, logger_1.debug)((0, util_1.inspect)(err));
49
+ (0, logger_1.info)(Buffer.concat(errData).toString());
50
+ reject(new error_1.default(`Error while starting python runtime server`, {
51
+ original: err,
52
+ exit: 2
53
+ }));
46
54
  });
47
- res(child);
55
+ resolve(child);
48
56
  });
49
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
@@ -14,7 +14,7 @@ public class {{_CLASS_}} implements CatalystAdvancedIOHandler {
14
14
  try {
15
15
  switch(request.getRequestURI()) {
16
16
  case "/": {
17
- String name = (String) request.getParameter("name");
17
+ String name = request.getParameter("name");
18
18
  LOGGER.log(Level.INFO, "Hello "+name);
19
19
  response.setStatus(200);
20
20
  response.getWriter().write("Hello from {{_CLASS_}}.java");