zcatalyst-cli 1.9.1 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/README.md +3 -3
  2. package/docs/.DS_Store +0 -0
  3. package/docs/client-utils.toml +5 -0
  4. package/docs/command_needs/auth.toml +5 -0
  5. package/docs/commands/iac/export.toml +4 -0
  6. package/docs/commands/iac/import.toml +4 -0
  7. package/docs/commands/iac/status.toml +4 -0
  8. package/docs/commands/project/use.toml +6 -0
  9. package/docs/iac/status/bundle.toml +4 -0
  10. package/docs/plugin-loader.toml +4 -0
  11. package/docs/serve/server/index.toml +4 -0
  12. package/docs/serve/server/lib/web_client/server.toml +4 -0
  13. package/lib/api-timer.js +81 -0
  14. package/lib/apig-utils.js +17 -14
  15. package/lib/archiver.js +83 -45
  16. package/lib/authentication/login.js +4 -2
  17. package/lib/bin/catalyst.js +0 -1
  18. package/lib/client-utils.js +28 -26
  19. package/lib/client.js +0 -3
  20. package/lib/command_needs/auth.js +12 -3
  21. package/lib/command_needs/rc.js +12 -7
  22. package/lib/commands/apig/status.js +6 -4
  23. package/lib/commands/client/delete.js +3 -4
  24. package/lib/commands/client/setup.js +1 -1
  25. package/lib/commands/deploy.js +3 -1
  26. package/lib/commands/ds/export.js +3 -1
  27. package/lib/commands/ds/import.js +3 -1
  28. package/lib/commands/ds/status.js +145 -149
  29. package/lib/commands/event/generate/index.js +4 -13
  30. package/lib/commands/functions/config.js +1 -1
  31. package/lib/commands/functions/setup.js +1 -1
  32. package/lib/commands/help.js +1 -23
  33. package/lib/commands/iac/export.js +85 -0
  34. package/lib/commands/iac/import.js +210 -0
  35. package/lib/commands/iac/pack.js +129 -0
  36. package/lib/commands/iac/status.js +63 -0
  37. package/lib/commands/index.js +4 -0
  38. package/lib/commands/init.js +34 -27
  39. package/lib/commands/project/list.js +10 -6
  40. package/lib/commands/project/use.js +42 -25
  41. package/lib/commands/pull.js +1 -1
  42. package/lib/commands/serve.js +2 -1
  43. package/lib/deploy/features/functions/index.js +2 -1
  44. package/lib/deploy/index.js +3 -1
  45. package/lib/endpoints/lib/iac.js +134 -0
  46. package/lib/endpoints/lib/sdk.js +2 -2
  47. package/lib/error.js +33 -3
  48. package/lib/errorOut.js +4 -3
  49. package/lib/fn-utils/lib/common.js +37 -16
  50. package/lib/fn-utils/lib/java.js +7 -9
  51. package/lib/fn-utils/lib/node.js +7 -1
  52. package/lib/iac/status/bundle.js +82 -0
  53. package/lib/iac/status/deploy.js +74 -0
  54. package/lib/iac/status/util/index.js +26 -0
  55. package/lib/index.js +8 -14
  56. package/lib/init/dependencies/npm-install.js +2 -9
  57. package/lib/init/features/client/index.js +47 -0
  58. package/lib/init/features/client/initializers/angular.js +106 -0
  59. package/lib/init/features/client/initializers/basic.js +50 -0
  60. package/lib/init/features/client/initializers/lyte.js +61 -0
  61. package/lib/init/features/client/initializers/react.js +77 -0
  62. package/lib/init/features/functions/languages/java.js +2 -5
  63. package/lib/init/features/functions/languages/node.js +5 -6
  64. package/lib/init/features/index.js +18 -6
  65. package/lib/init/features/project.js +72 -34
  66. package/lib/init/util/client.js +96 -0
  67. package/lib/init/util/functions.js +20 -0
  68. package/lib/init/util/project.js +35 -0
  69. package/lib/internal/api.js +6 -9
  70. package/lib/internal/command.js +6 -3
  71. package/lib/internal/config.js +7 -4
  72. package/lib/migration/index.js +10 -6
  73. package/lib/option-filter.js +4 -1
  74. package/lib/optional-import.js +11 -25
  75. package/lib/plugin-loader.js +8 -2
  76. package/lib/port-resolver.js +20 -16
  77. package/lib/prompt/index.js +92 -0
  78. package/lib/prompt/types/file-path.js +95 -0
  79. package/lib/pull/features/client.js +1 -1
  80. package/lib/pull/features/functions/index.js +5 -7
  81. package/lib/pull/index.js +4 -1
  82. package/lib/serve/features/index.js +3 -1
  83. package/lib/serve/index.js +6 -1
  84. package/lib/serve/server/index.js +52 -8
  85. package/lib/serve/server/lib/master.js +24 -12
  86. package/lib/serve/server/lib/web_client/index.js +30 -0
  87. package/lib/serve/server/lib/web_client/server.js +171 -0
  88. package/lib/shell/dependencies/http-functions.js +1 -1
  89. package/lib/shell/index.js +3 -1
  90. package/lib/track.js +3 -1
  91. package/lib/util_modules/char.js +1 -1
  92. package/lib/util_modules/config/lib/apig.js +2 -1
  93. package/lib/util_modules/constants/index.js +5 -1
  94. package/lib/util_modules/constants/lib/file-names.js +2 -1
  95. package/lib/util_modules/constants/lib/iac.js +8 -0
  96. package/lib/util_modules/constants/lib/placeholders.js +1 -0
  97. package/lib/util_modules/constants/lib/plugin.js +28 -0
  98. package/lib/util_modules/constants/lib/regex.js +2 -1
  99. package/lib/util_modules/constants/lib/scopes.js +5 -0
  100. package/lib/util_modules/constants/lib/template.js +11 -1
  101. package/lib/util_modules/constants/lib/urls.js +12 -4
  102. package/lib/util_modules/constants/project.js +6 -0
  103. package/lib/util_modules/{contextHelp.js → context-help.js} +5 -1
  104. package/lib/util_modules/env.js +14 -16
  105. package/lib/util_modules/fs/lib/async.js +29 -22
  106. package/lib/util_modules/fs/utils.js +8 -0
  107. package/lib/util_modules/global-space.js +99 -0
  108. package/lib/util_modules/js.js +6 -0
  109. package/lib/util_modules/option.js +5 -1
  110. package/lib/util_modules/parser/toml.js +5 -1
  111. package/lib/util_modules/project.js +3 -0
  112. package/lib/util_modules/shell.js +9 -8
  113. package/lib/winston.js +1 -1
  114. package/package.json +11 -5
  115. package/templates/.DS_Store +0 -0
  116. package/templates/iacSuccess.html +391 -0
  117. package/templates/init/.DS_Store +0 -0
  118. package/templates/init/client/.DS_Store +0 -0
  119. package/templates/init/client/{client-package.json → basic/client-package.json} +0 -0
  120. package/templates/init/client/{index.html → basic/index.html} +0 -0
  121. package/templates/init/client/{main.css → basic/main.css} +0 -0
  122. package/templates/init/client/{main.js → basic/main.js} +0 -0
  123. package/templates/init/client/lyte/build/build.js +301 -0
  124. package/templates/init/client/lyte/build/scripts/cliDownloadScript.js +54 -0
  125. package/templates/init/client/lyte/client-package.json +5 -0
  126. package/templates/init/client/lyte/components/javascript/welcome-comp.js +13 -0
  127. package/templates/init/client/lyte/components/styles/welcome-comp.css +0 -0
  128. package/templates/init/client/lyte/components/templates/welcome-comp.html +8 -0
  129. package/templates/init/client/lyte/data-store/adapters/.gitkeep +0 -0
  130. package/templates/init/client/lyte/data-store/models/.gitkeep +0 -0
  131. package/templates/init/client/lyte/data-store/serializers/.gitkeep +0 -0
  132. package/templates/init/client/lyte/index.html +17 -0
  133. package/templates/init/client/lyte/package.json +12 -0
  134. package/templates/init/client/lyte/router.js +14 -0
  135. package/templates/init/client/lyte/routes/index.js +54 -0
  136. package/templates/init/client/react/.DS_Store +0 -0
  137. package/templates/init/client/react/react_js/package.json +11 -0
  138. package/templates/init/client/react/react_js/template/README.md +70 -0
  139. package/templates/init/client/react/react_js/template/client-package.json +5 -0
  140. package/templates/init/client/react/react_js/template/gitignore +23 -0
  141. package/templates/init/client/react/react_js/template/public/favicon.ico +0 -0
  142. package/templates/init/client/react/react_js/template/public/index.html +43 -0
  143. package/templates/init/client/react/react_js/template/public/logo192.png +0 -0
  144. package/templates/init/client/react/react_js/template/public/logo512.png +0 -0
  145. package/templates/init/client/react/react_js/template/public/manifest.json +25 -0
  146. package/templates/init/client/react/react_js/template/public/robots.txt +3 -0
  147. package/templates/init/client/react/react_js/template/src/App.css +38 -0
  148. package/templates/init/client/react/react_js/template/src/App.js +25 -0
  149. package/templates/init/client/react/react_js/template/src/App.test.js +8 -0
  150. package/templates/init/client/react/react_js/template/src/index.css +13 -0
  151. package/templates/init/client/react/react_js/template/src/index.js +17 -0
  152. package/templates/init/client/react/react_js/template/src/logo.svg +1 -0
  153. package/templates/init/client/react/react_js/template/src/reportWebVitals.js +13 -0
  154. package/templates/init/client/react/react_js/template/src/setupTests.js +5 -0
  155. package/templates/init/client/react/react_js/template.json +13 -0
  156. package/templates/init/client/react/react_ts/package.json +11 -0
  157. package/templates/init/client/react/react_ts/template/README.md +46 -0
  158. package/templates/init/client/react/react_ts/template/client-package.json +5 -0
  159. package/templates/init/client/react/react_ts/template/gitignore +23 -0
  160. package/templates/init/client/react/react_ts/template/public/favicon.ico +0 -0
  161. package/templates/init/client/react/react_ts/template/public/index.html +43 -0
  162. package/templates/init/client/react/react_ts/template/public/logo192.png +0 -0
  163. package/templates/init/client/react/react_ts/template/public/logo512.png +0 -0
  164. package/templates/init/client/react/react_ts/template/public/manifest.json +25 -0
  165. package/templates/init/client/react/react_ts/template/public/robots.txt +3 -0
  166. package/templates/init/client/react/react_ts/template/src/App.css +38 -0
  167. package/templates/init/client/react/react_ts/template/src/App.test.tsx +9 -0
  168. package/templates/init/client/react/react_ts/template/src/App.tsx +26 -0
  169. package/templates/init/client/react/react_ts/template/src/index.css +13 -0
  170. package/templates/init/client/react/react_ts/template/src/index.tsx +17 -0
  171. package/templates/init/client/react/react_ts/template/src/logo.svg +1 -0
  172. package/templates/init/client/react/react_ts/template/src/reportWebVitals.ts +15 -0
  173. package/templates/init/client/react/react_ts/template/src/setupTests.ts +5 -0
  174. package/templates/init/client/react/react_ts/template.json +18 -0
  175. package/templates/init/functions/java/integ/cliq/com/handlers/BotHandler.java +94 -109
  176. package/templates/init/functions/java/integ/cliq/com/handlers/CommandHandler.java +20 -27
  177. package/templates/init/functions/java/integ/cliq/com/handlers/FunctionHandler.java +143 -112
  178. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationHandler.java +4 -7
  179. package/templates/init/functions/java/integ/cliq/com/handlers/InstallationValidator.java +4 -7
  180. package/templates/init/functions/java/integ/cliq/com/handlers/MessageActionHandler.java +10 -12
  181. package/templates/init/functions/java/integ/cliq/com/handlers/WidgetHandler.java +100 -66
  182. package/templates/init/functions/java/integ/cliq/sample.java +5 -7
  183. package/templates/init/functions/node/integ/cliq/handlers/command-handler.js +0 -1
  184. package/templates/init/functions/node/integ/cliq/handlers/function-handler.js +46 -0
  185. package/templates/init/functions/node/integ/cliq/handlers/widget-handler.js +31 -0
  186. package/templates/web-socket.txt +21 -0
  187. package/lib/init/features/client.js +0 -51
  188. package/lib/prompt.js +0 -49
  189. package/lib/serve/server/lib/client.js +0 -30
