@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.
- package/migrations.json +1 -8
- package/package.json +7 -4
- package/src/executors/build-node-app/executor-impl.d.ts +5 -0
- package/src/executors/build-node-app/executor-impl.js +65 -0
- package/src/executors/build-node-app/executor.d.ts +4 -2
- package/src/executors/build-node-app/executor.js +3 -41
- package/src/executors/delete-bot/executor-impl.d.ts +5 -0
- package/src/executors/delete-bot/executor-impl.js +110 -0
- package/src/executors/delete-bot/executor.d.ts +4 -2
- package/src/executors/delete-bot/executor.js +3 -86
- package/src/executors/deploy-netlify-snapshot/executor-impl.d.ts +8 -0
- package/src/executors/deploy-netlify-snapshot/executor-impl.js +79 -0
- package/src/executors/deploy-netlify-snapshot/executor.d.ts +4 -5
- package/src/executors/deploy-netlify-snapshot/executor.js +3 -55
- package/src/executors/deploy-to-hubtype/executor-impl.d.ts +5 -0
- package/src/executors/deploy-to-hubtype/executor-impl.js +172 -0
- package/src/executors/deploy-to-hubtype/executor.d.ts +4 -2
- package/src/executors/deploy-to-hubtype/executor.js +3 -148
- package/src/executors/e2e-webchat/executor-impl.d.ts +5 -0
- package/src/executors/e2e-webchat/executor-impl.js +134 -0
- package/src/executors/e2e-webchat/executor.d.ts +4 -2
- package/src/executors/e2e-webchat/executor.js +4 -111
- package/src/executors/integrate-provider/executor-impl.d.ts +5 -0
- package/src/executors/integrate-provider/executor-impl.js +153 -0
- package/src/executors/integrate-provider/executor.d.ts +4 -2
- package/src/executors/integrate-provider/executor.js +3 -129
- package/src/executors/login-to-hubtype/executor-impl.d.ts +5 -0
- package/src/executors/login-to-hubtype/executor-impl.js +77 -0
- package/src/executors/login-to-hubtype/executor.d.ts +4 -2
- package/src/executors/login-to-hubtype/executor.js +3 -53
- package/src/executors/logout-from-hubtype/executor-impl.d.ts +3 -0
- package/src/executors/logout-from-hubtype/executor-impl.js +54 -0
- package/src/executors/logout-from-hubtype/executor.d.ts +5 -1
- package/src/executors/logout-from-hubtype/executor.js +3 -30
- package/src/executors/run-lambda/executor-impl.d.ts +5 -0
- package/src/executors/run-lambda/executor-impl.js +65 -0
- package/src/executors/run-lambda/executor.d.ts +4 -2
- package/src/executors/run-lambda/executor.js +3 -41
- package/src/executors/serve-bot/executor-impl.d.ts +5 -0
- package/src/executors/serve-bot/executor-impl.js +530 -0
- package/src/executors/serve-bot/executor.d.ts +4 -2
- package/src/executors/serve-bot/executor.js +3 -506
- package/src/generators/action/generator-impl.d.ts +4 -0
- package/src/generators/action/generator-impl.js +112 -0
- package/src/generators/action/generator.d.ts +2 -3
- package/src/generators/action/generator.js +2 -87
- package/src/generators/bot-app/files/vite/webchat.config.ts.template +10 -2
- package/src/generators/bot-app/generator-impl.d.ts +4 -0
- package/src/generators/bot-app/generator-impl.js +328 -0
- package/src/generators/bot-app/generator.d.ts +2 -4
- package/src/generators/bot-app/generator.js +2 -295
- package/src/generators/custom-message/generator-impl.d.ts +4 -0
- package/src/generators/custom-message/generator-impl.js +235 -0
- package/src/generators/custom-message/generator.d.ts +2 -3
- package/src/generators/custom-message/generator.js +2 -210
- package/src/generators/preset/generator-impl.d.ts +4 -0
- package/src/generators/preset/generator-impl.js +127 -0
- package/src/generators/preset/generator.d.ts +2 -4
- package/src/generators/preset/generator.js +2 -95
- package/src/generators/remove-custom-message/generator-impl.d.ts +4 -0
- package/src/generators/remove-custom-message/generator-impl.js +259 -0
- package/src/generators/remove-custom-message/generator.d.ts +2 -3
- package/src/generators/remove-custom-message/generator.js +2 -234
- package/src/generators/webview/generator-impl.d.ts +4 -0
- package/src/generators/webview/generator-impl.js +179 -0
- package/src/generators/webview/generator.d.ts +2 -3
- package/src/generators/webview/generator.js +2 -154
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -1
- package/src/lib/delegate/delegate-executor.d.ts +6 -0
- package/src/lib/delegate/delegate-executor.js +119 -0
- package/src/lib/delegate/delegate-generator.d.ts +2 -0
- package/src/lib/delegate/delegate-generator.js +128 -0
- package/src/lib/serve-mode/index.d.ts +25 -0
- package/src/lib/serve-mode/index.js +183 -0
- package/src/generators/bot-app/files/vite/plugins/dev-log-viewer-html.plugin.ts.template +0 -65
- package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.d.ts +0 -2
- package/src/migrations/install-claude-update-skills/install-claude-update-skills.migration.js +0 -290
|
@@ -21,92 +21,7 @@ __export(generator_exports, {
|
|
|
21
21
|
default: () => generator_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(generator_exports);
|
|
24
|
-
var
|
|
25
|
-
var import_bot_app_utils = require("../shared/bot-app-utils");
|
|
26
|
-
const MODULE_DIR = __dirname;
|
|
27
|
-
function normalizeOptions(tree, options) {
|
|
28
|
-
const { projectRoot, sourceRoot } = (0, import_bot_app_utils.validateBotAppProject)(
|
|
29
|
-
tree,
|
|
30
|
-
options.project
|
|
31
|
-
);
|
|
32
|
-
const paths = (0, import_bot_app_utils.resolveStandardPaths)(sourceRoot);
|
|
33
|
-
const name = (0, import_devkit.names)(options.name);
|
|
34
|
-
const fileName = name.fileName;
|
|
35
|
-
const className = name.className;
|
|
36
|
-
return {
|
|
37
|
-
...options,
|
|
38
|
-
projectName: options.project,
|
|
39
|
-
projectRoot,
|
|
40
|
-
fileName,
|
|
41
|
-
className,
|
|
42
|
-
actionsPath: paths.actionsPath,
|
|
43
|
-
routesPath: paths.routesPath,
|
|
44
|
-
resolvedRouteMatcher: options.routeMatcher ?? fileName
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function addFilesToProject(tree, options) {
|
|
48
|
-
const name = (0, import_devkit.names)(options.name);
|
|
49
|
-
const templateOptions = {
|
|
50
|
-
...options,
|
|
51
|
-
...name,
|
|
52
|
-
name: name.fileName
|
|
53
|
-
// __name__ in filenames must be kebab-case
|
|
54
|
-
};
|
|
55
|
-
(0, import_devkit.generateFiles)(
|
|
56
|
-
tree,
|
|
57
|
-
(0, import_devkit.joinPathFragments)(MODULE_DIR, "files"),
|
|
58
|
-
options.actionsPath,
|
|
59
|
-
templateOptions
|
|
60
|
-
);
|
|
61
|
-
if (options.skipTests) {
|
|
62
|
-
const testFilePath = `${options.actionsPath}/${options.fileName}.spec.ts`;
|
|
63
|
-
if (tree.exists(testFilePath)) {
|
|
64
|
-
tree.delete(testFilePath);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function updateActionsIndex(tree, options) {
|
|
69
|
-
(0, import_bot_app_utils.addExportToIndex)(
|
|
70
|
-
tree,
|
|
71
|
-
`${options.actionsPath}/index.ts`,
|
|
72
|
-
`export * from './${options.fileName}'`
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
function updateRoutes(tree, options) {
|
|
76
|
-
if (options.skipRoute) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
(0, import_bot_app_utils.addActionImportToRoutes)(tree, options.routesPath, options.className);
|
|
80
|
-
(0, import_bot_app_utils.insertRouteBeforeFlowBuilder)(tree, options.routesPath, [
|
|
81
|
-
` {`,
|
|
82
|
-
` text: '${options.resolvedRouteMatcher}',`,
|
|
83
|
-
` action: async () => await ${options.className}(botonicContext),`,
|
|
84
|
-
` },`
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
24
|
+
var import_delegate_generator = require("../../lib/delegate/delegate-generator");
|
|
87
25
|
async function generator_default(tree, options) {
|
|
88
|
-
|
|
89
|
-
const normalizedOptions = normalizeOptions(tree, options);
|
|
90
|
-
console.log(`Project: ${normalizedOptions.projectName}`);
|
|
91
|
-
console.log(`Location: ${normalizedOptions.actionsPath}`);
|
|
92
|
-
addFilesToProject(tree, normalizedOptions);
|
|
93
|
-
updateActionsIndex(tree, normalizedOptions);
|
|
94
|
-
updateRoutes(tree, normalizedOptions);
|
|
95
|
-
await (0, import_devkit.formatFiles)(tree);
|
|
96
|
-
console.log(`
|
|
97
|
-
Successfully created action: ${normalizedOptions.className}`);
|
|
98
|
-
console.log(`Next steps:`);
|
|
99
|
-
console.log(
|
|
100
|
-
` 1. Implement the logic in: ${normalizedOptions.actionsPath}/${normalizedOptions.fileName}.ts`
|
|
101
|
-
);
|
|
102
|
-
if (!options.skipRoute) {
|
|
103
|
-
console.log(
|
|
104
|
-
` 2. Test by sending '${normalizedOptions.resolvedRouteMatcher}' in the webchat`
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
if (!options.skipTests) {
|
|
108
|
-
console.log(
|
|
109
|
-
` 3. Update the tests in: ${normalizedOptions.actionsPath}/${normalizedOptions.fileName}.spec.ts`
|
|
110
|
-
);
|
|
111
|
-
}
|
|
26
|
+
return (0, import_delegate_generator.runLocalGenerator)(__filename, "action", tree, options);
|
|
112
27
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { resolve } from 'path'
|
|
2
2
|
import type { UserConfig } from 'vite'
|
|
3
|
+
import {
|
|
4
|
+
createLogViewerPlugin,
|
|
5
|
+
createWebchatPanelPlugin,
|
|
6
|
+
createWhatsappPanelPlugin,
|
|
7
|
+
} from '@botonic/nx-plugin'
|
|
3
8
|
|
|
4
9
|
import { BUILD_CONFIG } from './build.config'
|
|
5
|
-
import { devLogViewerIndexHtmlPlugin } from './plugins/dev-log-viewer-html.plugin'
|
|
6
10
|
import { moveHtmlToRootPlugin } from './plugins/move-html.plugin'
|
|
7
11
|
|
|
8
12
|
const projectRoot = resolve(__dirname, '..')
|
|
@@ -83,7 +87,11 @@ export function getWebchatConfig(command: 'serve' | 'build'): UserConfig {
|
|
|
83
87
|
},
|
|
84
88
|
|
|
85
89
|
plugins: [
|
|
86
|
-
|
|
90
|
+
createLogViewerPlugin(),
|
|
91
|
+
createWhatsappPanelPlugin({
|
|
92
|
+
registeredPhone: process.env.WHATSAPP_PANEL_PHONE,
|
|
93
|
+
}),
|
|
94
|
+
createWebchatPanelPlugin(),
|
|
87
95
|
moveHtmlToRootPlugin(projectRoot, BUILD_CONFIG.TARGET_APPS.WEBCHAT),
|
|
88
96
|
],
|
|
89
97
|
}
|
|
@@ -0,0 +1,328 @@
|
|
|
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 generator_impl_exports = {};
|
|
30
|
+
__export(generator_impl_exports, {
|
|
31
|
+
default: () => generator_impl_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(generator_impl_exports);
|
|
34
|
+
var import_devkit = require("@nx/devkit");
|
|
35
|
+
var import_child_process = require("child_process");
|
|
36
|
+
var fs = __toESM(require("fs"));
|
|
37
|
+
var path = __toESM(require("path"));
|
|
38
|
+
const MODULE_DIR = __dirname;
|
|
39
|
+
function getLilaraVersion(options) {
|
|
40
|
+
const version = options.lilaraVersion;
|
|
41
|
+
if (version && version !== "latest") {
|
|
42
|
+
return version.replace(/^[\^~]/, "");
|
|
43
|
+
}
|
|
44
|
+
const jsonPath = path.join(MODULE_DIR, "lilara-version.json");
|
|
45
|
+
try {
|
|
46
|
+
if (fs.existsSync(jsonPath)) {
|
|
47
|
+
const data = JSON.parse(fs.readFileSync(jsonPath, "utf-8"));
|
|
48
|
+
if (data.version && typeof data.version === "string") {
|
|
49
|
+
return data.version.replace(/^[\^~]/, "");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const tag = (0, import_child_process.execSync)('git describe --tags --match "lilara-v*" --abbrev=0', {
|
|
56
|
+
encoding: "utf-8",
|
|
57
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
58
|
+
}).trim();
|
|
59
|
+
const v = tag.replace(/^lilara-v/, "");
|
|
60
|
+
if (v) return v;
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
return "latest";
|
|
64
|
+
}
|
|
65
|
+
function getBotonicVersion(options) {
|
|
66
|
+
const version = options.botonicVersion;
|
|
67
|
+
if (version && version !== "{{WORKSPACE_VERSION}}" && version !== "latest") {
|
|
68
|
+
return version.replace(/^[\^~]/, "");
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const packageJsonPath = path.resolve(
|
|
72
|
+
MODULE_DIR,
|
|
73
|
+
"..",
|
|
74
|
+
"..",
|
|
75
|
+
"..",
|
|
76
|
+
"package.json"
|
|
77
|
+
);
|
|
78
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
79
|
+
return packageJson.version || "latest";
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.warn("Could not read plugin version, using latest:", error);
|
|
82
|
+
return "latest";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function normalizeOptions(tree, options) {
|
|
86
|
+
let appName = options.name;
|
|
87
|
+
let directory = options.directory;
|
|
88
|
+
if (options.name.includes("/")) {
|
|
89
|
+
const parts = options.name.split("/");
|
|
90
|
+
appName = parts.pop();
|
|
91
|
+
if (!directory) {
|
|
92
|
+
directory = parts.join("/");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const name = (0, import_devkit.names)(appName).fileName;
|
|
96
|
+
if (!name) {
|
|
97
|
+
throw new Error(`Failed to normalize app name: ${appName}`);
|
|
98
|
+
}
|
|
99
|
+
let projectDirectory;
|
|
100
|
+
if (directory) {
|
|
101
|
+
const directoryName = (0, import_devkit.names)(directory).fileName;
|
|
102
|
+
if (!directoryName) {
|
|
103
|
+
throw new Error(`Failed to normalize directory name: ${directory}`);
|
|
104
|
+
}
|
|
105
|
+
projectDirectory = `${directoryName}/${name}`;
|
|
106
|
+
} else {
|
|
107
|
+
projectDirectory = name;
|
|
108
|
+
}
|
|
109
|
+
if (!projectDirectory) {
|
|
110
|
+
throw new Error(
|
|
111
|
+
`Failed to determine project directory for app name: ${appName}`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const projectName = projectDirectory.replace(new RegExp("/", "g"), "-");
|
|
115
|
+
const projectRoot = `${(0, import_devkit.getWorkspaceLayout)(tree).appsDir}/${projectDirectory}`;
|
|
116
|
+
return {
|
|
117
|
+
...options,
|
|
118
|
+
name: appName,
|
|
119
|
+
// Use the parsed app name
|
|
120
|
+
directory,
|
|
121
|
+
// Use the parsed directory
|
|
122
|
+
projectName,
|
|
123
|
+
projectRoot,
|
|
124
|
+
projectDirectory
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function createProjectConfiguration(tree, options) {
|
|
128
|
+
const projectConfig = {
|
|
129
|
+
name: options.projectName,
|
|
130
|
+
root: options.projectRoot,
|
|
131
|
+
sourceRoot: `${options.projectRoot}/src`,
|
|
132
|
+
projectType: "application",
|
|
133
|
+
tags: ["type:app", "botonic:bot-app"]
|
|
134
|
+
// Note: targets are now inferred by the @botonic/nx-plugin based on the 'botonic:bot-app' tag
|
|
135
|
+
// and the presence of configuration files (vite.config.ts, bot-config.ts, etc.)
|
|
136
|
+
};
|
|
137
|
+
(0, import_devkit.addProjectConfiguration)(tree, options.projectName, projectConfig);
|
|
138
|
+
}
|
|
139
|
+
function createPackageJson(tree, options, botonicVersion, lilaraVersion) {
|
|
140
|
+
const packageJson = {
|
|
141
|
+
name: options.projectName,
|
|
142
|
+
version: "1.0.0",
|
|
143
|
+
type: "module",
|
|
144
|
+
private: true,
|
|
145
|
+
description: `Botonic bot application: ${options.projectName}`,
|
|
146
|
+
main: "dist/src/index.js",
|
|
147
|
+
scripts: {},
|
|
148
|
+
dependencies: {
|
|
149
|
+
"@botonic/core": botonicVersion,
|
|
150
|
+
"@botonic/plugin-ai-agents": botonicVersion,
|
|
151
|
+
"@botonic/plugin-flow-builder": botonicVersion,
|
|
152
|
+
"@botonic/plugin-hubtype-analytics": botonicVersion,
|
|
153
|
+
"@botonic/shared": botonicVersion,
|
|
154
|
+
"@botonic/webchat-core": botonicVersion,
|
|
155
|
+
"@botonic/webchat-react": botonicVersion,
|
|
156
|
+
"@botonic/webviews": botonicVersion,
|
|
157
|
+
"@lilara/foundations": lilaraVersion,
|
|
158
|
+
"@lilara/ui-web": lilaraVersion,
|
|
159
|
+
"@lilara/ui-web-react": lilaraVersion,
|
|
160
|
+
react: "18.3.1",
|
|
161
|
+
"react-dom": "18.3.1",
|
|
162
|
+
zod: "^4.4.3"
|
|
163
|
+
},
|
|
164
|
+
devDependencies: {
|
|
165
|
+
"@botonic/nx-plugin": botonicVersion,
|
|
166
|
+
"@nx/vite": "21.6.11",
|
|
167
|
+
"@types/node": "22.13.0",
|
|
168
|
+
"@types/react": "18.3.1",
|
|
169
|
+
"@types/react-dom": "18.3.0",
|
|
170
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
171
|
+
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
172
|
+
typescript: "5.7.3",
|
|
173
|
+
vite: "7.1.9",
|
|
174
|
+
vitest: "4.1.1"
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
(0, import_devkit.writeJson)(tree, `${options.projectRoot}/package.json`, packageJson);
|
|
178
|
+
}
|
|
179
|
+
function createTsConfigs(tree, options) {
|
|
180
|
+
const tsconfig = {
|
|
181
|
+
compilerOptions: {
|
|
182
|
+
jsx: "react-jsx",
|
|
183
|
+
allowJs: false,
|
|
184
|
+
esModuleInterop: true,
|
|
185
|
+
allowSyntheticDefaultImports: true,
|
|
186
|
+
resolveJsonModule: true,
|
|
187
|
+
strict: true,
|
|
188
|
+
types: ["vite/client", "vitest"]
|
|
189
|
+
},
|
|
190
|
+
files: [],
|
|
191
|
+
include: ["src/**/*.ts", "src/**/*.tsx"],
|
|
192
|
+
references: [
|
|
193
|
+
{ path: "./tsconfig.app.json" },
|
|
194
|
+
{ path: "./tsconfig.spec.json" }
|
|
195
|
+
],
|
|
196
|
+
extends: "../../tsconfig.base.json"
|
|
197
|
+
};
|
|
198
|
+
const tsconfigApp = {
|
|
199
|
+
extends: "./tsconfig.json",
|
|
200
|
+
compilerOptions: {
|
|
201
|
+
outDir: "./dist/out-tsc",
|
|
202
|
+
types: ["node", "vite/client"],
|
|
203
|
+
composite: true,
|
|
204
|
+
noEmit: false,
|
|
205
|
+
declaration: true
|
|
206
|
+
},
|
|
207
|
+
files: [
|
|
208
|
+
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
209
|
+
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
210
|
+
],
|
|
211
|
+
exclude: [
|
|
212
|
+
"jest.config.ts",
|
|
213
|
+
"src/**/*.spec.ts",
|
|
214
|
+
"src/**/*.test.ts",
|
|
215
|
+
"src/**/*.spec.tsx",
|
|
216
|
+
"src/**/*.test.tsx",
|
|
217
|
+
"src/**/*.spec.js",
|
|
218
|
+
"src/**/*.test.js",
|
|
219
|
+
"src/**/*.spec.jsx",
|
|
220
|
+
"src/**/*.test.jsx"
|
|
221
|
+
],
|
|
222
|
+
include: ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
223
|
+
};
|
|
224
|
+
const tsconfigSpec = {
|
|
225
|
+
extends: "./tsconfig.json",
|
|
226
|
+
compilerOptions: {
|
|
227
|
+
outDir: "./dist/out-tsc",
|
|
228
|
+
module: "commonjs",
|
|
229
|
+
types: ["vitest/globals", "vitest/importMeta", "vite/client", "node"],
|
|
230
|
+
composite: true,
|
|
231
|
+
noEmit: false,
|
|
232
|
+
declaration: true
|
|
233
|
+
},
|
|
234
|
+
include: [
|
|
235
|
+
"vite.config.ts",
|
|
236
|
+
"vitest.config.ts",
|
|
237
|
+
"src/**/*.test.ts",
|
|
238
|
+
"src/**/*.spec.ts",
|
|
239
|
+
"src/**/*.test.tsx",
|
|
240
|
+
"src/**/*.spec.tsx",
|
|
241
|
+
"src/**/*.test.js",
|
|
242
|
+
"src/**/*.spec.js",
|
|
243
|
+
"src/**/*.test.jsx",
|
|
244
|
+
"src/**/*.spec.jsx",
|
|
245
|
+
"src/**/*.d.ts"
|
|
246
|
+
]
|
|
247
|
+
};
|
|
248
|
+
(0, import_devkit.writeJson)(tree, `${options.projectRoot}/tsconfig.json`, tsconfig);
|
|
249
|
+
(0, import_devkit.writeJson)(tree, `${options.projectRoot}/tsconfig.app.json`, tsconfigApp);
|
|
250
|
+
(0, import_devkit.writeJson)(tree, `${options.projectRoot}/tsconfig.spec.json`, tsconfigSpec);
|
|
251
|
+
}
|
|
252
|
+
function addBotonicDependencies(tree, botonicVersion) {
|
|
253
|
+
return (0, import_devkit.addDependenciesToPackageJson)(
|
|
254
|
+
tree,
|
|
255
|
+
// dependencies
|
|
256
|
+
{
|
|
257
|
+
react: "18.3.1",
|
|
258
|
+
"react-dom": "18.3.1"
|
|
259
|
+
},
|
|
260
|
+
// devDependencies
|
|
261
|
+
{
|
|
262
|
+
"@nx/vite": "21.6.11",
|
|
263
|
+
"@types/node": "22.13.0",
|
|
264
|
+
"@types/react": "18.3.1",
|
|
265
|
+
"@types/react-dom": "18.3.0",
|
|
266
|
+
"@vitejs/plugin-react": "4.2.0",
|
|
267
|
+
"@vitejs/plugin-react-swc": "3.5.0",
|
|
268
|
+
typescript: "5.7.3",
|
|
269
|
+
vite: "7.1.9",
|
|
270
|
+
vitest: "4.1.1"
|
|
271
|
+
}
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
function addBotonicFiles(tree, options, botonicVersion) {
|
|
275
|
+
const templateOptions = {
|
|
276
|
+
...options,
|
|
277
|
+
...(0, import_devkit.names)(options.name),
|
|
278
|
+
botonicVersion
|
|
279
|
+
};
|
|
280
|
+
(0, import_devkit.generateFiles)(
|
|
281
|
+
tree,
|
|
282
|
+
(0, import_devkit.joinPathFragments)(MODULE_DIR, "files"),
|
|
283
|
+
options.projectRoot,
|
|
284
|
+
templateOptions
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
async function generator_impl_default(tree, options) {
|
|
288
|
+
const botonicVersion = getBotonicVersion(options);
|
|
289
|
+
const lilaraVersion = getLilaraVersion(options);
|
|
290
|
+
const tasks = [];
|
|
291
|
+
console.log(`\u{1F916} Using Botonic version: ${botonicVersion}`);
|
|
292
|
+
console.log(`\u{1F3A8} Using Lilara version: ${lilaraVersion}`);
|
|
293
|
+
console.log(`\u{1F50D} Creating project using programmatic configuration...`);
|
|
294
|
+
const normalizedOptions = normalizeOptions(tree, options);
|
|
295
|
+
console.log(`\u{1F50D} Normalized options:`, {
|
|
296
|
+
projectName: normalizedOptions.projectName,
|
|
297
|
+
projectRoot: normalizedOptions.projectRoot,
|
|
298
|
+
projectDirectory: normalizedOptions.projectDirectory
|
|
299
|
+
});
|
|
300
|
+
createProjectConfiguration(tree, normalizedOptions);
|
|
301
|
+
createPackageJson(tree, normalizedOptions, botonicVersion, lilaraVersion);
|
|
302
|
+
createTsConfigs(tree, normalizedOptions);
|
|
303
|
+
const depsTask = addBotonicDependencies(tree, botonicVersion);
|
|
304
|
+
tasks.push(depsTask);
|
|
305
|
+
tasks.push(() => (0, import_devkit.installPackagesTask)(tree));
|
|
306
|
+
tasks.push(
|
|
307
|
+
() => (0, import_devkit.installPackagesTask)(
|
|
308
|
+
tree,
|
|
309
|
+
true,
|
|
310
|
+
`${normalizedOptions.projectRoot}/src/server/lambda/`
|
|
311
|
+
)
|
|
312
|
+
);
|
|
313
|
+
addBotonicFiles(tree, normalizedOptions, botonicVersion);
|
|
314
|
+
await (0, import_devkit.formatFiles)(tree);
|
|
315
|
+
tasks.push(() => {
|
|
316
|
+
console.log(
|
|
317
|
+
`
|
|
318
|
+
\u{1F389} Successfully created Botonic bot app: ${normalizedOptions.projectName}`
|
|
319
|
+
);
|
|
320
|
+
console.log(`\u{1F4C1} Project location: ${normalizedOptions.projectRoot}`);
|
|
321
|
+
console.log(`
|
|
322
|
+
\u{1F4CB} Next step:`);
|
|
323
|
+
console.log(` npx nx run ${normalizedOptions.projectName}:serve`);
|
|
324
|
+
console.log(`
|
|
325
|
+
\u{1F680} Happy bot building!`);
|
|
326
|
+
});
|
|
327
|
+
return (0, import_devkit.runTasksInSerial)(...tasks);
|
|
328
|
+
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default function (tree: Tree, options: BotAppGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
|
-
export { BotAppGeneratorSchema };
|
|
1
|
+
export { default } from './generator-impl';
|
|
2
|
+
export type { BotAppGeneratorSchema } from './schema';
|