0.1.0 • Published 8 months ago

wordpress-setup v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

wordpress-setup

A tool for setting up a modern, developer-friendly WordPress development environment.

Usage

  1. Set up a config file:

wpsu.config.js

export default {
  locations: [{
    src: 'myTheme',
    dest: 'wp-content/themes/yourTheme'
  }, {
    src: 'myPlugin',
    dest: 'wp-content/plugins/myPlugin'
  }],
  infra: {
    production: {
      base_url: 'mywordpressblog.com'
      server: {
        user: 'sshUsername',
        password: 'sshPassword',
        host: 'sshHost',
        path: '/the/path/to/your/wordpress/root/www',
        private_key_file: '/path/to/your/ssh/pk/file'
      },
      database: {
        host: 'dbHost',
        user: 'dbUser',
        password: 'dbPassword',
        name: 'dbName',
        credentials_file: '/path/to/remote/cred/file'
      }
    },
    test: {
      base_url: 'test.mywordpressblog.com',
      server: {}, // same structure as the production env
      database: {}, // same structure as the production env
    },
    local: {
      base_url: 'localhost:1234' // The URL you locally want to develop on
    }
  }
}

Use .env files (process.env) for secrets

  1. npx wpsu pull: pulls all web files and a DB dump from the production server into a directory wp-YYYYMMDDHHMMSS

To set up a local dev server

  1. npx wpsu setup-docker
  2. docker compose up

To set up a remote test environment

  1. npx wpsu push-db
  2. npx wpsu push-web