@dbx-app/plugin-cli 0.1.0 → 0.1.2

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 CHANGED
@@ -13,15 +13,19 @@ Or run it without a global installation:
13
13
  npx @dbx-app/plugin-cli create my-plugin
14
14
  ```
15
15
 
16
- The package selects a precompiled binary for macOS, Linux, or Windows and bundles the matching Rust and Go DBX plugin SDK sources. Frontend-only plugins require only Node.js. Rust and Go are needed only when the plugin itself has a Rust or Go backend.
16
+ The package selects a precompiled binary for macOS, Linux, or Windows and bundles the matching Rust and Go DBX plugin SDK sources. Frontend-only plugins, including the Svelte template, require only Node.js. Rust and Go are needed only when the plugin itself has a Rust or Go backend.
17
17
 
18
18
  ```bash
19
19
  dbx-plugin create my-plugin --template frontend
20
+ dbx-plugin create my-svelte-plugin --template svelte
20
21
  dbx-plugin create my-rust-plugin --template rust
21
22
  dbx-plugin create my-go-plugin --template go
22
23
  dbx-plugin package my-plugin
24
+ dbx-plugin dev --path my-plugin --port 5190
23
25
  ```
24
26
 
27
+ 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.
28
+
25
29
  ## 中文说明
26
30
 
27
31
  `@dbx-app/plugin-cli` 提供预编译的 `dbx-plugin` 命令。安装时不会编译 CLI,也不需要克隆 DBX 源码仓库。
@@ -38,3 +42,5 @@ npx @dbx-app/plugin-cli create my-plugin
38
42
  ```
39
43
 
40
44
  npm 主包会自动选择当前操作系统对应的预编译二进制,并携带匹配版本的 Rust 和 Go 插件 SDK。纯前端插件只需要 Node.js;只有插件自身包含 Rust 或 Go 后端时才需要对应语言的编译环境。
45
+
46
+ 使用 `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;