@@ -0,0 +1,82 @@
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
+ const iac_1 = __importDefault(require("../../endpoints/lib/iac"));
16
+ const api_timer_1 = __importDefault(require("../../api-timer"));
17
+ const error_1 = __importDefault(require("../../error"));
18
+ const throbber_1 = __importDefault(require("../../throbber"));
19
+ const logger_1 = require("../../util_modules/logger");
20
+ const util_1 = require("./util");
21
+ const prompt_1 = __importDefault(require("../../prompt"));
22
+ const fs_1 = require("../../util_modules/fs");
23
+ const path_1 = require("path");
24
+ const option_1 = require("../../util_modules/option");
25
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
26
+ const env = option_1.getOptionValue('production', false) ? 'Production' : 'Development';
27
+ const getSpinnerTxt = util_1.getSpinnerTxt('bundle');
28
+ const iacAPI = new iac_1.default(undefined, { env });
29
+ const bundleStatus = yield iacAPI.bundleStatus();
30
+ if (bundleStatus === undefined) {
31
+ throw new error_1.default('No export project available in server.', {
32
+ exit: 1,
33
+ errorId: 'B-1'
34
+ });
35
+ }
36
+ const throbber = throbber_1.default.getInstance();
37
+ const spinner = bundleStatus.id;
38
+ throbber.add(spinner, {
39
+ text: getSpinnerTxt(bundleStatus)
40
+ });
41
+ const timerAPI = new api_timer_1.default(iacAPI.bundleStatus.bind(iacAPI), 2000, 1);
42
+ timerAPI.on('data', (data) => __awaiter(void 0, void 0, void 0, function* () {
43
+ switch (data.status) {
44
+ case 'Scheduled':
45
+ case 'Processing':
46
+ throbber.update(spinner, {
47
+ text: getSpinnerTxt(data) + '\nPress CTRL + C to exit listening to the status'
48
+ });
49
+ break;
50
+ case 'Error_Processing':
51
+ throbber.fail(spinner, {
52
+ text: getSpinnerTxt(data, 'failed')
53
+ });
54
+ timerAPI.end();
55
+ break;
56
+ case 'Completed':
57
+ throbber.succeed(spinner, {
58
+ text: getSpinnerTxt(data)
59
+ });
60
+ timerAPI.end(undefined, true);
61
+ break;
62
+ default:
63
+ logger_1.debug('Unknown status received : ', data.status);
64
+ timerAPI.end();
65
+ }
66
+ }));
67
+ timerAPI.on('error', (e) => {
68
+ logger_1.debug('Error encounted :', e);
69
+ });
70
+ timerAPI.on('end', () => throbber.stopAll());
71
+ timerAPI.start();
72
+ const isCompleted = yield timerAPI.waitForEnd();
73
+ if (isCompleted) {
74
+ const ans = yield prompt_1.default.ask(prompt_1.default.question('download', 'Would you like to download the export zip of this job to your cmd execution directory?', { type: 'confirm', defaultAns: true }));
75
+ if (ans.download) {
76
+ const hrTime = process.hrtime();
77
+ const fileName = `export_${bundleStatus.id}_${hrTime[0] * 1000000000 + hrTime[1]}.zip`;
78
+ const bundlezip = yield iacAPI.bundleDownload();
79
+ return fs_1.ASYNC.writeFile(path_1.join(process.cwd(), fileName), bundlezip);
80
+ }
81
+ }
82
+ });
@@ -0,0 +1,74 @@
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
+ const iac_1 = __importDefault(require("../../endpoints/lib/iac"));
16
+ const api_timer_1 = __importDefault(require("../../api-timer"));
17
+ const option_1 = require("../../util_modules/option");
18
+ const error_1 = __importDefault(require("../../error"));
19
+ const throbber_1 = __importDefault(require("../../throbber"));
20
+ const logger_1 = require("../../util_modules/logger");
21
+ const util_1 = require("./util");
22
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
23
+ const getSpinnerTxt = util_1.getSpinnerTxt('deploy');
24
+ const idOpt = option_1.getOptionValue('id', false);
25
+ const iacAPI = new iac_1.default();
26
+ const allDeploys = yield iacAPI.allDeploys();
27
+ if (allDeploys.length <= 0) {
28
+ throw new error_1.default('No import projects available in server.');
29
+ }
30
+ const neededDeploys = allDeploys.filter((deploy) => deploy.id === idOpt || deploy.status === 'Scheduled');
31
+ if (neededDeploys.length <= 0) {
32
+ throw new error_1.default(idOpt
33
+ ? 'No import projects with given id exists.'
34
+ : 'No import projects currently scheduled.');
35
+ }
36
+ const deployDetails = neededDeploys[0];
37
+ const throbber = throbber_1.default.getInstance();
38
+ const spinner = deployDetails.id;
39
+ throbber.add(spinner, {
40
+ text: getSpinnerTxt(deployDetails)
41
+ });
42
+ const timerAPI = new api_timer_1.default(iacAPI.deployStatus.bind(iacAPI, deployDetails.id), 2000, 1);
43
+ timerAPI.on('data', (data) => __awaiter(void 0, void 0, void 0, function* () {
44
+ switch (data.status) {
45
+ case 'Scheduled':
46
+ case 'Processing':
47
+ throbber.update(spinner, {
48
+ text: getSpinnerTxt(data) + '\nPress CTRL + C to exit listening to the status'
49
+ });
50
+ break;
51
+ case 'Error_Processing':
52
+ throbber.fail(spinner, {
53
+ text: getSpinnerTxt(data, 'failed')
54
+ });
55
+ timerAPI.end();
56
+ break;
57
+ case 'Completed':
58
+ throbber.succeed(spinner, {
59
+ text: getSpinnerTxt(data)
60
+ });
61
+ timerAPI.end(undefined, true);
62
+ break;
63
+ default:
64
+ logger_1.debug('Unknown status received : ', data.status);
65
+ timerAPI.end();
66
+ }
67
+ }));
68
+ timerAPI.on('error', (e) => {
69
+ logger_1.debug('Error encounted : ', e);
70
+ });
71
+ timerAPI.on('end', () => throbber.stopAll());
72
+ timerAPI.start();
73
+ yield timerAPI.waitForEnd();
74
+ });
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSpinnerTxt = void 0;
4
+ const getSpinnerTxt = (type) => (deployDetails, status) => {
5
+ var _a, _b;
6
+ const logs = [];
7
+ const processError = (_a = deployDetails.logs) === null || _a === void 0 ? void 0 : _a.processing_errors;
8
+ const validationError = (_b = deployDetails.logs) === null || _b === void 0 ? void 0 : _b.validation_errors;
9
+ if (processError) {
10
+ if (typeof processError === 'string') {
11
+ logs.push(`Error Message: ${processError}`);
12
+ }
13
+ else {
14
+ logs.push(`Error while processing "${processError.component}"`, `Error Message: ${processError.error_message}`);
15
+ }
16
+ }
17
+ if (validationError) {
18
+ logs.push('Error while validating : ');
19
+ logs.push(...validationError);
20
+ }
21
+ return [
22
+ `${type === 'bundle' ? 'Export' : 'Import'} Project "${deployDetails.project_details.project_name}" ${status ? status : deployDetails.status.toLowerCase()}`,
23
+ ...logs
24
+ ].join('\n' + ' '.repeat(status ? 2 : 4));
25
+ };
26
+ exports.getSpinnerTxt = getSpinnerTxt;
package/lib/index.js CHANGED
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const ansi_colors_1 = require("ansi-colors");
7
6
  const commander_1 = require("commander");
