@botonic/nx-plugin 2.31.0 → 2.32.0-alpha.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.
Files changed (78) hide show
  1. package/migrations.json +1 -8
  2. package/package.json +7 -4
  3. package/src/executors/build-node-app/executor-impl.d.ts +5 -0
  4. package/src/executors/build-node-app/executor-impl.js +65 -0
  5. package/src/executors/build-node-app/executor.d.ts +4 -2
  6. package/src/executors/build-node-app/executor.js +3 -41
  7. package/src/executors/delete-bot/executor-impl.d.ts +5 -0
  8. package/src/executors/delete-bot/executor-impl.js +110 -0
  9. package/src/executors/delete-bot/executor.d.ts +4 -2
  10. package/src/executors/delete-bot/executor.js +3 -86
  11. package/src/executors/deploy-netlify-snapshot/executor-impl.d.ts +8 -0
  12. package/src/executors/deploy-netlify-snapshot/executor-impl.js +79 -0
  13. package/src/executors/deploy-netlify-snapshot/executor.d.ts +4 -5
  14. package/src/executors/deploy-netlify-snapshot/executor.js +3 -55
  15. package/src/executors/deploy-to-hubtype/executor-impl.d.ts +5 -0
  16. package/src/executors/deploy-to-hubtype/executor-impl.js +172 -0
  17. package/src/executors/deploy-to-hubtype/executor.d.ts +4 -2
  18. package/src/executors/deploy-to-hubtype/executor.js +3 -148
  19. package/src/executors/e2e-webchat/executor-impl.d.ts +5 -0
  20. package/src/executors/e2e-webchat/executor-impl.js +134 -0
  21. package/src/executors/e2e-webchat/executor.d.ts +4 -2
  22. package/src/executors/e2e-webchat/executor.js +4 -111
  23. package/src/executors/integrate-provider/executor-impl.d.ts +5 -0
  24. package/src/executors/integrate-provider/executor-impl.js +153 -0
  25. package/src/executors/integrate-provider/executor.d.ts +4 -2
  26. package/src/executors/integrate-provider/executor.js +3 -129
  27. package/src/executors/login-to-hubtype/executor-impl.d.ts +5 -0
  28. package/src/executors/login-to-hubtype/executor-impl.js +77 -0
  29. package/src/executors/login-to-hubtype/executor.d.ts +4 -2
  30. package/src/executors/login-to-hubtype/executor.js +3 -53
  31. package/src/executors/logout-from-hubtype/executor-impl.d.ts +3 -0
  32. package/src/executors/logout-from-hubtype/executor-impl.js +54 -0
  33. package/src/executors/logout-from-hubtype/executor.d.ts +5 -1
  34. package/src/executors/logout-from-hubtype/executor.js +3 -30
  35. package/src/executors/run-lambda/executor-impl.d.ts +5 -0
  36. package/src/executors/run-lambda/executor-impl.js +65 -0
  37. package/src/executors/run-lambda/executor.d.ts +4 -2
  38. package/src/executors/run-lambda/executor.js +3 -41
  39. package/src/executors/serve-bot/executor-impl.d.ts +5 -0
  40. package/src/executors/serve-bot/executor-impl.js +530 -0
  41. package/src/executors/serve-bot/executor.d.ts +4 -2
  42. package/src/executors/serve-bot/executor.js +3 -506
  43. package/src/generators/action/generator-impl.d.ts +4 -0
  44. package/src/generators/action/generator-impl.js +112 -0
  45. package/src/generators/action/generator.d.ts +2 -3
  46. package/src/generators/action/generator.js +2 -87
  47. package/src/generators/bot-app/files/vite/webchat.config.ts.template +10 -2
  48. package/src/generators/bot-app/generator-impl.d.ts +4 -0
  49. package/src/generators/bot-app/generator-impl.js +328 -0
  50. package/src/generators/bot-app/generator.d.ts +2 -4
  51. package/src/generators/bot-app/generator.js +2 -295
  52. package/src/generators/custom-message/generator-impl.d.ts +4 -0
  53. package/src/generators/custom-message/generator-impl.js +235 -0
  54. package/src/generators/custom-message/generator.d.ts +2 -3
  55. package/src/generators/custom-message/generator.js +2 -210
  56. package/src/generators/preset/generator-impl.d.ts +4 -0
  57. package/src/generators/preset/generator-impl.js +127 -0
  58. package/src/generators/preset/generator.d.ts +2 -4
  59. package/src/generators/preset/generator.js +2 -95
  60. package/src/generators/remove-custom-message/generator-impl.d.ts +4 -0
  61. package/src/generators/remove-custom-message/generator-impl.js +259 -0
  62. package/src/generators/remove-custom-message/generator.d.ts +2 -3
  63. package/src/generators/remove-custom-message/generator.js +2 -234
  64. package/src/generators/webview/generator-impl.d.ts +4 -0
  65. package/src/generators/webview/generator-impl.js +179 -0
  66. package/src/generators/webview/generator.d.ts +2 -3
  67. package/src/generators/webview/generator.js +2 -154
  68. package/src/index.d.ts +1 -0
  69. package/src/index.js +3 -1
  70. package/src/lib/delegate/delegate-executor.d.ts +6 -0
  71. package/src/lib/delegate/delegate-executor.js +119 -0
  72. package/src/lib/delegate/delegate-generator.d.ts +2 -0
  73. package/src/lib/delegate/delegate-generator.js +128 -0
  74. package/src/lib/serve-mode/index.d.ts +25 -0
  75. package/src/lib/serve-mode/index.js +183 -0
  76. package/src/generators/bot-app/files/vite/plugins/dev-log-viewer-html.plugin.ts.template +0 -65
  77. package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.d.ts +0 -2
  78. package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.js +0 -290
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var executor_impl_exports = {};
20
+ __export(executor_impl_exports, {
21
+ default: () => deployToHubtypeExecutor
22
+ });
23
+ module.exports = __toCommonJS(executor_impl_exports);
24
+ var import_enquirer = require("enquirer");
25
+ var import_api_service = require("../../lib/api-service");
26
+ var import_executor_helpers = require("../../lib/util/executor-helpers");
27
+ const CREATE_PROD_CHOICE = "Create Production Bot";
28
+ function botLabel(bot) {
29
+ return bot.is_test ? `${bot.name} (Staging bot)` : `${bot.name} (Production bot)`;
30
+ }
31
+ let PROJECT_ROOT;
32
+ async function deployToHubtypeExecutor(options, context) {
33
+ if (!context.projectName) {
34
+ throw new Error("Project name is not defined in executor context");
35
+ }
36
+ PROJECT_ROOT = (0, import_executor_helpers.resolveProjectPath)(context);
37
+ try {
38
+ const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
39
+ const botonicApiService = new import_api_service.BotonicAPIService({
40
+ projectRoot: PROJECT_ROOT,
41
+ environmentVariables,
42
+ targetEnvironment
43
+ });
44
+ const botName = options.botName;
45
+ if (!botonicApiService.oauth) {
46
+ if (options.email && options.password) {
47
+ await botonicApiService.login(options.email, options.password);
48
+ botonicApiService.saveAllCredentials();
49
+ } else {
50
+ await (0, import_executor_helpers.handleAuthentication)(botonicApiService);
51
+ }
52
+ }
53
+ await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
54
+ console.log(
55
+ `\u{1F680} Deploying to Hubtype... [${environmentVariables["VITE_HUBTYPE_API_URL"]}]
56
+ `
57
+ );
58
+ if (botName) {
59
+ await handleBotFromFlag(
60
+ botonicApiService,
61
+ botName,
62
+ options.createIfNotExists
63
+ );
64
+ } else {
65
+ await handleBotFlow(botonicApiService);
66
+ }
67
+ await (0, import_executor_helpers.deployBotToHubtype)(
68
+ botonicApiService,
69
+ PROJECT_ROOT,
70
+ context.projectName
71
+ );
72
+ return { success: true };
73
+ } catch (error) {
74
+ return (0, import_executor_helpers.handleExecutorError)(error, "Deployment");
75
+ }
76
+ }
77
+ async function handleBotFromFlag(botonicApiService, botName, createIfNotExists) {
78
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
79
+ const bot = bots.find((b) => b.name === botName);
80
+ if (bot) {
81
+ botonicApiService.setCurrentBot(bot);
82
+ } else {
83
+ if (createIfNotExists) {
84
+ console.log(
85
+ `\u{1F916} Bot "${botName}" doesn't exist. Creating it automatically...`
86
+ );
87
+ await createNewBot(botonicApiService, botName);
88
+ } else {
89
+ const response = await (0, import_enquirer.prompt)({
90
+ type: "confirm",
91
+ name: "create_bot_confirm",
92
+ message: `\u{1F916} Bot "${botName}" doesn't exist. Do you want to create it?`
93
+ });
94
+ if (response.create_bot_confirm) {
95
+ await createNewBot(botonicApiService, botName);
96
+ } else {
97
+ throw new Error(`Bot "${botName}" not found`);
98
+ }
99
+ }
100
+ }
101
+ }
102
+ async function handleBotFlow(botonicApiService) {
103
+ if (!botonicApiService.bot || !Object.keys(botonicApiService.bot).length) {
104
+ await newBotFlow(botonicApiService);
105
+ } else {
106
+ const resp = await botonicApiService.getBots();
107
+ const bots = resp.data.results;
108
+ const firstId = botonicApiService.bot.id;
109
+ bots.sort(
110
+ (x, y) => x.id === firstId ? -1 : y.id === firstId ? 1 : 0
111
+ );
112
+ await selectExistentBot(botonicApiService, bots);
113
+ }
114
+ }
115
+ async function newBotFlow(botonicApiService) {
116
+ const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
117
+ if (!bots.length) {
118
+ await createNewBot(botonicApiService);
119
+ } else {
120
+ const response = await (0, import_enquirer.prompt)({
121
+ type: "confirm",
122
+ name: "create_bot_confirm",
123
+ message: "\u{1F916} Do you want to create a new bot?"
124
+ });
125
+ if (response.create_bot_confirm) {
126
+ await createNewBot(botonicApiService);
127
+ } else {
128
+ await selectExistentBot(botonicApiService, bots);
129
+ }
130
+ }
131
+ }
132
+ async function createNewBot(botonicApiService, botName) {
133
+ if (botName) {
134
+ await (0, import_executor_helpers.createNewBotWithName)(botonicApiService, botName);
135
+ } else {
136
+ console.log("\u{1F916} Let's create a new bot!\n");
137
+ const response = await (0, import_enquirer.prompt)({
138
+ type: "input",
139
+ name: "bot_name",
140
+ message: "\u{1F916} Bot name:",
141
+ validate: (input) => {
142
+ return input.length > 0 ? true : "Bot name cannot be empty";
143
+ }
144
+ });
145
+ await (0, import_executor_helpers.createNewBotWithName)(botonicApiService, response.bot_name);
146
+ }
147
+ }
148
+ async function selectExistentBot(botonicApiService, bots) {
149
+ console.log("\u{1F4CB} Select a bot to deploy:\n");
150
+ const response = await (0, import_enquirer.prompt)({
151
+ type: "select",
152
+ name: "bot_id",
153
+ message: "\u{1F916} Please select a bot:",
154
+ choices: [
155
+ ...bots.map((bot2) => ({
156
+ name: bot2.id,
157
+ message: botLabel(bot2)
158
+ })),
159
+ { name: CREATE_PROD_CHOICE, message: "+ Create Production Bot" }
160
+ ]
161
+ });
162
+ const selectedBotId = response.bot_id;
163
+ if (selectedBotId === CREATE_PROD_CHOICE) {
164
+ await createNewBot(botonicApiService);
165
+ return;
166
+ }
167
+ const bot = bots.find((b) => b.id === selectedBotId);
168
+ if (bot) {
169
+ botonicApiService.setCurrentBot(bot);
170
+ console.log(`\u2705 Selected bot: ${botLabel(bot)}`);
171
+ }
172
+ }
@@ -1,5 +1,7 @@
1
1
  import type { ExecutorContext } from '@nx/devkit';
