From 83ef9cba1350eb5e5e4ffa6c7e15b584f31ed286 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Mon, 10 Feb 2020 14:09:08 +0600 Subject: [PATCH 1/3] Getting Started Docs: Update to use --- README.md | 1 + docs/contributors/getting-started.md | 23 +++++++---------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c11f2a71a5650..b0ff20fdfc4c2 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This repo is the development hub for the download the latest release from the WordPress.org plugins repository. - **Discuss:** Conversations and discussions take place in `#core-editor` channel on the Making WordPress Slack. - **Contribute:** Development of Gutenberg happens in this GitHub repo. Get started by reading the contributing guidelines. +- **Develop:** Just want to run Gutenberg locally to tinker with it? See Getting Started. - **Learn:** Discover more about the project on WordPress.org. **Gutenberg is more than an editor.** While the project is currently focused on building the new editor for WordPress, it doesn't end there. This lays the groundwork for a new model for WordPress Core that will ultimately impact the entire publishing experience of the platform. diff --git a/docs/contributors/getting-started.md b/docs/contributors/getting-started.md index 7171ad4017196..3836dd9b13946 100644 --- a/docs/contributors/getting-started.md +++ b/docs/contributors/getting-started.md @@ -21,9 +21,7 @@ If you don't have a local WordPress environment to load Gutenberg in, we can hel ### Step 1: Installing a Local Environment -#### Quickest Method: Using Docker - -The quickest way to get up and running is to use the provided Docker setup. If you don't already have it, you'll need to install Docker and Docker Compose. +The quickest way to get up and running is to use the [`wp-env` command](https://github.com/WordPress/gutenberg/tree/master/packages/env), which is developed within the Gutenberg source repository, and published as `@wordpress/env` to npm. If you don't already have it, you'll need to install Docker and Docker Compose in order to use `wp-env`. To install Docker, follow their instructions here for [Windows 10 Pro](https://docs.docker.com/docker-for-windows/install/), [all other version of Windows](https://docs.docker.com/toolbox/toolbox_install_windows/), [macOS](https://docs.docker.com/docker-for-mac/install/), or [Linux](https://docs.docker.com/v17.12/install/linux/docker-ce/ubuntu/#install-using-the-convenience-script). If running Ubuntu, see these [extended instructions for help and troubleshooting](/docs/contributors/env-ubuntu.md). @@ -32,7 +30,7 @@ To install Docker Compose, [follow their instructions here](https://docs.docker. Once Docker is installed and running, run this script to install WordPress, and build your local environment: ```bash -npm run env install +npx wp-env start ``` #### Alternative Method: Using an Existing Local WordPress Install @@ -57,17 +55,10 @@ In Windows, you can set the `WP_DEVELOP_DIR` environment variable using the appr #### Accessing the Local WordPress Install -Whether you decided to use Docker or an existing local WordPress install, the WordPress installation should now be available at `http://localhost:8889` (**Username**: `admin`, **Password**: `password`). -If this port is in use, you can override it using the `LOCAL_PORT` environment variable. For example running the below command on your computer will change the URL to -`http://localhost:7777` . - -Linux/macOS: `export LOCAL_PORT=7777` -Windows using Command Prompt: `setx LOCAL_PORT "7777"` -Windows using PowerShell: `$env:LOCAL_PORT = "7777"` - -If you're running [e2e tests](/docs/contributors/testing-overview.md#end-to-end-testing), this change will be used correctly. +The WordPress installation should now be available at `http://localhost:8888` (**Username**: `admin`, **Password**: `password`). +If this port is in use, you can override it using the `WP_ENV_PORT` environment variable. For more information, consult the `wp-env` [README](https://github.com/WordPress/gutenberg/blob/master/packages/env/README.md). -To shut down this local WordPress instance run `npm run env stop`. To start it back up again, run `npm run env start`. +To shut down this local WordPress instance run `npx wp-env stop`. To start it back up again, run `npx wp-env start` again. #### Toggling Debug Systems @@ -76,14 +67,14 @@ WordPress comes with specific [debug systems](https://wordpress.org/support/arti Example on Linux/MacOS: ```bash -LOCAL_SCRIPT_DEBUG=false LOCAL_WP_DEBUG=false npm run env install +LOCAL_SCRIPT_DEBUG=false LOCAL_WP_DEBUG=false npx wp-env start ``` By default, both flags will be set to `true`. #### Troubleshooting -You might find yourself stuck on a screen stating that "you are running WordPress without JavaScript and CSS files". If you tried installing WordPress via `npm run env install`, it probably means that something went wrong during the process. To fix it, try removing the `/wordpress` folder and running `npm run env install` again. +See the [relevant section in `wp-env` docs](https://github.com/WordPress/gutenberg/tree/master/packages/env#troubleshooting-common-problems). ## On A Remote Server From 743c26ca21f447b2889d3f1d07664c860fcc671d Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Mon, 10 Feb 2020 14:37:39 +0600 Subject: [PATCH 2/3] Link to .wp-env.json to use local WP install --- docs/contributors/getting-started.md | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/docs/contributors/getting-started.md b/docs/contributors/getting-started.md index 3836dd9b13946..2a2d1a2bb9978 100644 --- a/docs/contributors/getting-started.md +++ b/docs/contributors/getting-started.md @@ -21,7 +21,9 @@ If you don't have a local WordPress environment to load Gutenberg in, we can hel ### Step 1: Installing a Local Environment -The quickest way to get up and running is to use the [`wp-env` command](https://github.com/WordPress/gutenberg/tree/master/packages/env), which is developed within the Gutenberg source repository, and published as `@wordpress/env` to npm. If you don't already have it, you'll need to install Docker and Docker Compose in order to use `wp-env`. +The quickest way to get up and running is to use the [`wp-env` command](https://github.com/WordPress/gutenberg/tree/master/packages/env), which is developed within the Gutenberg source repository, and published as `@wordpress/env` to npm. In its default mode, it'll install and run a local WordPress environment for you; however, it's also possible to [configure](https://github.com/WordPress/gutenberg/blob/master/packages/env/README.md#wp-envjson) it to use a pre-existing local WordPress installation. + +If you don't already have it, you'll need to install Docker and Docker Compose in order to use `wp-env`. To install Docker, follow their instructions here for [Windows 10 Pro](https://docs.docker.com/docker-for-windows/install/), [all other version of Windows](https://docs.docker.com/toolbox/toolbox_install_windows/), [macOS](https://docs.docker.com/docker-for-mac/install/), or [Linux](https://docs.docker.com/v17.12/install/linux/docker-ce/ubuntu/#install-using-the-convenience-script). If running Ubuntu, see these [extended instructions for help and troubleshooting](/docs/contributors/env-ubuntu.md). @@ -33,24 +35,6 @@ Once Docker is installed and running, run this script to install WordPress, and npx wp-env start ``` -#### Alternative Method: Using an Existing Local WordPress Install - -WordPress will be installed in the `wordpress` directory, if you need to access WordPress core files directly, you can find them there. - -If you already have WordPress checked out in a different directory, you can use that installation, instead, by running these commands: - -```bash -export WP_DEVELOP_DIR=/path/to/wordpress-develop -npm run env connect -``` - -This will use WordPress' own local environment, and mount your Gutenberg directory as a volume there. - -In Windows, you can set the `WP_DEVELOP_DIR` environment variable using the appropriate method for your shell: - -- CMD: `set WP_DEVELOP_DIR=/path/to/wordpress-develop` -- PowerShell: `$env:WP_DEVELOP_DIR = "/path/to/wordpress-develop"` - ### Step 2: Accessing and Configuring the Local WordPress Install #### Accessing the Local WordPress Install From 65f5ad065799c49ab8bb2f581842ec1b28baea9f Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Mon, 10 Feb 2020 14:41:09 +0600 Subject: [PATCH 3/3] Update note on debug systems --- docs/contributors/getting-started.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/contributors/getting-started.md b/docs/contributors/getting-started.md index 2a2d1a2bb9978..1a5656887b360 100644 --- a/docs/contributors/getting-started.md +++ b/docs/contributors/getting-started.md @@ -46,15 +46,7 @@ To shut down this local WordPress instance run `npx wp-env stop`. To start it ba #### Toggling Debug Systems -WordPress comes with specific [debug systems](https://wordpress.org/support/article/debugging-in-wordpress/) designed to simplify the process as well as standardize code across core, plugins and themes. It is possible to use environment variables (`LOCAL_WP_DEBUG` and `LOCAL_SCRIPT_DEBUG`) to update a site's configuration constants located in `wp-config.php` file. Both flags can be disabled at any time by running the following command: - -Example on Linux/MacOS: - -```bash -LOCAL_SCRIPT_DEBUG=false LOCAL_WP_DEBUG=false npx wp-env start -``` - -By default, both flags will be set to `true`. +WordPress comes with specific [debug systems](https://wordpress.org/support/article/debugging-in-wordpress/) designed to simplify the process as well as standardize code across core, plugins and themes. In order to use with `wp-env,` you'll have to edit your local WordPress install's `wp-config.php`. #### Troubleshooting