Skip to content

Softwire/wp-install

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wp-install

What is wp-install?

It's like npm install for WordPress.

WordPress encourages the use of long-lived servers:

  • Plugins are typically downloaded directly to a running server, rather than being stored in source control
  • WordPress (and it's plugins) update themselves by downloading new code directly to the server
  • To deploy a custom theme, a developer typically FTP's files to a running server

This goes against the modern idea of Immutable Infrastructure.

This package is here to help make immutable WordPress deployment easier!
This package:

  • Downloads the latest version of WordPress and puts it in a ./dist folder.
  • Downloads the latest version of the WordPress plugins that you configure in .wp-install.yml
  • Copies plugins that you have saved locally
  • Copies your custom theme that you have saved locally

This ends up with a working WordPress installation in ./dist/wordpress that you can serve or deploy.

Installation

npm install wp-install -g

This will install wp-install globally so it can be run from the command line.

Usage

  • Create a file .wp-install.yml
    The structure should be like this:
---
cache-folder: .wordpress-download-cache  # Optional - this is the default value
dist-folder: dist  # Optional - this is the default value

plugins-to-download:  # Optional
  plugins:
  - name: custom-post-type-ui
  - name: custom-post-type-permalinks

plugins-to-copy:  # Optional
  directory: plugins-to-copy
  plugins:
  - name: advanced-custom-fields-pro
    type: directory
    directory: advanced-custom-fields-pro
  - name: advanced-custom-fields-pro-2
    type: zip
    filename: advanced-custom-fields-pro-2.zip

custom-theme:  # Optional
  directory: my-custom-theme
  • In the same folder as .wp-install.yml simply run:
wp-install

What does it do? / what are the options?

  • Deletes and re-creates a ./dist folder.

  • Downloads WordPress:

    • It checks the WordPress.org API (specifically the Version Checker) to find which version of WordPress to download.
      Note: it chooses the first offer with response:"upgrade".
    • Downloads the file to .wordpress-download-cache/wordpress/[version]
    • Unzips WordPress into the ./dist/wordpress folder
  • Plugins (part 1) - download plugins

    • Looks in .wp-install.yml to see if you want to download any plugins from WordPress.org
      This is configured in the plugins-to-download section.
    • Checks the WordPress.org API to find which version of the plugin to download.
      For instance, for the custom-post-type-ui plugin, uses this page on the API
    • Downloads the plugin to .wordpress-download-cache/plugins/[plugin-name]
    • Unzips the plugin to ./dist/wordpress/wp-content/plugins/
  • Plugins (part 2) - locally saved plugins

    • Looks in .wp-install.yml to see if you have any locally saved plugins to copy
    • Plugins can be folders or zip files
  • Copies your custom theme

    • Looks in .wp-install.yml to see if you have a custom theme to copy
    • The theme is copied to ./dist/wordpress/wp-content/themes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published