vitadeck-deck-app-init
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInitialize a Deck App (standalone)
初始化独立Deck App
What is a Deck App?
什么是Deck App?
A Deck App is a user-authored interactive experience that runs on VitaDeck on PlayStation Vita (or the desktop host). You write it in React against the VitaDeck Runtime API ( components like , , ).
@vitadeck/sdkScreenTextButtonAt build time, the SDK compiles your Deck App Source Entry ( by default) into a Deck App Package — a portable folder (plus a archive for upload). The package contains your compiled app and metadata; VitaDeck supplies React and the runtime on device.
src/App.tsx.vdapp.vdapp.zipThis workflow assumes a standalone project anywhere on disk, using the published npm package — not the VitaDeck monorepo.
Deck App是由用户编写的交互式体验应用,可在PlayStation Vita(或桌面主机)上的VitaDeck中运行。你可以使用React基于VitaDeck Runtime API(提供的、、等组件)进行开发。
@vitadeck/sdkScreenTextButton在构建阶段,SDK会将你的Deck App源码入口(默认是)编译成Deck App包——一个可移植的文件夹(以及用于上传的压缩包)。该包包含编译后的应用和元数据;VitaDeck会在设备端提供React和运行时环境。
src/App.tsx.vdapp.vdapp.zip本工作流适用于磁盘任意位置的独立项目,使用已发布的npm包——而非VitaDeck单仓库。
Prerequisites
前置条件
- Node.js 22+
- npm, pnpm, or Bun
- VitaDeck installed on Vita (or desktop host) to run the built package
- Node.js 22+
- npm、pnpm或Bun
- VitaDeck已安装在Vita设备上(或桌面主机),用于运行构建后的包
Quick start
快速开始
From the directory where the new project should live:
sh
npx @vitadeck/sdk create my-deck-app
cd my-deck-app
npm installEdit — the default export is your Deck App Component (root UI for the full Vita display).
src/App.tsxBuild:
sh
npx @vitadeck/sdk build在要创建新项目的目录下执行:
sh
npx @vitadeck/sdk create my-deck-app
cd my-deck-app
npm install编辑——默认导出的是你的Deck App组件(适配Vita全屏显示的根UI)。
src/App.tsx构建:
sh
npx @vitadeck/sdk buildor: npm run build
或:npm run build
Outputs under `dist/` (from `vitadeck.config.json`):
- `dist/<slug>.vdapp/` — unpacked **Deck App Package**
- `dist/<slug>.vdapp.zip` — **Runtime Upload Archive** for LAN publish
The `<slug>` is derived from the project `name` in `vitadeck.config.json` (e.g. `my-deck-app` → `my-deck-app.vdapp`).
输出文件位于`dist/`目录下(配置来自`vitadeck.config.json`):
- `dist/<slug>.vdapp/` —— 解压后的**Deck App包**
- `dist/<slug>.vdapp.zip` —— 用于局域网发布的**运行时上传压缩包**
`<slug>`由`vitadeck.config.json`中的项目`name`派生而来(例如`my-deck-app` → `my-deck-app.vdapp`)。What create
generates
createcreate
命令生成的文件
create| File | Purpose |
|---|---|
| Deck App manifest: |
| Pins |
| Deck App Source Entry — default-exported root component |
| TypeScript env for Deck App globals |
| Extends |
Optional fields: (overrides semver in the built manifest), (named font files copied into the package).
vitadeck.config.jsonversionpackage.jsonfonts| 文件 | 用途 |
|---|---|
| Deck App清单:包含 |
| 固定 |
| Deck App源码入口——默认导出的根组件 |
| Deck App全局变量的TypeScript环境声明文件 |
| 继承 |
vitadeck.config.jsonversionpackage.jsonfontsAfter scaffolding
脚手架搭建完成后
- Typecheck: or
npx tscnpm run tsc - Iterate: edit , rebuild with
src/App.tsxnpx @vitadeck/sdk build - Skip zip: when only the
npx @vitadeck/sdk build --no-zipfolder is needed.vdapp - Deploy to Vita: upload via Runtime Upload — see vitadeck-vdapp-upload
dist/*.vdapp.zip
- 类型检查:执行或
npx tscnpm run tsc - 迭代开发:编辑,执行
src/App.tsx重新构建npx @vitadeck/sdk build - 跳过压缩:当仅需要文件夹时,执行
.vdappnpx @vitadeck/sdk build --no-zip - 部署到Vita设备:通过运行时上传功能上传——详见vitadeck-vdapp-upload
dist/*.vdapp.zip
Requirements and constraints
要求与限制
- React 18.3.x — peer dependency; build fails if another major/minor is resolved
- Entry must default-export one React component; do not call VitaDeck registration APIs — the SDK generates that
- Package version in the built comes from
manifest.jsonpackage.jsonunlessversionsetsvitadeck.config.jsonversion
- React 18.3.x —— 对等依赖;如果解析到其他主版本/次版本,构建会失败
- 入口文件必须默认导出一个React组件;不要调用VitaDeck注册API——SDK会自动生成相关代码
- 构建后中的包版本来自
manifest.json的package.json字段,除非version设置了vitadeck.config.json字段version
Troubleshooting
故障排除
- — pass a project folder name:
Usage: vitadeck create <project-name>npx @vitadeck/sdk create my-app - Target directory already exists — pick a new name or remove the existing folder
- React version error — ensure is
reactin18.3.x, then reinstallpackage.json - Wrong context — inside the VitaDeck monorepo, examples live under and use workspace linking; this skill is for external projects only
js/examples/
- —— 需要传入项目文件夹名称:
Usage: vitadeck create <project-name>npx @vitadeck/sdk create my-app - 目标目录已存在 —— 选择新名称或删除现有文件夹
- React版本错误 —— 确保中
package.json版本为react,然后重新安装依赖18.3.x - 上下文错误 —— 在VitaDeck单仓库内,示例项目位于并使用工作区链接;本指南仅适用于外部项目
js/examples/
Links
链接
- npm: @vitadeck/sdk
- SDK readme: js/packages/sdk/README.md
- npm:@vitadeck/sdk
- SDK说明文档:js/packages/sdk/README.md