Development Environment

  • Install javascript dependencies
    • npm install
  • Install php dependencies
    • composer install

Meilisearch

Install and run MeiliSearch server in docker :

  • Note that following command is tested with Windows Git Bash. You may adapt it for your OS.
    docker run -itd \
    -p 7700:7700 \
    -e MEILI_MASTER_KEY='findstr'\
    -v $(pwd)/meili_data:/meili_data \
    getmeili/meilisearch:v1.6 \
    meilisearch --env="development"

Docker will be started in background.

url: http://localhost:7700
password : findstr

Folder meili_data will be created in project root, ignored by git.

Working With JavaScript

  • Start JS/CSS for development
    • npm run start
  • Build JS/CSS
    • npm run build
  • Test changed files
    • npm run test --watch
  • Test all files once
    • npm run test
    • npm run test --ci
  • Build Documentation
    • npm run build:docs

Working With PHP

Autoloader

PHP classes should be located in the "php" directory and follow the PSR-4 standard.

The root namespace is FindStr.

Tests

  • Run unit tests
    • composer test:unit
  • Run WordPress tests
    • composer test:wordpress
  • Run test in docker
    • composer test:docker
  • Run all tests
    • composer test

Linter

PHPCS is installed for linting and automatic code fixing.

  • Run linter and autofix
    • composer fixes
  • Run linter to identify issues.
    • compose sniffs

Local Development Environment

A docker-compose-based local development environment is provided.

  • Start server
    • docker-compose up -d
  • Access Site
  • WP CLI
    • Run any WP CLI command in container:
      • docker-compose run wpcli wp ...
    • Setup site with WP CLI
      • docker-compose run wpcli wp core install --url=http://localhost:6091 --title="FindStr" --admin_user=findstr [email protected] --admin_password=findstr