8
- const meant_1 = __importDefault(require("meant"));
9
7
  const client_1 = require("./client");
10
8
  const runtime_store_1 = __importDefault(require("./runtime-store"));
9
+ const fs_1 = require("./util_modules/fs");
10
+ const constants_1 = require("./util_modules/constants");
11
+ const ansi_colors_1 = require("ansi-colors");
11
12
  const packageJson = runtime_store_1.default.get('context.cli.package');
12
13
  const { description, version } = packageJson;
13
14
  const program = new commander_1.Command();
@@ -17,17 +18,10 @@ program.option('-p, --project <name|project_id>', 'Specify the Catalyst project
17
18
  program.option('--token <token>', 'Supply an authentication token for a command');
18
19
  program.option('--dc <us|eu|in>', 'Supply a data center for a command');
19
20
  program.option('--verbose', 'Change the log level to verbose for debugging purposes');
21
+ program.helpOption('-h, --help', 'Display help for a Catalyst command');
22
+ program.showSuggestionAfterError();
23
+ program.showHelpAfterError(`For more usage information use the ${ansi_colors_1.bold('catalyst help')} command`);
24
+ program.addHelpText('before', fs_1.SYNC.readFile(constants_1.TEMPLATE.banner, 'utf-8') || '');
25
+ program.addHelpText('afterAll', `\nFor detailed documentations please visit ${ansi_colors_1.underline('https://www.zoho.com/catalyst/help/cli-command-reference.html')}`);
20
26
  const cli = new client_1.Client(program);
21
- cli.onUnknownCommand((_OPTS, cmd) => {
22
- const commandNames = cli.getAllCommandNames();
23
- console.error();
24
- console.error('"' + ansi_colors_1.bold(cmd.args.join(' ')) + '" is not a catalyst command');
25
- let suggestion = meant_1.default(cmd.args.join(' '), commandNames);
26
- suggestion = suggestion || meant_1.default(cmd.args.join(':'), commandNames);
27
- if (suggestion && suggestion.length) {
28
- console.error('Did you mean ' + ansi_colors_1.bold(suggestion.join(', ')) + ' ?');
29
- }
30
- console.error();
31
- process.exit(1);
32
- });
33
27
  exports.default = cli;
@@ -13,19 +13,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const prompt_1 = __importDefault(require("../../prompt"));
16
- const runtime_store_1 = __importDefault(require("../../runtime-store"));
17
- const constants_1 = require("../../util_modules/constants");
18
16
  const shell_1 = require("../../util_modules/shell");
19
- exports.default = (pth) => __awaiter(void 0, void 0, void 0, function* () {
17
+ exports.default = (pth, skipPrompt = false) => __awaiter(void 0, void 0, void 0, function* () {
20
18
  const ans = yield prompt_1.default.ask(prompt_1.default.question('NPMinstall', 'Do you wish to install all dependencies now ? ', {
21
19
  type: 'confirm',
22
20
  defaultAns: true,
23
- when: () => {
24
- if (runtime_store_1.default.get('context.functions.type') === constants_1.FN_TYPE.integration) {
25
- return false;
26
- }
27
- return true;
28
- }
21
+ when: () => !skipPrompt
29
22
  }));
30
23
  if (ans.NPMinstall === undefined || ans.NPMinstall) {
31
24
  return shell_1.spawn('npm', ['install'], { cwd: pth }).ASYNC();
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ const index_js_1 = __importDefault(require("../../../prompt/index.js"));
35
+ const index_js_2 = require("../../../util_modules/constants/index.js");
36
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
37
+ const clientInitAnswer = yield index_js_1.default.ask(index_js_1.default.question('clientFlavour', 'Choose the type of client to initialise: ', {
38
+ type: 'list',
39
+ choices: index_js_2.PLUGIN.client.map((plugin) => {
40
+ return index_js_1.default.choice(plugin + ' web app', {
41
+ value: plugin.toLowerCase(),
42
+ short: plugin.toUpperCase()
43
+ });
44
+ })
45
+ }));
46
+ return (yield Promise.resolve().then(() => __importStar(require('./initializers/' + clientInitAnswer.clientFlavour)))).default();
47
+ });
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ const file_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/file-names.js"));
35
+ const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
36
+ const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
37
+ const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
38
+ const project_js_1 = require("../../../../util_modules/project.js");
39
+ const shell_js_1 = require("../../../../util_modules/shell.js");
40
+ const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js"));
41
+ const logger_js_1 = require("../../../../util_modules/logger.js");
42
+ const ansi_colors_1 = require("ansi-colors");
43
+ const client_js_1 = require("../../../util/client.js");
44
+ const path_1 = require("path");
45
+ const global_space_js_1 = __importDefault(require("../../../../util_modules/global-space.js"));
46
+ const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
47
+ const error_js_1 = __importDefault(require("../../../../error.js"));
48
+ const { angular } = plugin_js_1.default;
49
+ const { client } = placeholders_js_1.default;
50
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
51
+ const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your Angular App:', 'angular-app');
52
+ const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
53
+ yield client_js_1.directoryOverridePrompt(clientDirPath);
54
+ const opts = [
55
+ angular.runner_command[1],
56
+ clientName,
57
+ '--directory',
58
+ folder_names_js_1.default.client,
59
+ '--skip-git',
60
+ 'true'
61
+ ];
62
+ const isModuleFound = (yield global_space_js_1.default(angular.plugin, false));
63
+ try {
64
+ const collection = require.resolve(path_1.join(angular.collection_name, 'package.json'));
65
+ yield shell_js_1.spawn(angular.runner_command[0], [...opts, '--collection', path_1.dirname(collection)], {
66
+ stdio: 'inherit',
67
+ cwd: runtime_store_js_1.default.get('cwd'),
68
+ env: {
69
+ CATALYST_ANGULAR_PLUGIN_GLOBAL: isModuleFound ? 'true' : 'false'
70
+ }
71
+ }).ASYNC();
72
+ }
73
+ catch (e) {
74
+ if (e === null) {
75
+ throw new error_js_1.default('Process aborted!', { exit: 0, skipHelp: true });
76
+ }
77
+ const err = error_js_1.default.getErrorInstance(e).original;
78
+ if (!err.code || err.code !== 'ENOENT') {
79
+ throw err;
80
+ }
81
+ logger_js_1.info(`Angular CLI (${ansi_colors_1.red.italic('@angular/cli')}) not found....`);
82
+ logger_js_1.info(`Installing ${ansi_colors_1.bold('@angular/cli')} using ${ansi_colors_1.bold('npx')}`);
83
+ logger_js_1.info('Note: this may take a while...');
84
+ yield shell_js_1.spawn('npx', [
85
+ '-p',
86
+ angular.collection_name,
87
+ '-p',
88
+ angular.runner_package,
89
+ angular.runner_command[0],
90
+ ...opts,
91
+ '--collection',
92
+ angular.collection_name
93
+ ], {
94
+ stdio: 'inherit',
95
+ cwd: runtime_store_js_1.default.get('cwd'),
96
+ env: {
97
+ CATALYST_ANGULAR_PLUGIN_GLOBAL: isModuleFound ? 'true' : 'false'
98
+ }
99
+ }).ASYNC();
100
+ }
101
+ yield ASYNC.findAndReplace(path_1.join(clientDirPath, file_names_js_1.default.client.package_json))(client.package.name, clientName);
102
+ runtime_store_js_1.default.set('payload.client.plugin', isModuleFound
103
+ ? angular.plugin
104
+ : path_1.relative(project_js_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', angular.plugin)));
105
+ return client_js_1.fillClientInitPayload(clientDirPath, clientName);
106
+ });
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ const ansi_colors_1 = require("ansi-colors");
35
+ const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
36
+ const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
37
+ const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
38
+ const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
39
+ const logger_js_1 = require("../../../../util_modules/logger.js");
40
+ const project_js_1 = require("../../../../util_modules/project.js");
41
+ const client_js_1 = require("../../../util/client.js");
42
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
43
+ logger_js_1.message('A directory ' + ansi_colors_1.cyan.bold('client') + ' will be created with a webapp pre-configured.');
44
+ const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
45
+ yield client_js_1.directoryOverridePrompt(clientDirPath);
46
+ yield ASYNC.copyDir(template_js_1.default.client.basic.new, clientDirPath);
47
+ const clientName = yield client_js_1.clientNamePrompt('How do you want to address the client ?', 'sampleApp');
48
+ yield ASYNC.findAndReplace(clientDirPath)(placeholders_js_1.default.client.package.name, clientName);
49
+ return client_js_1.fillClientInitPayload(clientDirPath, clientName);
50
+ });
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ const path_1 = require("path");
35
+ const client_js_1 = require("../../../util/client.js");
36
+ const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js"));
37
+ const npm_install_js_1 = __importDefault(require("../../../dependencies/npm-install.js"));
38
+ const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
39
+ const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
40
+ const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
41
+ const folder_names_js_1 = __importDefault(require("../../../../util_modules/constants/lib/folder-names.js"));
42
+ const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
43
+ const project_js_1 = require("../../../../util_modules/project.js");
44
+ const global_space_js_1 = __importDefault(require("../../../../util_modules/global-space.js"));
45
+ const { lyte } = plugin_js_1.default;
46
+ const { client } = placeholders_js_1.default;
47
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
48
+ const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your Lyte web app: ', 'lyte-app');
49
+ const clientDirPath = project_js_1.resolveProjectPath(folder_names_js_1.default.client);
50
+ yield client_js_1.directoryOverridePrompt(clientDirPath);
51
+ yield ASYNC.copyDir(template_js_1.default.client.lyte, clientDirPath);
52
+ const isModuleFound = yield global_space_js_1.default(lyte.plugin);
53
+ !isModuleFound &&
54
+ (yield client_js_1.addDevDep(path_1.join(clientDirPath, 'package.json'), { [lyte.plugin]: 'latest' }));
55
+ yield ASYNC.findAndReplace(clientDirPath)(client.package.name, clientName);
56
+ yield npm_install_js_1.default(clientDirPath, true);
57
+ runtime_store_js_1.default.set('payload.client.plugin', isModuleFound
58
+ ? lyte.plugin
59
+ : path_1.relative(project_js_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', lyte.plugin)));
60
+ return client_js_1.fillClientInitPayload(clientDirPath, clientName);
61
+ });
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ const project_js_1 = require("../../../../util_modules/project.js");
35
+ const shell_js_1 = require("../../../../util_modules/shell.js");
36
+ const runtime_store_js_1 = __importDefault(require("../../../../runtime-store.js"));
37
+ const ASYNC = __importStar(require("../../../../util_modules/fs/lib/async.js"));
38
+ const path_1 = require("path");
39
+ const os_1 = require("os");
40
+ const global_space_js_1 = __importDefault(require("../../../../util_modules/global-space.js"));
41
+ const index_js_1 = __importDefault(require("../../../../prompt/index.js"));
42
+ const client_js_1 = require("../../../util/client.js");
43
+ const plugin_js_1 = __importDefault(require("../../../../util_modules/constants/lib/plugin.js"));
44
+ const template_js_1 = __importDefault(require("../../../../util_modules/constants/lib/template.js"));
45
+ const placeholders_js_1 = __importDefault(require("../../../../util_modules/constants/lib/placeholders.js"));
46
+ const { react } = plugin_js_1.default;
47
+ const { client } = placeholders_js_1.default;
48
+ exports.default = () => __awaiter(void 0, void 0, void 0, function* () {
49
+ const flavourPrompt = yield index_js_1.default.ask(index_js_1.default.question('flavour', `Choose an option to create the React App:`, {
50
+ type: 'list',
51
+ choices: [
52
+ index_js_1.default.choice('JavaScript', { value: 'js', short: 'JavaScript' }),
53
+ index_js_1.default.choice('TypeScript', { value: 'ts', short: 'TypeScript' })
54
+ ]
55
+ }));
56
+ const clientName = yield client_js_1.clientNamePrompt('Please provide a name for your React App:', 'react-app');
57
+ const clientDirPath = project_js_1.resolveProjectPath(clientName);
58
+ yield client_js_1.directoryOverridePrompt(clientDirPath);
59
+ const catalystTempDir = path_1.join(os_1.tmpdir(), '.catalyst');
60
+ const reactPluginDir = path_1.join(catalystTempDir, 'react');
61
+ yield ASYNC.emptyDir(reactPluginDir);
62
+ yield ASYNC.copyDir(flavourPrompt.flavour === 'ts' ? template_js_1.default.client.react.ts : template_js_1.default.client.react.js, reactPluginDir);
63
+ const isModuleFound = yield global_space_js_1.default(react.plugin);
64
+ !isModuleFound &&
65
+ (yield client_js_1.addDevDep(path_1.join(reactPluginDir, 'template.json'), { [react.plugin]: 'latest' }, [
66
+ 'package'
67
+ ]));
68
+ yield ASYNC.findAndReplace(reactPluginDir)(client.package.name, clientName);
69
+ yield shell_js_1.spawn('npx', [react.runner_command[0], clientName, '--template', 'file:' + reactPluginDir], {
70
+ stdio: 'inherit',
71
+ cwd: runtime_store_js_1.default.get('cwd')
72
+ }).ASYNC();
73
+ runtime_store_js_1.default.set('payload.client.plugin', isModuleFound
74
+ ? react.plugin
75
+ : path_1.relative(project_js_1.getProjectRoot(), path_1.join(clientDirPath, 'node_modules', react.plugin)));
76
+ return client_js_1.fillClientInitPayload(clientDirPath, clientName);
77
+ });
@@ -24,6 +24,7 @@ const js_1 = require("../../../../util_modules/js");
24
24
  const integ_1 = require("../../../../fn-utils/lib/integ");
25
25
  const common_1 = require("../../../../fn-utils/lib/common");
26
26
  const runtime_1 = __importDefault(require("../../../../util_modules/constants/lib/runtime"));
27
+ const functions_1 = require("../../../util/functions");
27
28
  exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
28
29
  const fnType = runtime_store_1.default.get('context.functions.type');
29
30
  const fnDirPath = path_1.join(runtime_store_1.default.get('context.functions.dir_path'));
@@ -85,9 +86,5 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
85
86
  const userFnClassPath = path_1.join(fnDirPath, functionAns.name, constants_1.FILENAME.functions.java_classpath);
86
87
  const userFnLibPath = path_1.join(fnDirPath, functionAns.name, constants_1.FOLDERNAME.java_fn_lib);
87
88
  yield fn_utils_1.fnUtils.java.rewriteClasspath(userFnClassPath, userFnLibPath);
88
- runtime_store_1.default.set('payload.functions.source', targetPath);
89
- runtime_store_1.default.set('payload.functions.stack', stack);
90
- runtime_store_1.default.set('payload.functions.name', functionAns.name);
91
- runtime_store_1.default.set('payload.functions.class', functionAns.class);
92
- runtime_store_1.default.set('payload.functions.type', fnType);
89
+ return functions_1.fillFunctionsInitPayload(targetPath, functionAns.name, stack, fnType);
93
90
  });
