wplease

1.0.26 • Public • Published

WPlease

GitHub package version npm node GitHub license

WPlease is a toolkit for Wordpress development which allows to keep only specific code in a Wordpress development repository and rebuild or manipulate it quickly from a repo specific config file.

Features

With WPlease, in one command line you can:

Build a Wordpress working instance from scratch

Build a preconfigured Wordpress working instance from your github repo that contains only your pecific code

Generate a custom theme and plugin on install and auto gitignore it

Update (add/remove) plugins and themes from the lists in wplease.json

Add or remove a theme or a plugin from files and from wplease.json

Wpleasify (init) an existing Wordpress project repository

Remove all gitignored files from the project

Getting Started

To build a Wordpress instance with WPlease, you must have a Wordpress operating environment and some additional libraries.

Prerequisites

Caution

For existing repos, please backup your files and database before using WPlease.

Installing WPlease

You should install this module as a global module.

npm install -g wplease

Creating new Wordpress project

Create a basic Wordpress install from scratch.

mkdir my-project
cd my-project
wplease install

WPleasify existing project

You can turn an existing Wordpress project on for WPlease. This create the required WPlease files and add existing plugins and themes to the wplease.json file. Make sure your git repo is clean and all changes commited before using it.

cd my-project
wplease init --sync

You can check your wplease.json file about the plugins and themes. Then you can remove all useless files from your repository.

wplease delete

Then commit all changes, you're done!

git add --all
git commit "Remove useless files for WPlease"

Advanced usage

Initialize your project

wplease init

This command suggests you to create or override thoses files into your project:

  • The wplease.json file to customize your Wordpress installation
  • The .gitignore file to ignore the whole wordpress code.
  • The .gitattributes file.
  • The .editorconfig file.

Warning: Since version 1.0.10, wpleasefile.js and wpleasefile.json files became wplease.json. Please run the init script to generate the new file, then update your config.

Customize your Wordpress config

Then edit the wplease.json to customize your Wordpress install. For example, your can simply specify a custom plugins list:

{
  "name": "my-project",
  "config": {
    "locale": "fr_FR",
    "debug": false,
    "post_revisions": 5,
    "disable_cron": false,
    "disallow_file_edit": true
  },
  "themes": [
    "@my-project"
  ],
  "plugins": [
    "wp-edit",
    "maintenance-switch",
    "@my-project"
  ],
  "options": {
    "timezone_string": "Europe/Paris",
    "show_on_front": "page",
    "page_on_front": 3
  }
}

Note: Custom themes and plugins need to be prefixed by "@". "Custom" means that the extension does not exist on the Wordpress repository. The wplease install command add it on theme or plugin generation but alternatively you can fill it manually in your wplease.json.

Build Wordpress in your project

Then you can run your custom install.

wplease install

Tip: You can directly add your project name to skip prompts. wplease install my-project

Add or remove a Wordpress theme or plugin

You can specify a type of extension and the extension name.

wplease add plugin user-role-editor
wplease remove theme origin

Tip: You simply can call the short command like wplease add or wplease remove and the script ask your for the extension type and name.

Sync your Wordpress themes and plugins

wplease sync

This command suggests you to synchronize your plugins and themes from your wplease.json lists.

 ? What to sync
 ❯◉ all
  ◯ plugins
  ◯ themes

Tip: You can directly add the sync type to skip prompts. wplease sync plugins

Script prompts

During installing, the script will ask you about several informations like the database and site creditentials. Your Wordpress instance will be quickly ready to use.

...
 
Defining site and admin settings...
 
? Site url            my-website.loc
? Site title          My Website
? Admin login         admin
? Admin email         admin@my-website.com
? Admin password      [hidden]
 
...

License

This project is licensed under the MIT License - see the LICENSE file for details

Package Sidebar

Install

npm i wplease

Weekly Downloads

9

Version

1.0.26

License

MIT

Unpacked Size

69.9 kB

Total Files

18

Last publish

Collaborators

  • fugudesign