package-script-writer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Package Script Writer (psw)

Package Script Writer(psw)

Generate and run Umbraco CMS installation scripts using the
psw
CLI tool.
使用
psw
CLI工具生成并运行Umbraco CMS安装脚本。

Workflow

操作流程

  1. Check if PSW CLI is installed:
    bash
    psw --version
    If command not found, the .NET tools path may not be in PATH. Try:
    • Linux/Mac:
      export PATH="$PATH:$HOME/.dotnet/tools" && psw --version
    • Windows:
      %USERPROFILE%\.dotnet\tools\psw --version
  2. If not installed, install it:
    bash
    dotnet tool install --global PackageScriptWriter.Cli
  3. Then run the psw command (see below)
  1. 检查PSW CLI是否已安装:
    bash
    psw --version
    如果未找到该命令,可能是.NET工具路径未添加到PATH中。尝试:
    • Linux/Mac:
      export PATH="$PATH:$HOME/.dotnet/tools" && psw --version
    • Windows:
      %USERPROFILE%\.dotnet\tools\psw --version
  2. 如果未安装,请进行安装:
    bash
    dotnet tool install --global PackageScriptWriter.Cli
  3. 然后运行psw命令(见下文)

Non-Interactive Usage (Claude Code)

非交互式使用(Claude Code)

This is the command to use:
bash
export PATH="$PATH:$HOME/.dotnet/tools"
psw -d -n ProjectName -s ProjectName -u --database-type SQLite --admin-email admin@test.com --admin-password SecurePass1234 --auto-run
Run this with
run_in_background: true
since Umbraco is a long-running web server.
Critical flags:
  • -d
    - REQUIRED - generates the full installation script (without this, only
    dotnet run
    is generated which fails)
  • -u
    - use unattended install defaults
  • --auto-run
    - execute the script immediately
  • Never combine
    -o
    with
    --auto-run
    (truncates the script)
Default credentials:
admin@test.com
/
SecurePass1234
要使用的命令:
bash
export PATH="$PATH:$HOME/.dotnet/tools"
psw -d -n ProjectName -s ProjectName -u --database-type SQLite --admin-email admin@test.com --admin-password SecurePass1234 --auto-run
请在
run_in_background: true
的情况下运行此命令,因为Umbraco是长期运行的Web服务器。
关键参数:
  • -d
    - 必填 - 生成完整的安装脚本(如果没有此参数,仅会生成
    dotnet run
    ,这会导致执行失败)
  • -u
    - 使用无人值守安装默认值
  • --auto-run
    - 立即执行生成的脚本
  • 切勿将
    -o
    --auto-run
    组合使用(会截断脚本)
默认凭据:
admin@test.com
/
SecurePass1234

With Packages

安装扩展包

bash
psw -d -n ProjectName -s ProjectName -u --database-type SQLite --admin-email admin@test.com --admin-password "SecurePass1234" -p "uSync,Umbraco.Forms" --auto-run
With specific versions:
bash
psw -d -n ProjectName -s ProjectName -u --database-type SQLite --admin-email admin@test.com --admin-password "SecurePass1234" -p "uSync|17.0.0,Umbraco.Forms|17.0.1" --auto-run
bash
psw -d -n ProjectName -s ProjectName -u --database-type SQLite --admin-email admin@test.com --admin-password "SecurePass1234" -p "uSync,Umbraco.Forms" --auto-run
指定版本的情况:
bash
psw -d -n ProjectName -s ProjectName -u --database-type SQLite --admin-email admin@test.com --admin-password "SecurePass1234" -p "uSync|17.0.0,Umbraco.Forms|17.0.1" --auto-run

IMPORTANT

重要提示

Do not use characters that are escapable in passwords or usernames
请勿在密码或用户名中使用可转义的字符

Key Options

主要选项

FlagDescription
-d, --default
REQUIRED - generates full installation script
-n, --project-name
Project name
-s, --solution
Solution name
-u, --unattended-defaults
Use unattended install defaults
--database-type
SQLite, LocalDb, SQLServer, SQLAzure, SQLCE
--admin-email
Admin email for unattended install
--admin-password
Admin password for unattended install
--auto-run
Execute the generated script
-p, --packages
Comma-separated packages (e.g., "uSync,Umbraco.Forms")
-t, --template-package
Umbraco template with optional version
-da, --delivery-api
Enable Content Delivery API
参数描述
-d, --default
必填 - 生成完整的安装脚本
-n, --project-name
项目名称
-s, --solution
解决方案名称
-u, --unattended-defaults
使用无人值守安装默认值
--database-type
SQLite, LocalDb, SQLServer, SQLAzure, SQLCE
--admin-email
无人值守安装的管理员邮箱
--admin-password
无人值守安装的管理员密码
--auto-run
执行生成的脚本
-p, --packages
逗号分隔的扩展包(例如:"uSync,Umbraco.Forms")
-t, --template-package
Umbraco模板(可指定版本)
-da, --delivery-api
启用内容交付API

Waiting for Umbraco to Start

等待Umbraco启动

After running the command in background, poll for readiness:
bash
undefined
在后台运行命令后,轮询检查服务是否就绪:
bash
undefined

Check the output for the port number (e.g., "Now listening on: https://localhost:44356")

检查输出中的端口号(例如:"Now listening on: https://localhost:44356")

Then poll until ready:

然后轮询直到就绪:

for i in {1..30}; do if nc -z localhost 44356 2>/dev/null; then echo "Umbraco is ready!" break fi sleep 2 done
undefined
for i in {1..30}; do if nc -z localhost 44356 2>/dev/null; then echo "Umbraco is ready!" break fi sleep 2 done
undefined

Other Commands

其他命令

bash
psw versions              # Show Umbraco versions with support status
psw history list          # Show recent scripts
psw history rerun 1       # Re-run script #1
psw --clear-cache         # Clear cached API responses
bash
psw versions              # 显示Umbraco版本及支持状态
psw history list          # 显示最近生成的脚本
psw history rerun 1       # 重新运行编号为1的脚本
psw --clear-cache         # 清除缓存的API响应