tapcart-blocks

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Tapcart Blocks & Components

Tapcart Blocks 与 Components

Manage Tapcart blocks and global components. Blocks and components have identical operations — this skill covers both. All commands run from the root of the Tapcart project directory.
You (the agent) run all commands directly unless noted otherwise.

管理Tapcart Blocks和全局Components。Blocks和Components的操作完全相同——本技能涵盖两者。所有命令都需要在Tapcart项目目录的根目录下运行。
你(即Agent)直接运行所有命令,除非另有说明。

Create

创建

Run the create command, then confirm to the user what was created:
bash
undefined
运行创建命令,然后向用户确认已创建的内容:
bash
undefined

Block

Block

tapcart block create <BlockFolderName>
tapcart block create <BlockFolderName>

Component

Component

tapcart component create <ComponentFolderName>

After creating, tell the user how to start the dev server (see Dev Server below).

---
tapcart component create <ComponentFolderName>

创建完成后,告知用户如何启动开发服务器(见下方“开发服务器”部分)。

---

Pull

拉取

Run the pull command to sync from the Tapcart dashboard to the local
./blocks
or
./components
folder:
bash
undefined
运行拉取命令,将Tapcart仪表板上的内容同步到本地的
./blocks
./components
文件夹:
bash
undefined

Pull all blocks

拉取所有Blocks

tapcart block pull -a
tapcart block pull -a

Pull specific block(s)

拉取指定Block(s)

tapcart block pull -b MyBlock tapcart block pull -b BlockOne -b BlockTwo
tapcart block pull -b MyBlock tapcart block pull -b BlockOne -b BlockTwo

Pull a specific version of a block

拉取指定版本的Block

tapcart block pull -b MyBlock -v 2
tapcart block pull -b MyBlock -v 2

Pull all components

拉取所有Components

tapcart component pull -a
tapcart component pull -a

Pull specific component(s)

拉取指定Component(s)

tapcart component pull -c ProductCard tapcart component pull -c ProductCard -c Button
tapcart component pull -c ProductCard tapcart component pull -c ProductCard -c Button

Pull a specific version of a component

拉取指定版本的Component

tapcart component pull -c ProductCard -v 3

Constraints:
- `-a` and `-b`/`-c` cannot be combined
- `-v` can only be used with a single block/component name

---
tapcart component pull -c ProductCard -v 3

约束条件:
- `-a` 与 `-b`/`-c` 不能同时使用
- `-v` 仅能与单个Block/Component名称配合使用

---

Push

推送

Before pushing, read the local
code.jsx
and
config.json
to confirm the changes look correct, then confirm with the user before running.
bash
undefined
推送前,先读取本地的
code.jsx
config.json
文件,确认更改内容无误,然后在运行前征得用户确认。
bash
undefined

Push a specific block (creates new version, not live)

推送指定Block(创建新版本,不上线)

tapcart block push -b MyBlock
tapcart block push -b MyBlock

Push and set the new version live immediately

推送并立即将新版本设置为上线状态

tapcart block push -b MyBlock --live
tapcart block push -b MyBlock --live

Push multiple blocks

推送多个Blocks

tapcart block push -b BlockOne -b BlockTwo
tapcart block push -b BlockOne -b BlockTwo

Push all blocks

推送所有Blocks

tapcart block push -a
tapcart block push -a

Push a specific component

推送指定Component

tapcart component push -c ProductCard
tapcart component push -c ProductCard

Push and set live

推送并设置为上线状态

tapcart component push -c ProductCard --live
tapcart component push -c ProductCard --live

Push all components

推送所有Components

tapcart component push -a

> **Warning**: `--live` makes the new version immediately visible to all app users. Default to pushing without `--live` and then using `versions set` after the user has verified the result.

---
tapcart component push -a

> **警告**:`--live`参数会使新版本立即对所有应用用户可见。默认情况下应不使用`--live`参数进行推送,待用户验证结果后再使用`versions set`命令设置上线。

---

Dev Server

开发服务器

Run the dev server in the background and tell the user it is running. Keep it running until the user asks you to stop it.
bash
undefined
在后台运行开发服务器,并告知用户服务器已启动。保持服务器运行,直到用户要求停止。
bash
undefined

Block dev server

Block开发服务器

tapcart block dev -b MyBlock tapcart block dev -b MyBlock -p 4995 # custom port, default is 4995
tapcart block dev -b MyBlock tapcart block dev -b MyBlock -p 4995 # 自定义端口,默认端口为4995

Component dev server

Component开发服务器

tapcart component dev -c ProductCard tapcart component dev -c ProductCard -p 4996 # default is 4996

The dev server opens at `http://localhost:<port>` (block default: 4995, component default: 4996).

When the user asks to stop the dev server, terminate the process.

---
tapcart component dev -c ProductCard tapcart component dev -c ProductCard -p 4996 # 默认端口为4996

开发服务器的访问地址为`http://localhost:<port>`(Block默认端口:4995,Component默认端口:4996)。

当用户要求停止开发服务器时,终止该进程。

---

Versions

版本管理

List versions

列出版本

Run this and show the output to the user:
bash
tapcart block versions list -b MyBlock
tapcart component versions list -c ProductCard
Output shows each version number, which is local, and which is live on the dashboard.
运行以下命令并将输出展示给用户:
bash
tapcart block versions list -b MyBlock
tapcart component versions list -c ProductCard
输出内容会显示每个版本号、该版本是否为本地版本,以及哪个版本在仪表板上处于上线状态。

Set a version live

设置版本上线

Confirm with the user which version to promote, then run:
bash
tapcart block versions set -b MyBlock -v 2
tapcart component versions set -c ProductCard -v 3
Version numbers are 1-based (version 1 is the first push).
向用户确认要推广的版本,然后运行:
bash
tapcart block versions set -b MyBlock -v 2
tapcart component versions set -c ProductCard -v 3
版本号从1开始计数(版本1为首次推送的版本)。