Skip to content

Latest commit

 

History

History
122 lines (76 loc) · 3.26 KB

INITIAL.md

File metadata and controls

122 lines (76 loc) · 3.26 KB

Initial Local Setup

Ensure the requirements are installed locally.

  1. Open Local, click on the plus sign (+) in the bottom left corner.

  2. Select "Create a new site".

  3. Press "Continue" in the bottom right corner.

  4. Expand the "Advanced options".

  5. Enter a name (ie "MyApp CMS") as the site name.

  6. (Optional) Update the local domain (like "cms.myapp.local").

  7. (Optional) Update the location for the app (like /Users/me/projects/myapp-cms).

  8. Press "Continue" in the bottom right corner.

  9. Select "Custom".

  10. Select php version 8.1.X

  11. Select Apache as the web server.

  12. Select MySQL version 8.0.x

  13. Press "Continue" in the bottom right corner.

  14. Enter a Wordpress username (keep track of this).

  15. Enter a Wordpress password (keep track of this).

  16. Enter an email address to use with the Wordpress installation (keep track of this).

  17. Press "Add Site" in the bottom right corner.

Local should create a generic site with a MySQL database. The code will be located in the location defined in step 7 above (or the default ~/Local Sites/myapp-cms). The folder structure in the site folder will be like:

myapp-cms
├── app
│   └── public // Wordpress files
├── conf
└── logs

In a terminal:

  1. Navigate to the public folder that holds the Wordpress files.

  2. From within the public folder remove the wp-content folder and all of its content.

    rm -rf wp-content
  3. Clone this repo into wp-content (replace my_org and my_healess_wordpress_repo_name).

    git clone git@github.com:my_org/my_healess_wordpress_repo_name.git wp-content
  4. Open the VS Code workspace file (hw.code-workspace) located inside the cloned repo.

  5. Go to extensions and search for @recommended.

  6. Install recommended extensions.

    Pro tip:

    When installing extensions ins VS Code, you can install, then disable the extension. This makes the extension available, but disabled globally. Then, click on the "gear" next to the extension and select "Enable (Workspace)". This will make the extension enabled only in this workspace and not interfere with other projects.

Linting

  1. Clone Wordpress Coding Standards (https://github.com/WordPress/WordPress-Coding-Standards/tree/main) in a location outside of the project.

  2. Create an environment variable called WCS_PATH with the value of the path to the WordPress-Coding-Standards repo.

    # For Bash
    echo 'export WCS_PATH=/path/to/WordPress-Coding-Standards' >> ~/.bashrc
    
    # For Zsh
    echo 'export WCS_PATH=/path/to/WordPress-Coding-Standards' >> ~/.zshrc
  3. Source the rule configuration file.

    # For Bash
    source ~/.bashrc
    
    # For Zsh
    source ~/.zshrc
  4. For convenience, symlink phpcs to usr/local/bin

    sudo ln -s $WCS_PATH/vendor/squizlabs/php_codesniffer/bin/phpcs /usr/local/bin/phpcs
  5. Configure phpcs (PHP Code Sniffer) to use the WordPress Coding Standards sniffs

    phpcs --config-set installed_paths $WCS_PATH
  6. Set the WordPress rules to be the default global rules that phpcs uses.

    phpcs --config-set default_standard WordPress

The app is now ready for development.