wp-tools v0.4.1
wp-tools (wpt)
wp-tools (wpt) is a command line interface to reduce boring tasks when
working on WordPress plugin / theme project that will be published to wp.org.
Most commands in wpt are shamelessly borrowed from existing task runner plugin
(see credits) so that you can run it without task runner and embed it easily in
npm scripts (which is the main goal of wpt).
Install
$ npm install -g wp-toolsUsage
Once installed globally, wpt should be available from shell.
$ wpt
Usage: [options] [command]
Commands:
bump:wp-version [options] <from> <to> Bump WP version in readme.txt
generate:pot [options] Generate POT.
generate:readme-md [options] Generate README.md from readme.txt.
generate:release-zip [options] Generates project zip like in wp.org without releasing.
info [options] View plugin/theme project info.
init [options] Initialize .wpt.yaml.
release:gh [options] Release the project to GitHub.
release:wporg [options] Release the project to WP.org.
preview:gh Preview GitHub README.md.
validate:i18n [options] Check your code for incorrect text-domain.
validate:readme-txt Check your readme.txt.
Options:
-h, --help output usage information
-V, --version output the version numberFor more help on specific command, supply -h or --help, for example:
$ wpt init -h
Usage: init [options]
Initialize .wpt.yaml in current directory.
If .wpt.yml exists in current directory, it will read that first, and default to the options there.
Options:
-h, --help output usage information
-d, --use-defaults Use only defaults and not prompt you for any options.Project Config (.wpt.yml)
Some commands in wpt expect config file to be present in your project directory. To add / modify config file in a project:
$ wpt initJust like npm init this will create .wpt.yml file. Following is an example
of .wpt.yml content:
type: plugin
files:
src:
- '**'
- '!node_modules/**'
- '!vendor/**'
- '!tests/**'
- '!test/**'
- '!build/**'
- '!tmp/**'
- '!README.md'
main: slack.php
assets:
- assets/*.png
gh:
username: gedex
repo: gedex/wp-slack
branch: master
wporg:
slug: slack
username: akeda
buildPath: buildtypeis project type (plugin or theme).files.srcis list of files / patterns that are part of the plugin or theme. All files that match with the pattern will be pushed to wp.org when using commandrelease:wporg. Commandwpt generate:potalso uses matched files to scan gettext functions.files.mainis main file of the plugin or theme. For theme it should bestyle.css.files.assetsis list of files / patterns that are assets in wp.org. See here.gh.usernameis your GitHub username, if the project is hosted on GitHub.gh.repois GitHub repository with following format:owner/repoFor example https://github.com/Automattic/jetpack would be
Automattic/jetpack.gh.branchis git branch for stable release. If not specified it defaults tomaster. This branch is checkout'ed when releasing to GitHub and wp.org.wporg.slugis the plugin slug in wp.org directory.wporg.usernameis your wp.org username that has commit access to the plugin svn. Required by commandwpt release:wporg.wporg.buildPathis the directory containing all files to be pushed to wp.org. By default it's underbuildof current directory. The directory must be gitignore'ed. The checkout, diff, and commit are performed against this directory.
Credits
License
MIT