@commercetools-frontend/create-mc-app

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

Create Merchant Center applications to quickly get up and running

原始使用文档
文档目录7 节
  1. Local Development
  2. How It Works
  3. Prerequisites
  4. Workflow
  5. Quick Reference
  6. Key Points
  7. Troubleshooting

@commercetools-frontend/create-mc-app

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

Check out the documentation for more information.

Local Development

This guide is for internal developers who want to modify starter templates and test changes locally without publishing a new release.

How It Works

The CLI clones templates from the GitHub repository (not your local filesystem). This means you must push template changes to a git branch before testing them locally.

Prerequisites

  • Repository cloned locally
  • pnpm installed
  • Git push access to the repository

Workflow

1. Make Template Changes

Edit files in the template directories:

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

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

2. Commit and Push to a Branch

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. Run the Local CLI with Your Branch

From the repository root:

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

Important: Use relative paths (e.g., my-test-app) not absolute paths (e.g., /Users/name/my-test-app).

4. Verify Your Changes

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

Quick Reference

# 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

Key Points

  • ✅ Must push changes to git - Templates are cloned from GitHub, not copied from local filesystem
  • ✅ Use relative paths - Avoid absolute paths starting with /
  • ✅ Use --template-version - Specify your branch name to test changes
  • ✅ No npm publish needed - Test directly with git branches
  • ✅ Test before merging - Validate template changes work correctly before merging to main

Troubleshooting

Error: "Name contains illegal characters"

  • You're using an absolute path. Use a relative path instead (e.g., my-app instead of /Users/name/my-app)

Templates not reflecting changes

  • Ensure you've pushed your changes to the git branch
  • Verify the --template-version flag matches your branch name

版本与发布记录

@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 是什么?

Create Merchant Center applications to quickly get up and running

如何安装 @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 和提交记录判断。