npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

wfu-migrate

v0.1.12

Published

CLI tool for migrating WordPress multisite databases between Wake Forest University environments

Readme

WFU-Migrate

A CLI tool for migrating WordPress multisite databases between Wake Forest University environments (dev, uat, pprd, prod, local).

Key Features

  • Serialization-safe migrations: Uses WP-CLI via Docker for all search-replace operations, ensuring serialized PHP data is preserved correctly
  • Single-site migration: Migrate individual sites between any environment
  • Environment migration: Refresh entire lower environments from production
  • S3 integration: Automatic file sync and backup archival
  • Resume capability: Continue interrupted migrations from where they left off
  • Pre-flight checks: Validates prerequisites before migration

Prerequisites

  • Node.js 18+ LTS
  • Docker Desktop (for WP-CLI operations)
  • AWS CLI (for S3 operations)
  • Access to WFU database endpoints

Installation

npm install -g wfu-migrate

Or for development:

git clone <repository-url>
cd wfu-migrate
./init.sh

Quick Start

  1. Configure the tool:

    wfu-migrate config wizard
  2. Check system readiness:

    wfu-migrate doctor
  3. Migrate a single site:

    wfu-migrate migrate 123 --from prod --to dev
  4. Migrate entire environment:

    wfu-migrate env-migrate dev

Commands

migrate

Migrate a single site between environments.

wfu-migrate migrate <site-id> --from <env> --to <env> [options]

Options:

  • --from <env> - Source environment (dev, uat, pprd, prod) [required]
  • --to <env> - Target environment (dev, uat, pprd, prod, local) [required]
  • --dry-run - Preview changes without executing
  • -f, --force - Skip confirmation prompts
  • -v, --verbose - Show detailed output
  • --homepage - Include homepage (site ID 1) tables
  • --custom-domain <source:target> - Custom domain replacement
  • --skip-backup - Skip target backup (dangerous)
  • --skip-s3 - Skip S3 sync and archival
  • --work-dir <path> - Custom working directory
  • --keep-files - Keep local SQL files after completion
  • --timeout <minutes> - Timeout for database operations (default: 20)

env-migrate

Migrate full environment from production to lower environment.

wfu-migrate env-migrate <target> [options]

Target: uat, dev, or local (source is always prod)

Options:

  • --dry-run - Preview changes without executing
  • -f, --force - Skip confirmation prompts
  • -v, --verbose - Show detailed output
  • --network-only - Migrate network tables only
  • --sites-only - Migrate sites only (skip network tables)
  • --batch-size <n> - Sites per batch (default: 5)
  • --parallel - Process sites in parallel
  • --concurrency <n> - Max concurrent migrations (default: 3)
  • --include-sites <ids> - Comma-separated site IDs to include
  • --exclude-sites <ids> - Comma-separated site IDs to exclude
  • --active-only - Only migrate active sites
  • --exclude-main-site - Exclude site ID 1
  • --skip-backup - Skip environment backup
  • --skip-s3 - Skip S3 archival and sync
  • --auto-rollback - Automatically rollback on failure
  • --max-retries <n> - Retries for failed operations (default: 3)
  • --health-check - Pre/post migration health checks
  • --resume <id> - Resume incomplete migration
  • --list-migrations - List incomplete migrations
  • --skip-failed - Skip previously failed sites when resuming
  • --retry-failed - Retry only failed sites when resuming

config

Configuration management.

wfu-migrate config wizard           # Interactive setup
wfu-migrate config set <key> <val>  # Set a value
wfu-migrate config get <key>        # Get a value
wfu-migrate config list             # List all (passwords masked)
wfu-migrate config verify           # Verify configuration
wfu-migrate config reset            # Reset to defaults
wfu-migrate config import_wfuwp     # Import from wfuwp

doctor

System diagnostics and health checks.

wfu-migrate doctor

Checks:

  • Docker availability
  • MySQL client (native or Docker fallback)
  • AWS CLI configuration
  • Configuration validity
  • Environment connectivity
  • Migration database readiness
  • S3 bucket accessibility

URL Replacement Patterns

The tool handles complex URL patterns for WFU's asymmetric environment structure:

Production URLs

  • Main site: www.wfu.edu
  • Subsites: {subsite}.wfu.edu (e.g., news.wfu.edu)

Lower Environment URLs

  • Main site: {env}.wfu.edu (e.g., dev.wfu.edu)
  • Subsites: {subsite}.{env}.wfu.edu (e.g., news.dev.wfu.edu)

Local Environment URLs

  • Main site: wfu.local
  • Subsites: {subsite}.wfu.local

Configuration

Configuration is stored at ~/.wfu-migrate/config.json. Passwords are encrypted using AES-256-CBC.

Why WP-CLI?

WordPress databases contain serialized PHP data with string length prefixes:

s:15:"example.wfu.edu"

Simple SQL REPLACE() operations break this serialization by changing the string without updating the length prefix. WP-CLI correctly:

  1. Unserializes the data
  2. Performs replacements
  3. Re-serializes with correct length prefixes

Development

# Install dependencies
npm install

# Run in development mode
npm run dev -- migrate --help

# Build
npm run build

# Test
npm test

# Lint
npm run lint

License

MIT