定制 locomotive-agency/blockyard 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

locomotive-agency/blockyard

Composer 安装命令:

composer require locomotive-agency/blockyard

包简介

CLI tool for scaffolding and building WordPress blocks

README 文档

README

A Project-Centric PHP tool for scaffolding and building WordPress Block projects with automated environments and remote configuration support.

Features

  • Project-Centric Workflow: Manage multiple blocks under a single project container.
  • Fast Scaffolding: Create new blocks in < 1 second using local templates.
  • Block Templates: Support for specialized block types (e.g., accordion).
  • Magic Previews: Instant testing in WordPress Playground with auto-insertion into a live preview page.
  • Shared Dependencies: Save disk space by sharing one node_modules across all projects.
  • Remote Configuration: (Optional) Sync project metadata and Blueprints from a central API.

Installation

Install Blockyard globally:

composer global require locomotive-agency/blockyard

Note: Ensure your Composer bin directory is in your $PATH.

One-Time Setup

Install global shared dependencies (WordPress build tools):

blockyard setup

Getting Started

1. Initialize a Project

Create a project container. This holds your shared configuration and WordPress environment settings.

# Standard local initialization
blockyard init --name="My Project" --namespace="my-blocks" --author="Your Name"

2. Create a Block

Run this inside your project folder to scaffold a new block:

cd my-project
blockyard create-block --name="Feature Card"

Available Block Templates:

  • default - Basic content block
  • accordion - Collapsible content panels
  • slider - Image carousel with navigation
  • tabs - Tabbed interface for content organization
  • hero - Full-width hero section with background image and CTAs
  • card - Versatile card component (image + content + CTA)
  • cta - Prominent call-to-action section

Example with template:

blockyard create-block --name="Image Gallery" --type=slider

3. Build, Preview & Deploy

Navigate to your block folder to develop and test:

cd feature-card

# Build production assets
blockyard build

# Start the magic preview
blockyard preview

# Package as a WordPress Plugin
blockyard deploy

# Package as Static HTML
blockyard deploy --target=html

4. Deploy Your Block

Package the block for WordPress or static sites:

WordPress Plugin (Default):

cd feature-card
blockyard deploy
# Creates: dist/feature-card.zip (ready to upload to WordPress)

Static HTML:

blockyard deploy --target=html
# Creates: dist/static/
#   - block.html (clean snippet)
#   - index.html (standalone preview)
#   - build/ (CSS/JS assets)

The static HTML deployment automatically:

  • Boots WordPress Playground
  • Renders your block server-side
  • Extracts the real HTML
  • Generates production-ready files

5. Yard Login and Run Deployment (MVP)

Authenticate once, then deploy app metadata to Yard:

# OAuth login (stores ~/.blockyard/tokens.json)
blockyard login

# Verify current identity from Yard (/v1/me)
blockyard whoami

# Queue a deployment in Yard (/v1/apps/deploy)
blockyard deploy --target=run --app=test --mode=public

--target=run supports:

  • --app=<slug>: target app slug (defaults from block.json name)
  • --mode=public|private: deployment mode
  • --regions=us,eu or explicit regions (us-central1,europe-west1)
  • --commit=<sha>: override commit SHA (defaults to git rev-parse HEAD)
  • --json: machine-readable output

CLI Reference

CommandOptionDescription
init--remoteUse API to fetch project data.
create-block--typedefault, accordion, slider, tabs, hero, card, cta.
deploy--targetplugin (default), html, run.
deploy--outOutput directory (default: dist).
deploy--target=runQueue app deploy in Yard (--app, --mode, --regions, --commit).
login--jsonOAuth login and local token cache (~/.blockyard/tokens.json).
whoami--jsonShow current Yard identity using stored token.

Advanced: Remote Configuration

Blockyard can be integrated with a central API to manage project configurations across a team. This is useful for agencies wanting to standardize namespaces and WordPress Blueprints.

Environment Setup

Create a .env file in the current directory or ~/.blockyard/.env:

YARD_API_URL="https://yard-xxxxx-uc.a.run.app"
BLOCKYARD_OAUTH_CLIENT_ID="...apps.googleusercontent.com"
BLOCKYARD_OAUTH_CLIENT_SECRET="..." # optional
BLOCKYARD_ALLOWED_DOMAIN="company.com"

Using Remote Mode

When initializing, use the --remote flag to pull configuration from your API:

blockyard init --remote --client=123

--remote is Yard-only:

  • Requires YARD_API_URL
  • Requires a valid login token from blockyard login
  • Uses:
    • GET {YARD_API_URL}/v1/clients/{id}
    • GET {YARD_API_URL}/v1/clients/{id}/blueprint

Author

Locomotive Agency
Website: locomotive.agency

Release Automation

  • elease-flow.ps1 supports rerunnable prepare/publish release flow for protected main. See scripts/scripts.md for the full release procedure.

    License

GPL-2.0-or-later

locomotive-agency/blockyard 适用场景与选型建议

locomotive-agency/blockyard 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cli」 「wordpress」 「scaffolding」 「blocks」 「gutenberg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 locomotive-agency/blockyard 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 locomotive-agency/blockyard 我们能提供哪些服务?
定制开发 / 二次开发

基于 locomotive-agency/blockyard 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 25
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-02-05