@dbx-app/plugin-cli 0.1.0 → 0.1.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.
- package/README.md +5 -0
- package/bin/dbx-plugin.js +5 -0
- package/dev-runtime/runtime.mjs +3260 -0
- package/dev-runtime/ui/index.html +120 -0
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -20,8 +20,11 @@ dbx-plugin create my-plugin --template frontend
|
|
|
20
20
|
dbx-plugin create my-rust-plugin --template rust
|
|
21
21
|
dbx-plugin create my-go-plugin --template go
|
|
22
22
|
dbx-plugin package my-plugin
|
|
23
|
+
dbx-plugin dev --path my-plugin --port 5190
|
|
23
24
|
```
|
|
24
25
|
|
|
26
|
+
The `dev` subcommand requires Node.js 22+ and runs the bundled browser development runtime, without DBX or source-tree dependencies. It supports frontend-only workbenches and Rust/Go backends, with JSONL or framed transport. Optional `[dev]` `ui_build` and `ui_watch` command arrays configure project builds. Development credentials are stored locally as plaintext under `.dbx-dev/` (or `--data-dir`). Other commands retain their existing Node requirements.
|
|
27
|
+
|
|
25
28
|
## 中文说明
|
|
26
29
|
|
|
27
30
|
`@dbx-app/plugin-cli` 提供预编译的 `dbx-plugin` 命令。安装时不会编译 CLI,也不需要克隆 DBX 源码仓库。
|
|
@@ -38,3 +41,5 @@ npx @dbx-app/plugin-cli create my-plugin
|
|
|
38
41
|
```
|
|
39
42
|
|
|
40
43
|
npm 主包会自动选择当前操作系统对应的预编译二进制,并携带匹配版本的 Rust 和 Go 插件 SDK。纯前端插件只需要 Node.js;只有插件自身包含 Rust 或 Go 后端时才需要对应语言的编译环境。
|
|
44
|
+
|
|
45
|
+
使用 `dbx-plugin dev --path my-plugin --port 5190` 可在浏览器运行通用插件开发环境,无需启动 DBX。仅 `dev` 要求 Node.js 22+;运行时及外壳已包含在 npm 包中。开发配置和凭据以明文保存在 `.dbx-dev/`,不要提交或打包该目录。
|
package/bin/dbx-plugin.js
CHANGED
|
@@ -67,6 +67,11 @@ try {
|
|
|
67
67
|
const binary = resolveBinary();
|
|
68
68
|
const env = { ...process.env };
|
|
69
69
|
delete env.DBX_PLUGIN_CLI_BINARY;
|
|
70
|
+
if (process.argv[2] === "dev") {
|
|
71
|
+
if (Number(process.versions.node.split(".")[0]) < 22) throw new Error("dbx-plugin dev requires Node.js 22+.");
|
|
72
|
+
env.DBX_PLUGIN_NODE = env.DBX_PLUGIN_NODE || process.execPath;
|
|
73
|
+
env.DBX_PLUGIN_DEV_RUNTIME = env.DBX_PLUGIN_DEV_RUNTIME || join(packageRoot, "dev-runtime", "runtime.mjs");
|
|
74
|
+
}
|
|
70
75
|
if (!env.DBX_PLUGIN_SDK_ROOT) {
|
|
71
76
|
const sdkRoot = bundledSdkRoot();
|
|
72
77
|
if (sdkRoot) env.DBX_PLUGIN_SDK_ROOT = sdkRoot;
|