2
2
  import type { DeployToHubtypeExecutorSchema } from './schema';
3
- export default function deployToHubtypeExecutor(options: DeployToHubtypeExecutorSchema, context: ExecutorContext): Promise<{
3
+ export default function deployToHubtypeExecutor(options: DeployToHubtypeExecutorSchema, ctx: ExecutorContext): Promise<{
4
4
  success: boolean;
5
- }>;
5
+ } | AsyncIterableIterator<{
6
+ success: boolean;
7
+ }>>;
@@ -21,152 +21,7 @@ __export(executor_exports, {
21
21
  default: () => deployToHubtypeExecutor
22
22
  });
23
23
  module.exports = __toCommonJS(executor_exports);
24
- var import_enquirer = require("enquirer");
25
- var import_api_service = require("../../lib/api-service");
26
- var import_executor_helpers = require("../../lib/util/executor-helpers");
27
- const CREATE_PROD_CHOICE = "Create Production Bot";
28
- function botLabel(bot) {
29
- return bot.is_test ? `${bot.name} (Staging bot)` : `${bot.name} (Production bot)`;
30
- }
31
- let PROJECT_ROOT;
32
- async function deployToHubtypeExecutor(options, context) {
33
- if (!context.projectName) {
34
- throw new Error("Project name is not defined in executor context");
35
- }
36
- PROJECT_ROOT = (0, import_executor_helpers.resolveProjectPath)(context);
37
- try {
38
- const { targetEnvironment, environmentVariables } = (0, import_executor_helpers.resolveHubtypeEnvironment)(context, options);
39
- const botonicApiService = new import_api_service.BotonicAPIService({
40
- projectRoot: PROJECT_ROOT,
41
- environmentVariables,
42
- targetEnvironment
43
- });
44
- const botName = options.botName;
45
- if (!botonicApiService.oauth) {
46
- if (options.email && options.password) {
47
- await botonicApiService.login(options.email, options.password);
48
- botonicApiService.saveAllCredentials();
49
- } else {
50
- await (0, import_executor_helpers.handleAuthentication)(botonicApiService);
51
- }
52
- }
53
- await (0, import_executor_helpers.logWorkingAsAndEnvironment)(botonicApiService);
54
- console.log(
55
- `\u{1F680} Deploying to Hubtype... [${environmentVariables["VITE_HUBTYPE_API_URL"]}]
56
- `
57
- );
58
- if (botName) {
59
- await handleBotFromFlag(
60
- botonicApiService,
61
- botName,
62
- options.createIfNotExists
63
- );
64
- } else {
65
- await handleBotFlow(botonicApiService);
66
- }
67
- await (0, import_executor_helpers.deployBotToHubtype)(
68
- botonicApiService,
69
- PROJECT_ROOT,
70
- context.projectName
71
- );
72
- return { success: true };
73
- } catch (error) {
74
- return (0, import_executor_helpers.handleExecutorError)(error, "Deployment");
75
- }
76
- }
77
- async function handleBotFromFlag(botonicApiService, botName, createIfNotExists) {
78
- const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
79
- const bot = bots.find((b) => b.name === botName);
80
- if (bot) {
81
- botonicApiService.setCurrentBot(bot);
82
- } else {
83
- if (createIfNotExists) {
84
- console.log(
85
- `\u{1F916} Bot "${botName}" doesn't exist. Creating it automatically...`
86
- );
87
- await createNewBot(botonicApiService, botName);
88
- } else {
89
- const response = await (0, import_enquirer.prompt)({
90
- type: "confirm",
91
- name: "create_bot_confirm",
92
- message: `\u{1F916} Bot "${botName}" doesn't exist. Do you want to create it?`
93
- });
94
- if (response.create_bot_confirm) {
95
- await createNewBot(botonicApiService, botName);
96
- } else {
97
- throw new Error(`Bot "${botName}" not found`);
98
- }
99
- }
100
- }
101
- }
102
- async function handleBotFlow(botonicApiService) {
103
- if (!botonicApiService.bot || !Object.keys(botonicApiService.bot).length) {
104
- await newBotFlow(botonicApiService);
105
- } else {
106
- const resp = await botonicApiService.getBots();
107
- const bots = resp.data.results;
108
- const firstId = botonicApiService.bot.id;
109
- bots.sort(
110
- (x, y) => x.id === firstId ? -1 : y.id === firstId ? 1 : 0
111
- );
112
- await selectExistentBot(botonicApiService, bots);
113
- }
114
- }
115
- async function newBotFlow(botonicApiService) {
116
- const bots = await (0, import_executor_helpers.getAvailableBots)(botonicApiService);
117
- if (!bots.length) {
118
- await createNewBot(botonicApiService);
119
- } else {
120
- const response = await (0, import_enquirer.prompt)({
121
- type: "confirm",
122
- name: "create_bot_confirm",
123
- message: "\u{1F916} Do you want to create a new bot?"
124
- });
125
- if (response.create_bot_confirm) {
126
- await createNewBot(botonicApiService);
127
- } else {
128
- await selectExistentBot(botonicApiService, bots);
129
- }
130
- }
131
- }
132
- async function createNewBot(botonicApiService, botName) {
133
- if (botName) {
134
- await (0, import_executor_helpers.createNewBotWithName)(botonicApiService, botName);
135
- } else {
136
- console.log("\u{1F916} Let's create a new bot!\n");
137
- const response = await (0, import_enquirer.prompt)({
138
- type: "input",
139
- name: "bot_name",
140
- message: "\u{1F916} Bot name:",
141
- validate: (input) => {
142
- return input.length > 0 ? true : "Bot name cannot be empty";
143
- }
144
- });
145
- await (0, import_executor_helpers.createNewBotWithName)(botonicApiService, response.bot_name);
146
- }
147
- }
148
- async function selectExistentBot(botonicApiService, bots) {
149
- console.log("\u{1F4CB} Select a bot to deploy:\n");
150
- const response = await (0, import_enquirer.prompt)({
151
- type: "select",
152
- name: "bot_id",
153
- message: "\u{1F916} Please select a bot:",
154
- choices: [
155
- ...bots.map((bot2) => ({
156
- name: bot2.id,
157
- message: botLabel(bot2)
158
- })),
159
- { name: CREATE_PROD_CHOICE, message: "+ Create Production Bot" }
160
- ]
161
- });
162
- const selectedBotId = response.bot_id;
163
- if (selectedBotId === CREATE_PROD_CHOICE) {
164
- await createNewBot(botonicApiService);
165
- return;
166
- }
167
- const bot = bots.find((b) => b.id === selectedBotId);
168
- if (bot) {
169
- botonicApiService.setCurrentBot(bot);
170
- console.log(`\u2705 Selected bot: ${botLabel(bot)}`);
171
- }
24
+ var import_delegate_executor = require("../../lib/delegate/delegate-executor");
25
+ async function deployToHubtypeExecutor(options, ctx) {
26
+ return (0, import_delegate_executor.runLocalExecutor)(__filename, "deploy-to-hubtype", options, ctx);
172
27
  }
@@ -0,0 +1,5 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { E2EExecutorSchema } from './schema';
3
+ export default function e2eExecutor(options: E2EExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var executor_impl_exports = {};
30
+ __export(executor_impl_exports, {
31
+ default: () => e2eExecutor
32
+ });
33
+ module.exports = __toCommonJS(executor_impl_exports);
34
+ var import_child_process = require("child_process");
35
+ var import_fs = require("fs");
36
+ var import_path = require("path");
37
+ var import_executor_impl = __toESM(require("../deploy-netlify-snapshot/executor-impl"));
38
+ const WEBCHAT_OUTPUT_DIR = "dist/webchat";
39
+ async function e2eExecutor(options, context) {
40
+ const projectRoot = context.projectsConfigurations?.projects[context.projectName ?? ""]?.root ?? "";
41
+ if (!options.dir) {
42
+ console.log("\u{1F528} Step 1/3: Building webchat app...");
43
+ try {
44
+ (0, import_child_process.execSync)(`npx nx build-webchat-app ${context.projectName}`, {
45
+ stdio: "inherit",
46
+ cwd: context.root
47
+ });
48
+ } catch {
49
+ console.error("\u274C Webchat build failed \u2014 aborting e2e tests");
50
+ return { success: false };
51
+ }
52
+ }
53
+ const dir = options.dir ? (0, import_path.resolve)(context.root, projectRoot, options.dir) : (0, import_path.resolve)(context.root, projectRoot, WEBCHAT_OUTPUT_DIR);
54
+ const deployStep = options.dir ? "1/2" : "2/3";
55
+ const playwrightStep = options.dir ? "2/2" : "3/3";
56
+ console.log(`
57
+ \u{1F4E6} Step ${deployStep}: Deploying snapshot to Netlify...`);
58
+ const deployResult = await (0, import_executor_impl.default)(
59
+ {
60
+ dir,
61
+ siteId: options.siteId,
62
+ authToken: options.authToken,
63
+ alias: options.alias || `e2e-${Date.now()}`,
64
+ prod: options.prod
65
+ },
66
+ context
67
+ );
68
+ if (!deployResult.success || !deployResult.deployUrl) {
69
+ console.error("\u274C Netlify deploy failed \u2014 aborting e2e tests");
70
+ return { success: false };
71
+ }
72
+ const snapshotUrl = deployResult.deployUrl;
73
+ const e2eTmpDir = (0, import_path.resolve)(context.root, ".botonic-e2e-tmp");
74
+ (0, import_fs.mkdirSync)(e2eTmpDir, { recursive: true });
75
+ const e2eConfigPath = (0, import_path.resolve)(e2eTmpDir, "playwright.config.js");
76
+ (0, import_fs.writeFileSync)(
77
+ e2eConfigPath,
78
+ `module.exports = {
79
+ testDir: '.',
80
+ testMatch: '*.spec.ts',
81
+ timeout: 30000,
82
+ retries: 1,
83
+ use: {
84
+ baseURL: process.env.WEBCHAT_URL || 'http://localhost:8080',
85
+ trace: 'on-first-retry',
86
+ screenshot: 'only-on-failure',
87
+ video: 'on-first-retry',
88
+ },
89
+ reporter: [['html', { outputFolder: 'playwright-report' }], ['list']],
90
+ };
91
+ `
92
+ );
93
+ const bundledSpecPath = (0, import_path.resolve)(__dirname, "botonic-package-publish.spec.ts");
94
+ const specDestPath = (0, import_path.resolve)(e2eTmpDir, "botonic-package-publish.spec.ts");
95
+ if ((0, import_fs.existsSync)(bundledSpecPath)) {
96
+ (0, import_fs.copyFileSync)(bundledSpecPath, specDestPath);
97
+ } else if (options.configPath) {
98
+ const customConfigPath = (0, import_path.resolve)(context.root, options.configPath);
99
+ console.log(
100
+ `
101
+ \u{1F3AD} Step ${playwrightStep}: Running Playwright tests against ${snapshotUrl}`
102
+ );
103
+ try {
104
+ (0, import_child_process.execSync)(`npx playwright test --config="${customConfigPath}"`, {
105
+ env: { ...process.env, WEBCHAT_URL: snapshotUrl },
106
+ stdio: "inherit",
107
+ cwd: context.root
108
+ });
109
+ console.log("\u2705 E2E tests passed!");
110
+ return { success: true };
111
+ } catch {
112
+ console.error("\u274C E2E tests failed");
113
+ return { success: false };
114
+ }
115
+ }
116
+ console.log(
117
+ `
118
+ \u{1F3AD} Step ${playwrightStep}: Running Playwright tests against ${snapshotUrl}`
119
+ );
120
+ console.log(` Config: ${e2eConfigPath}`);
121
+ console.log(` Tests dir: ${e2eTmpDir}`);
122
+ try {
123
+ (0, import_child_process.execSync)(`npx playwright test --config="${e2eConfigPath}"`, {
124
+ env: { ...process.env, WEBCHAT_URL: snapshotUrl },
125
+ stdio: "inherit",
126
+ cwd: context.root
127
+ });
128
+ console.log("\u2705 E2E tests passed!");
129
+ return { success: true };
130
+ } catch {
131
+ console.error("\u274C E2E tests failed");
132
+ return { success: false };
133
+ }
134
+ }
@@ -1,5 +1,7 @@
1
1
  import type { ExecutorContext } from '@nx/devkit';
2
2
  import type { E2EExecutorSchema } from './schema';
3
- export default function e2eExecutor(options: E2EExecutorSchema, context: ExecutorContext): Promise<{
3
+ export default function e2eWebchatExecutor(options: E2EExecutorSchema, ctx: ExecutorContext): Promise<{
4
4
  success: boolean;
5
- }>;
5
+ } | AsyncIterableIterator<{
6
+ success: boolean;
7
+ }>>;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,118 +15,13 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
  var executor_exports = {};
30
20
  __export(executor_exports, {
31
- default: () => e2eExecutor
21
+ default: () => e2eWebchatExecutor
32
22
  });
33
23
  module.exports = __toCommonJS(executor_exports);
34
- var import_child_process = require("child_process");
35
- var import_fs = require("fs");
36
- var import_path = require("path");
37
- var import_executor = __toESM(require("../deploy-netlify-snapshot/executor"));
38
- const WEBCHAT_OUTPUT_DIR = "dist/webchat";
39
- async function e2eExecutor(options, context) {
40
- const projectRoot = context.projectsConfigurations?.projects[context.projectName ?? ""]?.root ?? "";
41
- if (!options.dir) {
42
- console.log("\u{1F528} Step 1/3: Building webchat app...");
43
- try {
44
- (0, import_child_process.execSync)(`npx nx build-webchat-app ${context.projectName}`, {
45
- stdio: "inherit",
46
- cwd: context.root
47
- });
48
- } catch {
49
- console.error("\u274C Webchat build failed \u2014 aborting e2e tests");
50
- return { success: false };
51
- }
52
- }
53
- const dir = options.dir ? (0, import_path.resolve)(context.root, projectRoot, options.dir) : (0, import_path.resolve)(context.root, projectRoot, WEBCHAT_OUTPUT_DIR);
54
- const deployStep = options.dir ? "1/2" : "2/3";
55
- const playwrightStep = options.dir ? "2/2" : "3/3";
56
- console.log(`
57
- \u{1F4E6} Step ${deployStep}: Deploying snapshot to Netlify...`);
58
- const deployResult = await (0, import_executor.default)(
59
- {
60
- dir,
61
- siteId: options.siteId,
62
- authToken: options.authToken,
63
- alias: options.alias || `e2e-${Date.now()}`,
64
- prod: options.prod
65
- },
66
- context
67
- );
68
- if (!deployResult.success || !deployResult.deployUrl) {
69
- console.error("\u274C Netlify deploy failed \u2014 aborting e2e tests");
70
- return { success: false };
71
- }
72
- const snapshotUrl = deployResult.deployUrl;
73
- const e2eTmpDir = (0, import_path.resolve)(context.root, ".botonic-e2e-tmp");
74
- (0, import_fs.mkdirSync)(e2eTmpDir, { recursive: true });
75
- const e2eConfigPath = (0, import_path.resolve)(e2eTmpDir, "playwright.config.js");
76
- (0, import_fs.writeFileSync)(
77
- e2eConfigPath,
78
- `module.exports = {
79
- testDir: '.',
80
- testMatch: '*.spec.ts',
81
- timeout: 30000,
82
- retries: 1,
83
- use: {
84
- baseURL: process.env.WEBCHAT_URL || 'http://localhost:8080',
85
- trace: 'on-first-retry',
86
- screenshot: 'only-on-failure',
87
- video: 'on-first-retry',
88
- },
89
- reporter: [['html', { outputFolder: 'playwright-report' }], ['list']],
90
- };
91
- `
92
- );
93
- const bundledSpecPath = (0, import_path.resolve)(__dirname, "botonic-package-publish.spec.ts");
94
- const specDestPath = (0, import_path.resolve)(e2eTmpDir, "botonic-package-publish.spec.ts");
95
- if ((0, import_fs.existsSync)(bundledSpecPath)) {
96
- (0, import_fs.copyFileSync)(bundledSpecPath, specDestPath);
97
- } else if (options.configPath) {
98
- const customConfigPath = (0, import_path.resolve)(context.root, options.configPath);
99
- console.log(
100
- `
101
- \u{1F3AD} Step ${playwrightStep}: Running Playwright tests against ${snapshotUrl}`
102
- );
103
- try {
104
- (0, import_child_process.execSync)(`npx playwright test --config="${customConfigPath}"`, {
105
- env: { ...process.env, WEBCHAT_URL: snapshotUrl },
106
- stdio: "inherit",
107
- cwd: context.root
108
- });
109
- console.log("\u2705 E2E tests passed!");
110
- return { success: true };
111
- } catch {
112
- console.error("\u274C E2E tests failed");
113
- return { success: false };
114
- }
115
- }
116
- console.log(
117
- `
118
- \u{1F3AD} Step ${playwrightStep}: Running Playwright tests against ${snapshotUrl}`
119
- );
120
- console.log(` Config: ${e2eConfigPath}`);
121
- console.log(` Tests dir: ${e2eTmpDir}`);
122
- try {
123
- (0, import_child_process.execSync)(`npx playwright test --config="${e2eConfigPath}"`, {
124
- env: { ...process.env, WEBCHAT_URL: snapshotUrl },
125
- stdio: "inherit",
126
- cwd: context.root
127
- });
128
- console.log("\u2705 E2E tests passed!");
129
- return { success: true };
130
- } catch {
131
- console.error("\u274C E2E tests failed");
132
- return { success: false };
133
- }
24
+ var import_delegate_executor = require("../../lib/delegate/delegate-executor");
25
+ async function e2eWebchatExecutor(options, ctx) {
26
+ return (0, import_delegate_executor.runLocalExecutor)(__filename, "e2e-webchat", options, ctx);
134
27
  }
@@ -0,0 +1,5 @@
1
+ import type { ExecutorContext } from '@nx/devkit';
2
+ import type { IntegrateProviderExecutorSchema } from './schema';
3
+ export default function integrateProviderExecutor(options: IntegrateProviderExecutorSchema, context: ExecutorContext): Promise<{
4
+ success: boolean;
5
+ }>;