wpconstructor/scripts 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wpconstructor/scripts

Composer 安装命令:

composer require wpconstructor/scripts

包简介

WPConstructor Scripts: Composer-driven PHP scripts for building, backing up, and distributing WordPress plugins consistently and safely.

README 文档

README

WPConstructor Scripts Logo

A collection of Composer-driven PHP scripts for building, backing up, and distributing WordPress plugins consistently and safely.

Why I Built WPConstructor Scripts

While building WordPress plugins, I kept repeating the same Composer scripts—copying assets, creating ZIPs, backing up files, and securing directories. It became repetitive and error-prone.

So I built WPConstructor Scripts: a reusable setup that handles all the common plugin build tasks in one place, instead of rewriting them every time.

Installation

Install WPConstructor Scripts via Composer as a dev dependency:

composer require wpconstructor/scripts --dev

Then, add the following to your plugin’s composer.json under the "scripts" section:

"scripts": {
    "build:update": "php vendor/wpconstructor/scripts/scripts/build-vendor.php && php vendor/wpconstructor/scripts bin/copy-assets.php && php vendor/wpconstructor/scripts/scripts/add-index-php.php && npx @wpconstructor minify-assets assets",
    "build": "php vendor/wpconstructor/scripts/bin/run-build.php",
    "cfp": "php vendor/wpconstructor/scripts/bin/cfp.php",
    "clean": "php vendor/wpconstructor/scripts/bin/clean.php",
    "backup:packages": "php vendor/wpconstructor/scripts/bin/backup-packages.php",
    "backup:plugin": "php vendor/wpconstructor/scripts/bin/backup-plugin.php",
    "backup:all-plugins": "php vendor/wpconstructor/scripts/bin/backup-all-plugins.php"
}

Usage Examples

Asset & Security Helpers

  • Build Update
composer run build:update

Updates plugin assets to the correct directories, creating nested folders like:
assets/wpconstructor/dashboard/images.

  • Add Index Files (included in build)
    Automatically adds index.php to all asset directories to prevent directory listing.

Build & Distribution

  • Build Plugin
composer run build

Runs the full build process:

  1. Copies vendor files to build-vendor
  2. Removes empty directories
  3. Adds index.php files to assets.
  4. Creates a distributable ZIP in build/plugin-name-version-date.zip or set in build-zip.manifest.json.
  • Clean Project
composer run clean

Removes empty directories and cleans build artifacts.

Maintenance Utilities

  • Check File Permissions
composer run cfp

Scans your WordPress installation for files without write permissions.

Backup Scripts

  • Backup Current Plugin
composer run backup:plugin

Creates a backup of the current plugin in wordpress-root/../plugin-backups.

  • Backup All Plugins
composer run backup:all-plugins

Backs up all plugins to wordpress-root/../all-plugins-backup.

Optional:

composer run backup:all-plugins -- --only-wpconstr
  • Backup Packages Directory
composer run backup:packages

Backs up the entire packages directory to wordpress-root/../packages-backup.

One Workflow, Everywhere

With WPConstructor Scripts, every plugin build looks the same:

  1. Assets copied
  2. Vendors trimmed
  3. Empty directories removed
  4. Index files added
  5. ZIP created
  6. Backups secured

No guessing. No half-forgotten steps. No copy-pasting scripts between repos.

License

MIT License © 2026 by WPConstructor

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固