nb portal config

更新 Portal 的开发路径、source storage 和 Git 源码配置。--path 会写入 CLI env config 的 portals.<portal>.path--source-storage--git-* 会更新远端 Portal 记录的 options。

这个命令适合在 Portal 已经创建或拉取到本地后,调整源码保存方式。比如先用默认的 nocobase 快速开发,后续再切换到 Git 仓库管理源码。

用法

nb portal config <portal> [flags]

参数

参数类型说明
<portal>stringPortal 名称或 slug
--env, -estringCLI env 名称,省略时使用当前 env
--yes, -yboolean当显式 --env 指向的 env 与当前 env 不一致时,跳过交互确认
--pathstringPortal 开发工作区目录
--source-storagenocobase | gitPortal 源码保存方式
--git-repostring--source-storage=git 时使用的 Git 仓库 URL
--git-branchstring--source-storage=git 时使用的 Git 分支
--git-pathstringGit 仓库内保存该 Portal 的目录,省略时使用仓库根目录(.

示例

修改开发工作区路径:

nb portal config customer --path ./portals/customer

切回默认的 NocoBase source storage:

nb portal config customer --source-storage nocobase

把源码配置为 Git 存储:

nb portal config customer --source-storage git --git-repo git@github.com:nocobase/customer-portal.git

调整 Git 分支和目录:

nb portal config customer --git-branch main --git-path portals/customer

在指定 env 中更新:

nb portal config customer -e dev --yes --source-storage git --git-repo git@github.com:nocobase/customer-portal.git

说明

必须至少传入一个配置项:--path--source-storage--git-repo--git-branch--git-path。如果没有任何配置变化,命令会直接退出并提示。

--path 只更新当前 env config 中记录的开发路径。--source-storage--git-* 会更新远端 Portal 记录。

--source-storage=git 时,--git-repo 必须是完整 Git remote URL,比如 https://...ssh://...file://...git@host:path/repo.git--git-path 必须是仓库内的相对路径,不能是绝对路径,也不能包含 ..

相关命令