@botpress/cli 0.0.9 → 0.0.10
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/dist/api-client.js +107 -0
- package/dist/app/api-utils.js +9 -3
- package/dist/app/base.js +1 -3
- package/dist/app/errors.js +8 -0
- package/dist/app/file-paths.js +4 -2
- package/dist/app/index.js +17 -12
- package/dist/app/user.js +73 -23
- package/dist/code-generation/action.js +70 -0
- package/dist/code-generation/channel.js +51 -0
- package/dist/code-generation/configuration.js +40 -0
- package/dist/code-generation/const.js +31 -0
- package/dist/code-generation/event.js +41 -0
- package/dist/code-generation/index.js +80 -0
- package/dist/code-generation/integration-impl.js +147 -0
- package/dist/code-generation/integration-instance.js +79 -0
- package/dist/code-generation/message.js +41 -0
- package/dist/code-generation/module.js +115 -0
- package/dist/code-generation/typings.js +16 -0
- package/dist/command-definitions.js +61 -0
- package/dist/command-implementations/add-command.js +124 -0
- package/dist/command-implementations/base-command.js +53 -0
- package/dist/command-implementations/bot-commands.js +89 -0
- package/dist/command-implementations/build-command.js +48 -0
- package/dist/command-implementations/bundle-command.js +58 -0
- package/dist/command-implementations/deploy-command.js +162 -0
- package/dist/command-implementations/dev-command.js +168 -0
- package/dist/command-implementations/gen-command.js +58 -0
- package/dist/command-implementations/global-command.js +111 -0
- package/dist/command-implementations/index.js +78 -0
- package/dist/command-implementations/init-command.js +85 -0
- package/dist/command-implementations/integration-commands.js +107 -0
- package/dist/command-implementations/login-command.js +75 -0
- package/dist/command-implementations/logout-command.js +34 -0
- package/dist/command-implementations/project-command.js +115 -0
- package/dist/command-implementations/serve-command.js +53 -0
- package/dist/command-tree.js +59 -0
- package/dist/config.js +18 -2
- package/dist/consts.js +13 -0
- package/dist/errors.js +156 -0
- package/dist/index.js +33 -20
- package/dist/integration-ref.js +61 -0
- package/dist/path-utils.js +6 -0
- package/dist/register-yargs.js +85 -0
- package/dist/typings.js +16 -0
- package/dist/utils/cache-utils.js +99 -0
- package/dist/utils/esbuild-utils.js +89 -0
- package/dist/utils/event-emitter.js +62 -0
- package/dist/utils/file-watcher.js +68 -0
- package/dist/utils/index.js +55 -0
- package/dist/utils/path-utils.js +83 -0
- package/dist/utils/prompt-utils.js +75 -0
- package/dist/utils/require-utils.js +49 -0
- package/dist/utils/string-utils.js +38 -0
- package/package.json +6 -4
- package/templates/echo-bot/.botpress/project.cache.json +1 -0
- package/templates/echo-bot/package.json +22 -0
- package/templates/echo-bot/readme.md +5 -0
- package/templates/echo-bot/src/index.ts +44 -0
- package/templates/echo-bot/tsconfig.json +15 -0
- package/templates/empty-integration/.botpress/implementation/actions/index.ts +7 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/audio.ts +10 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/card.ts +17 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/carousel.ts +19 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/choice.ts +14 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/dropdown.ts +14 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/file.ts +11 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/image.ts +10 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/index.ts +40 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/location.ts +11 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/markdown.ts +10 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/text.ts +10 -0
- package/templates/empty-integration/.botpress/implementation/channels/channel/video.ts +10 -0
- package/templates/empty-integration/.botpress/implementation/channels/index.ts +10 -0
- package/templates/empty-integration/.botpress/implementation/configuration.ts +10 -0
- package/templates/empty-integration/.botpress/implementation/events/index.ts +7 -0
- package/templates/empty-integration/.botpress/implementation/index.ts +17 -0
- package/templates/empty-integration/.botpress/index.ts +1 -0
- package/templates/empty-integration/.botpress/project.cache.json +1 -0
- package/templates/empty-integration/integration.definition.ts +13 -0
- package/templates/empty-integration/package.json +22 -0
- package/templates/empty-integration/readme.md +5 -0
- package/templates/empty-integration/src/index.ts +58 -0
- package/templates/empty-integration/tsconfig.json +15 -0
- package/.ignore.me.github/index.ts +0 -38
- package/dist/github-download.js +0 -159
- package/dist/github-fetch.js +0 -173
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var cache_utils_exports = {};
|
|
26
|
+
__export(cache_utils_exports, {
|
|
27
|
+
FSKeyValueCache: () => FSKeyValueCache
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(cache_utils_exports);
|
|
30
|
+
var import_fs = __toESM(require("fs"));
|
|
31
|
+
var import_path = __toESM(require("path"));
|
|
32
|
+
class FSKeyValueCache {
|
|
33
|
+
constructor(_filepath) {
|
|
34
|
+
this._filepath = _filepath;
|
|
35
|
+
}
|
|
36
|
+
_initialized = false;
|
|
37
|
+
async init() {
|
|
38
|
+
if (this._initialized) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const dirname = import_path.default.dirname(this._filepath);
|
|
42
|
+
if (!import_fs.default.existsSync(dirname)) {
|
|
43
|
+
await import_fs.default.promises.mkdir(dirname, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
if (!import_fs.default.existsSync(this._filepath)) {
|
|
46
|
+
await this._writeJSON(this._filepath, {});
|
|
47
|
+
}
|
|
48
|
+
this._initialized = true;
|
|
49
|
+
}
|
|
50
|
+
async sync(key, value, prompt) {
|
|
51
|
+
await this.init();
|
|
52
|
+
if (value) {
|
|
53
|
+
await this.set(key, value);
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
const data = await this.get(key);
|
|
57
|
+
const newValue = await prompt(data);
|
|
58
|
+
await this.set(key, newValue);
|
|
59
|
+
return newValue;
|
|
60
|
+
}
|
|
61
|
+
async has(key) {
|
|
62
|
+
await this.init();
|
|
63
|
+
const data = await this._readJSON(this._filepath);
|
|
64
|
+
return data[key] !== void 0;
|
|
65
|
+
}
|
|
66
|
+
async get(key) {
|
|
67
|
+
await this.init();
|
|
68
|
+
const data = await this._readJSON(this._filepath);
|
|
69
|
+
return data[key];
|
|
70
|
+
}
|
|
71
|
+
async set(key, value) {
|
|
72
|
+
await this.init();
|
|
73
|
+
const data = await this._readJSON(this._filepath);
|
|
74
|
+
data[key] = value;
|
|
75
|
+
return this._writeJSON(this._filepath, data);
|
|
76
|
+
}
|
|
77
|
+
async rm(key) {
|
|
78
|
+
await this.init();
|
|
79
|
+
const data = await this._readJSON(this._filepath);
|
|
80
|
+
delete data[key];
|
|
81
|
+
return this._writeJSON(this._filepath, data);
|
|
82
|
+
}
|
|
83
|
+
async clear() {
|
|
84
|
+
await this.init();
|
|
85
|
+
return this._writeJSON(this._filepath, {});
|
|
86
|
+
}
|
|
87
|
+
_writeJSON = (filepath, data) => {
|
|
88
|
+
const fileContent = JSON.stringify(data, null, 2);
|
|
89
|
+
return import_fs.default.promises.writeFile(filepath, fileContent);
|
|
90
|
+
};
|
|
91
|
+
_readJSON = async (filepath) => {
|
|
92
|
+
const fileContent = await import_fs.default.promises.readFile(filepath, "utf8");
|
|
93
|
+
return JSON.parse(fileContent);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
FSKeyValueCache
|
|
99
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
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 esbuild_utils_exports = {};
|
|
20
|
+
__export(esbuild_utils_exports, {
|
|
21
|
+
buildCode: () => buildCode,
|
|
22
|
+
buildEntrypoint: () => buildEntrypoint
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(esbuild_utils_exports);
|
|
25
|
+
var import_esbuild = require("esbuild");
|
|
26
|
+
const keepNames = true;
|
|
27
|
+
function buildCode({
|
|
28
|
+
cwd,
|
|
29
|
+
minify = true,
|
|
30
|
+
bundle = true,
|
|
31
|
+
sourcemap = false,
|
|
32
|
+
logLevel = "silent",
|
|
33
|
+
outfile,
|
|
34
|
+
code,
|
|
35
|
+
write
|
|
36
|
+
}) {
|
|
37
|
+
return (0, import_esbuild.build)({
|
|
38
|
+
stdin: {
|
|
39
|
+
contents: code,
|
|
40
|
+
resolveDir: cwd,
|
|
41
|
+
loader: "ts"
|
|
42
|
+
},
|
|
43
|
+
logOverride: {
|
|
44
|
+
"equals-negative-zero": "silent"
|
|
45
|
+
},
|
|
46
|
+
platform: "node",
|
|
47
|
+
target: "es2020",
|
|
48
|
+
sourcemap,
|
|
49
|
+
minify,
|
|
50
|
+
bundle,
|
|
51
|
+
outfile,
|
|
52
|
+
absWorkingDir: cwd,
|
|
53
|
+
logLevel,
|
|
54
|
+
keepNames,
|
|
55
|
+
write
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function buildEntrypoint({
|
|
59
|
+
cwd,
|
|
60
|
+
minify = true,
|
|
61
|
+
bundle = true,
|
|
62
|
+
sourcemap = false,
|
|
63
|
+
logLevel = "silent",
|
|
64
|
+
outfile,
|
|
65
|
+
entrypoint,
|
|
66
|
+
write
|
|
67
|
+
}) {
|
|
68
|
+
return (0, import_esbuild.build)({
|
|
69
|
+
entryPoints: [entrypoint],
|
|
70
|
+
logOverride: {
|
|
71
|
+
"equals-negative-zero": "silent"
|
|
72
|
+
},
|
|
73
|
+
platform: "node",
|
|
74
|
+
target: "es2020",
|
|
75
|
+
sourcemap,
|
|
76
|
+
minify,
|
|
77
|
+
bundle,
|
|
78
|
+
outfile,
|
|
79
|
+
absWorkingDir: cwd,
|
|
80
|
+
logLevel,
|
|
81
|
+
keepNames,
|
|
82
|
+
write
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
buildCode,
|
|
88
|
+
buildEntrypoint
|
|
89
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
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 event_emitter_exports = {};
|
|
20
|
+
__export(event_emitter_exports, {
|
|
21
|
+
EventEmitter: () => EventEmitter
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(event_emitter_exports);
|
|
24
|
+
class EventEmitter {
|
|
25
|
+
listeners = {};
|
|
26
|
+
emit(type, event) {
|
|
27
|
+
const listeners = this.listeners[type];
|
|
28
|
+
if (!listeners) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
for (const listener of listeners) {
|
|
32
|
+
listener(event);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
once(type, listener) {
|
|
36
|
+
const wrapped = (event) => {
|
|
37
|
+
this.off(type, wrapped);
|
|
38
|
+
listener(event);
|
|
39
|
+
};
|
|
40
|
+
this.on(type, wrapped);
|
|
41
|
+
}
|
|
42
|
+
on(type, listener) {
|
|
43
|
+
if (!this.listeners[type]) {
|
|
44
|
+
this.listeners[type] = [];
|
|
45
|
+
}
|
|
46
|
+
this.listeners[type].push(listener);
|
|
47
|
+
}
|
|
48
|
+
off(type, listener) {
|
|
49
|
+
const listeners = this.listeners[type];
|
|
50
|
+
if (!listeners) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const index = listeners.indexOf(listener);
|
|
54
|
+
if (index !== -1) {
|
|
55
|
+
listeners.splice(index, 1);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
EventEmitter
|
|
62
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var file_watcher_exports = {};
|
|
26
|
+
__export(file_watcher_exports, {
|
|
27
|
+
FileWatcher: () => FileWatcher
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(file_watcher_exports);
|
|
30
|
+
var import_watcher = __toESM(require("@parcel/watcher"));
|
|
31
|
+
var import_event_emitter = require("./event-emitter");
|
|
32
|
+
class FileWatcher {
|
|
33
|
+
constructor(subscription, errorEmitter) {
|
|
34
|
+
this.subscription = subscription;
|
|
35
|
+
this.errorEmitter = errorEmitter;
|
|
36
|
+
}
|
|
37
|
+
static async watch(dir, fn, opt) {
|
|
38
|
+
const eventEmitter = new import_event_emitter.EventEmitter();
|
|
39
|
+
const subscription = await import_watcher.default.subscribe(
|
|
40
|
+
dir,
|
|
41
|
+
async (err, events) => {
|
|
42
|
+
if (err) {
|
|
43
|
+
eventEmitter.emit("error", err);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
await fn(events);
|
|
48
|
+
} catch (thrown) {
|
|
49
|
+
eventEmitter.emit("error", thrown);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
opt
|
|
53
|
+
);
|
|
54
|
+
return new FileWatcher(subscription, eventEmitter);
|
|
55
|
+
}
|
|
56
|
+
async close() {
|
|
57
|
+
await this.subscription.unsubscribe();
|
|
58
|
+
this.errorEmitter.emit("close", {});
|
|
59
|
+
}
|
|
60
|
+
wait = () => new Promise((resolve, reject) => {
|
|
61
|
+
this.errorEmitter.once("error", reject);
|
|
62
|
+
this.errorEmitter.once("close", resolve);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
FileWatcher
|
|
68
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var utils_exports = {};
|
|
26
|
+
__export(utils_exports, {
|
|
27
|
+
cache: () => cache,
|
|
28
|
+
emitter: () => emitter,
|
|
29
|
+
esbuild: () => esbuild,
|
|
30
|
+
filewatcher: () => filewatcher,
|
|
31
|
+
path: () => path,
|
|
32
|
+
prompt: () => prompt,
|
|
33
|
+
require: () => require2,
|
|
34
|
+
strings: () => strings
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(utils_exports);
|
|
37
|
+
var esbuild = __toESM(require("./esbuild-utils"));
|
|
38
|
+
var path = __toESM(require("./path-utils"));
|
|
39
|
+
var require2 = __toESM(require("./require-utils"));
|
|
40
|
+
var filewatcher = __toESM(require("./file-watcher"));
|
|
41
|
+
var emitter = __toESM(require("./event-emitter"));
|
|
42
|
+
var cache = __toESM(require("./cache-utils"));
|
|
43
|
+
var strings = __toESM(require("./string-utils"));
|
|
44
|
+
var prompt = __toESM(require("./prompt-utils"));
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
cache,
|
|
48
|
+
emitter,
|
|
49
|
+
esbuild,
|
|
50
|
+
filewatcher,
|
|
51
|
+
path,
|
|
52
|
+
prompt,
|
|
53
|
+
require,
|
|
54
|
+
strings
|
|
55
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var path_utils_exports = {};
|
|
26
|
+
__export(path_utils_exports, {
|
|
27
|
+
PathStore: () => PathStore,
|
|
28
|
+
absoluteFrom: () => absoluteFrom,
|
|
29
|
+
cwd: () => cwd,
|
|
30
|
+
isAbsolute: () => isAbsolute,
|
|
31
|
+
isPath: () => isPath,
|
|
32
|
+
join: () => join,
|
|
33
|
+
relativeFrom: () => relativeFrom,
|
|
34
|
+
rmExtension: () => rmExtension,
|
|
35
|
+
toUnix: () => toUnix
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(path_utils_exports);
|
|
38
|
+
var import_lodash = __toESM(require("lodash"));
|
|
39
|
+
var import_path = __toESM(require("path"));
|
|
40
|
+
const cwd = () => process.cwd();
|
|
41
|
+
const isAbsolute = (path) => import_path.default.isAbsolute(path);
|
|
42
|
+
const isPath = (path) => isAbsolute(path) || path.startsWith(".");
|
|
43
|
+
const join = (abs, ...paths) => {
|
|
44
|
+
const joined = import_path.default.join(abs, ...paths);
|
|
45
|
+
return import_path.default.normalize(joined);
|
|
46
|
+
};
|
|
47
|
+
const rmExtension = (filename) => filename.replace(/\.[^/.]+$/, "");
|
|
48
|
+
const toUnix = (path) => path.split(import_path.default.sep).join(import_path.default.posix.sep);
|
|
49
|
+
const absoluteFrom = (rootdir, target) => {
|
|
50
|
+
if (isAbsolute(target)) {
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
return import_path.default.join(rootdir, target);
|
|
54
|
+
};
|
|
55
|
+
const relativeFrom = (rootdir, target) => {
|
|
56
|
+
let absPath;
|
|
57
|
+
if (isAbsolute(target)) {
|
|
58
|
+
absPath = target;
|
|
59
|
+
} else {
|
|
60
|
+
absPath = import_path.default.resolve(import_path.default.join(rootdir, target));
|
|
61
|
+
}
|
|
62
|
+
return import_path.default.relative(rootdir, absPath);
|
|
63
|
+
};
|
|
64
|
+
class PathStore {
|
|
65
|
+
constructor(abs) {
|
|
66
|
+
this.abs = abs;
|
|
67
|
+
}
|
|
68
|
+
rel(from) {
|
|
69
|
+
return import_lodash.default.mapValues(this.abs, (to) => relativeFrom(this.abs[from], to));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
PathStore,
|
|
75
|
+
absoluteFrom,
|
|
76
|
+
cwd,
|
|
77
|
+
isAbsolute,
|
|
78
|
+
isPath,
|
|
79
|
+
join,
|
|
80
|
+
relativeFrom,
|
|
81
|
+
rmExtension,
|
|
82
|
+
toUnix
|
|
83
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var prompt_utils_exports = {};
|
|
26
|
+
__export(prompt_utils_exports, {
|
|
27
|
+
CLIPrompt: () => CLIPrompt
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(prompt_utils_exports);
|
|
30
|
+
var import_prompts = __toESM(require("prompts"));
|
|
31
|
+
class CLIPrompt {
|
|
32
|
+
constructor(_props, _logger) {
|
|
33
|
+
this._props = _props;
|
|
34
|
+
this._logger = _logger;
|
|
35
|
+
}
|
|
36
|
+
async confirm(message) {
|
|
37
|
+
if (this._props.confirm) {
|
|
38
|
+
this._logger.debug(`Confirming automatically: ${message}`);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
const { confirm } = await (0, import_prompts.default)({
|
|
42
|
+
type: "confirm",
|
|
43
|
+
name: "confirm",
|
|
44
|
+
message,
|
|
45
|
+
initial: false
|
|
46
|
+
});
|
|
47
|
+
if (!confirm) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
async password(message, opts) {
|
|
53
|
+
const { prompted } = await (0, import_prompts.default)({
|
|
54
|
+
type: "password",
|
|
55
|
+
name: "prompted",
|
|
56
|
+
message,
|
|
57
|
+
initial: opts?.initial
|
|
58
|
+
});
|
|
59
|
+
return prompted ? prompted : void 0;
|
|
60
|
+
}
|
|
61
|
+
async select(message, opts) {
|
|
62
|
+
const { prompted } = await (0, import_prompts.default)({
|
|
63
|
+
type: "autocomplete",
|
|
64
|
+
name: "prompted",
|
|
65
|
+
message,
|
|
66
|
+
initial: opts?.initial?.value,
|
|
67
|
+
choices: opts?.choices
|
|
68
|
+
});
|
|
69
|
+
return prompted ? prompted : void 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
CLIPrompt
|
|
75
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var require_utils_exports = {};
|
|
26
|
+
__export(require_utils_exports, {
|
|
27
|
+
requireJsCode: () => requireJsCode,
|
|
28
|
+
requireJsFile: () => requireJsFile
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(require_utils_exports);
|
|
31
|
+
var import_module = __toESM(require("module"));
|
|
32
|
+
var import_path = __toESM(require("path"));
|
|
33
|
+
const requireJsFile = (path) => {
|
|
34
|
+
return require(path);
|
|
35
|
+
};
|
|
36
|
+
const requireJsCode = (code) => {
|
|
37
|
+
const filedir = "tmp";
|
|
38
|
+
const filename = `${Date.now()}.js`;
|
|
39
|
+
const fileid = import_path.default.join(filedir, filename);
|
|
40
|
+
const m = new import_module.default(fileid);
|
|
41
|
+
m.filename = filename;
|
|
42
|
+
m._compile(code, filename);
|
|
43
|
+
return m.exports;
|
|
44
|
+
};
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
requireJsCode,
|
|
48
|
+
requireJsFile
|
|
49
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
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 string_utils_exports = {};
|
|
20
|
+
__export(string_utils_exports, {
|
|
21
|
+
kebabCase: () => kebabCase,
|
|
22
|
+
pascalCase: () => pascalCase
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(string_utils_exports);
|
|
25
|
+
const capitalizeFirstLetter = (string) => string.charAt(0).toUpperCase() + string.slice(1);
|
|
26
|
+
const pascalCase = (string) => {
|
|
27
|
+
const words = string.split(/[-_]/);
|
|
28
|
+
return words.map(capitalizeFirstLetter).join("");
|
|
29
|
+
};
|
|
30
|
+
const kebabCase = (string) => {
|
|
31
|
+
const words = string.split(/(?<=[a-z])(?=[A-Z])/);
|
|
32
|
+
return words.map((word) => word.toLowerCase()).join("-");
|
|
33
|
+
};
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
kebabCase,
|
|
37
|
+
pascalCase
|
|
38
|
+
});
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "pnpm run type-check && pnpm run bundle",
|
|
6
|
+
"build": "pnpm run type-check && pnpm run bundle && pnpm run template:gen && pnpm run template:type-check",
|
|
7
7
|
"dev": "ts-node -T src/index.ts",
|
|
8
8
|
"start": "node dist/index.js",
|
|
9
9
|
"type-check": "tsc --noEmit",
|
|
10
|
-
"bundle": "ts-node -T build.ts"
|
|
10
|
+
"bundle": "ts-node -T build.ts",
|
|
11
|
+
"template:type-check": "pnpm -r --stream -F './**/templates/*' run type-check",
|
|
12
|
+
"template:gen": "pnpm -r --stream -F './**/templates/*' exec bp gen"
|
|
11
13
|
},
|
|
12
14
|
"keywords": [],
|
|
13
15
|
"author": "",
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
},
|
|
18
20
|
"main": "dist/index.js",
|
|
19
21
|
"dependencies": {
|
|
20
|
-
"@botpress/client": "0.0.
|
|
22
|
+
"@botpress/client": "0.0.10",
|
|
21
23
|
"@bpinternal/yargs-extra": "^0.0.2",
|
|
22
24
|
"@parcel/watcher": "^2.1.0",
|
|
23
25
|
"@types/lodash": "^4.14.191",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@botpresshub/echo-bot",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Bot that answers with the received message",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"type-check": "tsc --noEmit"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"private": true,
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@botpress/client": "0.0.10",
|
|
14
|
+
"@botpress/sdk": "0.0.8",
|
|
15
|
+
"zod": "^3.20.6"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^18.11.17",
|
|
19
|
+
"ts-node": "^10.9.1",
|
|
20
|
+
"typescript": "^4.9.4"
|
|
21
|
+
}
|
|
22
|
+
}
|