@@ -25,6 +25,7 @@ const logger_1 = require("../../../../util_modules/logger");
25
25
  const js_1 = require("../../../../util_modules/js");
26
26
  const integ_1 = require("../../../../fn-utils/lib/integ");
27
27
  const runtime_1 = __importDefault(require("../../../../util_modules/constants/lib/runtime"));
28
+ const functions_1 = require("../../../util/functions");
28
29
  exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* () {
29
30
  const fnType = runtime_store_1.default.get('context.functions.type');
30
31
  const service = runtime_store_1.default.get('context.functions.integration.service', '');
@@ -69,10 +70,8 @@ exports.default = (stack) => () => __awaiter(void 0, void 0, void 0, function* (
69
70
  type: fnType,
70
71
  integ_config
71
72
  });
72
- yield npm_install_1.default(targetPath);
73
- runtime_store_1.default.set('payload.functions.source', targetPath);
74
- runtime_store_1.default.set('payload.functions.stack', stack);
75
- runtime_store_1.default.set('payload.functions.name', finalJson.name);
76
- runtime_store_1.default.set('payload.functions.main', finalJson.main);
77
- runtime_store_1.default.set('payload.functions.type', fnType);
73
+ fnType === constants_1.FN_TYPE.integration
74
+ ? yield npm_install_1.default(targetPath, true)
75
+ : yield npm_install_1.default(targetPath);
76
+ return functions_1.fillFunctionsInitPayload(targetPath, finalJson.name, stack, fnType);
78
77
  });