@commercetools-frontend/create-mc-app

中文文档
27.17.1发布于 2026/11/11MITESM + CJS构建来源已验证近 30 天下载 1.4万

创建Merchant Center 应用程序以快速起动并运行

中文使用文档
文档目录7 节
  1. 地方发展
  2. 如何运作
  3. 先决条件
  4. 工作流程
  5. 快速引用
  6. 关键点
  7. 解决问题

@ commercialtools- frontend/ create- mc- app

Latest release (latest dist-tag) Latest release (next dist-tag) Minified + GZipped size GitHub license

看看这个 文档 更多信息.

地方发展

此指南用于 内部开发者 想要在本地修改启动模板并测试更改而无需发布新版本.

如何运作

GitHub 寄存器中的 CLI 克隆模板( 不是您的本地文件系统) 。 这意味着您必须在本地测试前将模板更改推向 git 分支 .

先决条件

  • 本地克隆仓库
  • pnpm 已安装
  • Git 推动访问仓库

工作流程

1. 修改模板

编辑模板目录中的文件 :

# For custom applications
application-templates/starter/
application-templates/starter-typescript/

# For custom views
custom-views-templates/starter/
custom-views-templates/starter-typescript/

2. 向一个处提交和推动

git checkout -b my-template-changes # create a new branch
git add application-templates/starter/ # do this after you make changes
git commit -m "chore(templates): add welcome header to starter template"
git push origin my-template-changes # push the changes to the new branch

3. 与你的分行一起运行本地CLI

从寄存器根 :

NODE_ENV=test node packages/create-mc-app/bin/cli.js my-test-app \
  --template starter \
  --template-version my-template-changes # important: use the branch name you created

重要内容: 使用相对路径( 例如 ), my-test-app非绝对路径(例如, /Users/name/my-test-app) (中文(简体) ).

4. 校验您的更改

cd my-test-app # navigate to the new app
yarn start # verify your template changes are present

快速引用

# Complete workflow
git checkout -b template-updates # create a new branch
# ... make changes to application-templates/starter/ (e.g., add a welcome message) ...
git add application-templates/starter/ # do this after you make changes
git commit -m "chore(templates): update landing page styles"
git push origin template-updates # push the changes to the new branch

cd packages/create-mc-app
pnpm build
cd ../..

NODE_ENV=test node packages/create-mc-app/bin/cli.js test-project \
  --template starter \
  --template-version template-updates

cd test-project # navigate to the new app
yarn start # verify your template changes are present

关键点

  • ✅ 必须推动更改到 git - 模板从 GitHub 复制,而不是从本地文件系统复制
  • ✅ 使用相对路径 - 避免从绝对路径开始 /
  • ✅ 使用 --template-version - 指定您的分支名称以测试更改
  • ✅ 不需要 npm 发布 - 直接用树枝进行试验
  • ✅ 合并前的测试 - 在合并到 main

解决问题

错误: “ 名称包含非法字符 ”

  • 你在用一条绝对的道路 取而代之的是使用相对路径(例如, my-app 改为 /Users/name/my-app(中文(简体) )

不反映变化的模板

  • 确保您已经将您的更改推向了 Git 分支
  • 校验 --template-version 旗帜匹配您的分支名称

版本与发布记录

@commercetools-frontend/create-mc-app 共发布 1,428 个版本,首次发布于 2019/01/03;过去 12 个月发布了 204 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
27.17.1latest2026/11/11今天
0.0.0-canary-202611101453512026/11/10今天
0.0.0-canary-202611061943342026/11/073 天前
0.0.0-canary-202611060847432026/11/064 天前
0.0.0-canary-202611060848452026/11/064 天前
27.17.02026/11/046 天前

其他发布通道:rc → 21.0.0-rc.1,preview → 22.36.0-preview.0,FEC-157-preview-releases → 0.0.0-FEC-157-preview-releases-20241126231507,testing-workflow → 0.0.0-testing-workflow-20241126234621,testing-comment-workflow → 0.0.0-testing-comment-workflow-20241204141931,rc-preview-demo-cm → 0.0.0-rc-preview-demo-cm-20250130161121。

关于 @commercetools-frontend/create-mc-app 的常见问题

@commercetools-frontend/create-mc-app 是什么?

创建Merchant Center 应用程序以快速起动并运行

如何安装 @commercetools-frontend/create-mc-app?

在项目目录运行 npm install @commercetools-frontend/create-mc-app,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 create-mc-app,可以用 npx create-mc-app 直接运行。

@commercetools-frontend/create-mc-app 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/commercetools-frontend__create-mc-app 是否存在。

@commercetools-frontend/create-mc-app 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@commercetools-frontend/create-mc-app 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^22.23.4 || ^24.22.1 || >=26.12.1。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@commercetools-frontend/create-mc-app 可以商用吗?

@commercetools-frontend/create-mc-app 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@commercetools-frontend/create-mc-app 的下载量有多少?

根据 npm 官方下载统计,@commercetools-frontend/create-mc-app 在 2026/10/11 – 2026/11/09 这 30 天内被下载 13,825 次,日均约 461 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@commercetools-frontend/create-mc-app 还在维护吗?

最新版本 27.17.1 发布于 2026/11/11(今天);至今共发布 1428 个版本,其中过去 12 个月发布了 204 个;首次发布于 2019/01/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。