deploy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
📋 Shared Instructions: shared-instructions.md - Cross-cutting concerns.
📋 通用说明:shared-instructions.md - 跨领域相关事项。

Deploy

部署

Builds and deploys the app in the current directory to Power Platform.
将当前目录下的应用构建并部署至Power Platform。

Workflow

工作流程

  1. Check Memory Bank → 2. Build → 3. Deploy → 4. Update Memory Bank

  1. 检查内存存储库 → 2. 构建 → 3. 部署 → 4. 更新内存存储库

Step 1: Check Memory Bank

步骤1:检查内存存储库

Check for
memory-bank.md
in the project root. If found, read it for the project name, environment, and current version. If not found, proceed — the project may have been created without the plugin.
检查项目根目录下是否存在
memory-bank.md
。如果找到,读取其中的项目名称、环境和当前版本信息。如果未找到,继续执行——该项目可能未使用插件创建。

Step 2: Build

步骤2:构建

powershell
npm run build
If the build fails:
  • TS6133 (unused import): Remove the unused import and retry.
  • Other TypeScript errors: Report the error with the file and line number and stop. Do not deploy a broken build.
Verify
dist/
exists with
index.html
before continuing.
powershell
npm run build
如果构建失败:
  • TS6133(未使用的导入):移除未使用的导入后重试。
  • 其他TypeScript错误:报告包含文件和行号的错误并停止操作。请勿部署构建失败的应用。
继续执行前,请确认
dist/
目录存在且包含
index.html
文件。

Step 3: Deploy

步骤3:部署

Ask the user: "Ready to deploy to [environment name]? This will update the live app." Wait for explicit confirmation before proceeding.
bash
pwsh -NoProfile -Command "pac code push"
Capture the app URL from the output if present.
If deploy fails, report the error and stop — do not retry silently. Common fixes are in the troubleshooting guide:
  • Auth error →
    pwsh -NoProfile -Command "pac auth create"
  • Environment mismatch →
    pwsh -NoProfile -Command "pac env select --environment <id>"
Mac fallback — if
pac code push
fails with an auth error on macOS:
pac
has known authentication bugs on Mac that can block the push. Use the npx CLI instead:
bash
npm install -g @microsoft/power-apps-cli   # skip if already installed
npx power-apps push
This is functionally equivalent to
pac code push
and bypasses the Mac auth issue.
询问用户:“是否准备部署至[环境名称]?此操作将更新线上应用。” 等待用户明确确认后再继续执行。
bash
pwsh -NoProfile -Command "pac code push"
如果输出中包含应用URL,请记录该地址。
如果部署失败,报告错误并停止操作——请勿静默重试。常见问题修复方法见故障排除指南:
  • 认证错误 →
    pwsh -NoProfile -Command "pac auth create"
  • 环境不匹配 →
    pwsh -NoProfile -Command "pac env select --environment <id>"
Mac系统备选方案——若macOS上
pac code push
因认证错误失败:
pac
在Mac上存在已知的认证Bug,可能会阻止推送操作。请改用npx CLI:
bash
npm install -g @microsoft/power-apps-cli   # 已安装可跳过
npx power-apps push
此命令与
pac code push
功能等效,可绕过Mac系统的认证问题。

Step 4: Update Memory Bank

步骤4:更新内存存储库

If
memory-bank.md
exists, increment the version (e.g.,
v1.0.0
v1.1.0
) and update:
  • Current version
  • Last deployed timestamp
  • App URL (if captured)
如果
memory-bank.md
存在,将版本号递增(例如:
v1.0.0
v1.1.0
)并更新以下内容:
  • 当前版本
  • 最后部署时间戳
  • 应用URL(若已记录)