commerce-app-init
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInitialize a new Commerce App
初始化新的Commerce应用
Scaffolds a bare Adobe Commerce app: creates with metadata,
then runs to install dependencies and generate all required project files.
Extensibility domains (events, webhooks, business config) are added separately via domain skills.
app.commerce.config.tsinit搭建一个空白的Adobe Commerce应用:创建包含元数据的,然后运行命令安装依赖并生成所有必需的项目文件。扩展领域(事件、Webhook、业务配置)需通过领域技能单独添加。
app.commerce.config.tsinitStep 1 — Create the config
步骤1 — 创建配置文件
If already exists in the project root, do not overwrite it — skip straight to Step 2 (this skill is safe to re-invoke on an app that already has a config). Otherwise, derive values for the following fields from the user's intent, confirm, and write the file to the project root:
app.commerce.config.tsts
// app.commerce.config.ts
import { defineConfig } from "@adobe/aio-commerce-lib-app/config";
export default defineConfig({
metadata: {
id: "my-commerce-app", // alphanumeric + hyphens only, max 100 chars
displayName: "My Commerce App", // shown in App Management UI, max 50 chars
description: "...", // max 255 chars
version: "1.0.0", // Major.Minor.Patch only, no pre-release identifiers
},
});See assets/app.commerce.config.ts for the full annotated template.
如果项目根目录中已存在,请勿覆盖它——直接跳至步骤2(此技能可安全地在已有配置的应用上重新调用)。否则,根据用户的需求推导以下字段的值,确认后将文件写入项目根目录:
app.commerce.config.tsts
// app.commerce.config.ts
import { defineConfig } from "@adobe/aio-commerce-lib-app/config";
export default defineConfig({
metadata: {
id: "my-commerce-app", // alphanumeric + hyphens only, max 100 chars
displayName: "My Commerce App", // shown in App Management UI, max 50 chars
description: "...", // max 255 chars
version: "1.0.0", // Major.Minor.Patch only, no pre-release identifiers
},
});查看assets/app.commerce.config.ts获取完整的带注释模板。
Step 2 — Initialize the project
步骤2 — 初始化项目
Always run init — it finds the existing config, validates it, and handles project setup:
sh
npx @adobe/aio-commerce-lib-app initSince already exists, init skips the interactive prompts. Re-running is safe: when a config is present it installs dependencies and (re)generates the project files — the package is regenerated, while user packages under are preserved (see Project structure below).
app.commerce.config.tsapp-managementsrc/commerce-extensibility-1/actions/For a TypeScript Commerce config, init also creates missing and root files, installs compatible , , and development dependencies, and adds to the project's composed script. Generated Runtime actions remain JavaScript. Once this scaffolding is in place, user-authored runtime actions (added via the domain skills below) and custom installation scripts () can be written in — see the aio-commerce-lib-app usage guide for the full migration steps if converting an existing JavaScript project.
webpack-config.cjstsconfig.jsontypescriptts-loader@tsconfig/basestypecheck:actionstypecheckcommerce-app-storage.ts始终要运行init命令——它会查找现有配置,验证其有效性,并处理项目设置:
sh
npx @adobe/aio-commerce-lib-app init由于已存在,init命令会跳过交互式提示。重复运行是安全的:当配置存在时,它会安装依赖并(重新)生成项目文件——包会被重新生成,而下的用户包会被保留(见下方项目结构)。
app.commerce.config.tsapp-managementsrc/commerce-extensibility-1/actions/对于TypeScript Commerce配置,init命令还会创建缺失的和根目录下的文件,安装兼容的、和开发依赖,并将添加到项目的组合脚本中。生成的Runtime操作仍为JavaScript。一旦搭建完成,用户编写的Runtime操作(通过下方的领域技能添加)和自定义安装脚本()可以用编写——如果要转换现有JavaScript项目,请查看aio-commerce-lib-app使用指南获取完整迁移步骤。
webpack-config.cjstsconfig.jsontypescriptts-loader@tsconfig/basestypecheck:actionstypecheckcommerce-app-storage.tsProject structure
项目结构
After init, the project has two types of directories under :
src/- — custom runtime actions for webhooks and events. Register them in
src/commerce-extensibility-1/actions/under a user-defined package name (any name exceptsrc/commerce-extensibility-1/ext.config.yaml, which is reserved by the framework). These surviveapp-management— the generator only regenerates theaio app buildpackage.app-management - — auto-generated by
src/commerce-extensibility-1/.generated/. Treat as read-only; any manual edits here will be overwritten.aio app build - — managed by
src/commerce-configuration-1/. Treat as read-only.aio app build - Root — checks the TypeScript Commerce config and generated Runtime actions while excluding Admin UI
tsconfig.json, which has its own TypeScript configuration.web-src
初始化完成后,项目的目录下有两种类型的文件夹:
src/- — 用于Webhook和事件的自定义Runtime操作。在
src/commerce-extensibility-1/actions/中,在用户定义的包名下注册它们(除src/commerce-extensibility-1/ext.config.yaml之外的任意名称,该名称为框架保留)。这些文件在app-management时会保留——生成器仅重新生成aio app build包。app-management - — 由
src/commerce-extensibility-1/.generated/自动生成。请将其视为只读文件;此处的任何手动编辑都会被覆盖。aio app build - — 由
src/commerce-configuration-1/管理。请将其视为只读文件。aio app build - 根目录下的— 检查TypeScript Commerce配置和生成的Runtime操作,同时排除Admin UI的
tsconfig.json,后者有自己的TypeScript配置。web-src
Step 3 — Verify the config
步骤3 — 验证配置
Build the project to confirm everything is valid:
sh
aio app buildIf the config is invalid, the build fails with a detailed validation error pointing to the offending field.
构建项目以确认所有内容均有效:
sh
aio app build如果配置无效,构建会失败并显示详细的验证错误,指出有问题的字段。
Common Issues
常见问题
- validation error:
idaccepts alphanumeric characters and hyphens only — no dots, underscores, or spaces.metadata.id - validation error: Only numeric semver is accepted (
version). Pre-release identifiers (1.0.0) are not supported.1.0.0-beta - not found: Ensure
defineConfigis installed and imported from@adobe/aio-commerce-lib-app.@adobe/aio-commerce-lib-app/config
- 验证错误:
id仅接受字母数字字符和连字符——不允许使用点、下划线或空格。metadata.id - 验证错误:仅接受数字语义化版本(如
version)。不支持预发布标识符(如1.0.0)。1.0.0-beta - 未找到:确保已安装
defineConfig,并从@adobe/aio-commerce-lib-app导入。@adobe/aio-commerce-lib-app/config
Quality Bar
质量标准
- completes without errors
aio app build
- 无错误完成
aio app build
Chaining
衔接流程
After passes:
aio app build-
Bootstrap the Developer Console — for any follow-up topic related to App Builder setup (Console project/workspace, API subscriptions, deploy, run, workspace wiring), invoke skill(from
appbuilder-project-init). Tell it:adobe/skills- Skip the steps — the Commerce scaffold already exists
aio app init - Subscribe (I/O Management API) as part of the workspace bootstrap — required for IMS credential syncing at runtime
AdobeIOManagementAPISDK - Once the workspace is created, ask the user whether their Commerce backend is ACCS (Adobe Commerce as Cloud Service) or PaaS. If ACCS, must also be subscribed: run
ACCS-REST-APIto open the workspace in the browser, then add it manually through the Developer Console UI. Do not proceed until the user confirms it has been added.aio console open
Ifis not installed, ask the user to install it first:appbuilder-project-initshnpx skills add adobe/skills --skill appbuilder-project-init -y - Skip the
-
Extend with domain skills — once the workspace is wired:
- — manage Commerce and external event sources
commerce-app-eventing - — manage webhook interception
commerce-app-webhooks - — manage custom business configuration
commerce-app-business-config - — extend the Commerce Admin UI with custom columns, mass actions, order view buttons, or menu entries
commerce-app-admin-ui - — back runtime actions with persistent, queryable DB storage
commerce-app-storage
aio app build-
引导开发者控制台 — 对于任何与App Builder设置相关的后续主题(控制台项目/工作区、API订阅、部署、运行、工作区连接),调用技能(来自
appbuilder-project-init)。告知它:adobe/skills- 跳过步骤——Commerce脚手架已存在
aio app init - 在工作区引导过程中订阅(I/O管理API)——这是运行时IMS凭据同步所必需的
AdobeIOManagementAPISDK - 工作区创建完成后,询问用户其Commerce后端是ACCS(Adobe Commerce云服务)还是PaaS。如果是ACCS,还必须订阅:运行
ACCS-REST-API在浏览器中打开工作区,然后通过开发者控制台UI手动添加。在用户确认已添加之前,请勿继续。aio console open
如果未安装,请要求用户先安装它:appbuilder-project-initshnpx skills add adobe/skills --skill appbuilder-project-init -y - 跳过
-
使用领域技能扩展 — 工作区连接完成后:
- — 管理Commerce和外部事件源
commerce-app-eventing - — 管理Webhook拦截
commerce-app-webhooks - — 管理自定义业务配置
commerce-app-business-config - — 使用自定义列、批量操作、订单视图按钮或菜单项扩展Commerce Admin UI
commerce-app-admin-ui - — 为Runtime操作提供持久化、可查询的数据库存储
commerce-app-storage
References
参考资料
- assets/app.commerce.config.ts — Minimal config template
- assets/app.commerce.config.ts — 最小配置模板