diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b84a8171aa4b6..0c45ba5f9ccb1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -2,7 +2,11 @@
## Getting Started
-Gutenberg is a Node.js-based project, built primarily in JavaScript. Be sure to have Node.js installed first. You should be running a Node version matching the [current active LTS release](https://github.com/nodejs/Release#release-schedule) or newer for this plugin to work correctly. You can check your Node.js version by typing `node -v` in the Terminal prompt.
+Gutenberg is a Node.js-based project, built primarily in JavaScript.
+
+The easiest way to get started is by running the Local Environment setup script, `./bin/setup-local-env.sh`. This will check if you have everything installed and updated, and help you download any extra tools you need.
+
+If you prefer to set things up manually, be sure to have Node.js installed first. You should be running a Node version matching the [current active LTS release](https://github.com/nodejs/Release#release-schedule) or newer for this plugin to work correctly. You can check your Node.js version by typing `node -v` in the Terminal prompt.
You should also have the latest release of npm installed, npm is a separate project from Node.js and is updated frequently. If you've just installed Node.js which includes a version of npm within the installation you most likely will need to also update your npm install. To update npm, type this into your terminal: `npm install npm@latest -g`
@@ -13,7 +17,7 @@ To test the plugin, or to contribute to it, you can clone this repository and bu
First, you need a WordPress Environment to run the plugin on. The quickest way to get up and running is to use the provided docker setup. Just install [docker](https://www.docker.com/) on your machine and run `./bin/setup-local-env.sh`.
The WordPress installation should be available at `http://localhost:8888` (username: `admin`, password: `password`).
-Inside the "docker" directory, you can use any docker command to interact with your containers.
+Inside the "docker" directory, you can use any docker command to interact with your containers. If this port is in use, you can override it in your `docker-compose.override.yml` file. If you're running [e2e tests](https://wordpress.org/gutenberg/handbook/reference/testing-overview/#end-to-end-testing), this change will be used correctly.
Alternatively, you can use your own local WordPress environment and clone this repository right into your `wp-content/plugins` directory.
diff --git a/bin/includes.sh b/bin/includes.sh
new file mode 100755
index 0000000000000..d0028a1c66575
--- /dev/null
+++ b/bin/includes.sh
@@ -0,0 +1,134 @@
+#!/bin/bash
+
+##
+# Ask a Yes/No question, and way for a reply.
+#
+# This is a general-purpose function to ask Yes/No questions in Bash, either with or without a default
+# answer. It keeps repeating the question until it gets a valid answer.
+#
+# @param {string} prompt The question to ask the user.
+# @param {string} [default] Optional. "Y" or "N", for the default option to use if none is entered.
+# @param {int} [timeout] Optional. The number of seconds to wait before using the default option.
+#
+# @returns {bool} true if the user replies Yes, false if the user replies No.
+##
+ask() {
+ # Source: https://djm.me/ask
+ local timeout endtime timediff prompt default reply
+
+ while true; do
+
+ timeout="${3:-}"
+
+ if [ "${2:-}" = "Y" ]; then
+ prompt="Y/n"
+ default=Y
+ elif [ "${2:-}" = "N" ]; then
+ prompt="y/N"
+ default=N
+ else
+ prompt="y/n"
+ default=
+ timeout=
+ fi
+
+ if [ -z "$timeout" ]; then
+ # Ask the question (not using "read -p" as it uses stderr not stdout)
+ echo -en "$1 [$prompt] "
+
+ # Read the answer (use /dev/tty in case stdin is redirected from somewhere else)
+ read reply /dev/null 2>&1
+}
diff --git a/bin/install-docker.sh b/bin/install-docker.sh
new file mode 100755
index 0000000000000..3335abdc0714b
--- /dev/null
+++ b/bin/install-docker.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+# Exit if any command fails
+set -e
+
+# Include useful functions
+. "$(dirname "$0")/includes.sh"
+
+# Check that Docker is installed
+if ! command_exists "docker"; then
+ echo -e $(error_message "Docker doesn't seem to be installed. Please head on over to the Docker site to download it: $(action_format "https://www.docker.com/community-edition#/download")")
+ exit 1
+fi
+
+# Check that Docker is running
+if ! docker info >/dev/null 2>&1; then
+ echo -e $(error_message "Docker isn't running. Please check that you've started your Docker app, and see it in your system tray.")
+ exit 1
+fi
+
+# Launch the containers
+echo -e $(status_message "Updating and starting Docker containers...")
+if ! docker-compose up -d; then
+ # Launching may fail due to the docker config file directory having changed.
+ # Remove the old wordpress-dev container, and try again.
+ docker container rm -fv wordpress-dev
+ docker-compose up -d
+fi
+
+HOST_PORT=$(docker inspect --format '{{(index (index .HostConfig.PortBindings "80/tcp") 0).HostPort}}' wordpress-dev)
+
+# Wait until the docker containers are setup properely
+echo -en $(status_message "Attempting to connect to wordpress...")
+until $(curl -L http://localhost:$HOST_PORT -so - 2>&1 | grep -q "WordPress"); do
+ echo -n '.'
+ sleep 5
+done
+echo ' done!'
+
+# Install WordPress
+echo -en $(status_message "Installing WordPress...")
+docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli core install --url=localhost:$HOST_PORT --title=Gutenberg --admin_user=admin --admin_password=password --admin_email=test@test.com >/dev/null
+
+CURRENT_URL=$(docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli option get siteurl)
+if [ "$CURRENT_URL" != "http://localhost:$HOST_PORT" ]; then
+ docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli option update home "http://localhost:$HOST_PORT"
+ docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli option update siteurl "http://localhost:$HOST_PORT"
+fi
+echo ' done!'
+
+# Activate Gutenberg
+echo -en $(status_message "Activating Gutenberg...")
+docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli plugin activate gutenberg >/dev/null
+echo ' done!'
+
+# Install the PHPUnit test scaffolding
+echo -en $(status_message "Installing PHPUnit test scaffolding...")
+docker-compose run --rm wordpress_phpunit /app/bin/install-wp-tests.sh wordpress_test root example mysql latest false >/dev/null
+echo ' done!'
+
+# Install Composer
+echo -e $(status_message "Installing and updating Composer modules...")
+docker-compose run --rm composer install
diff --git a/bin/install-node-nvm.sh b/bin/install-node-nvm.sh
new file mode 100755
index 0000000000000..42b51097c34b1
--- /dev/null
+++ b/bin/install-node-nvm.sh
@@ -0,0 +1,89 @@
+#!/bin/bash
+NVM_VERSION="v0.33.8"
+
+# Exit if any command fails
+set -e
+
+# Include useful functions
+. "$(dirname "$0")/includes.sh"
+
+# Load NVM
+if [ -n "$NVM_DIR" ]; then
+ # The --no-use option ensures loading NVM doesn't switch the current version.
+ . "$NVM_DIR/nvm.sh" --no-use
+fi
+
+# Change to the expected directory
+cd "$(dirname "$0")/.."
+
+# Check if nvm is installed
+if [ "$TRAVIS" != "true" ] && ! command_exists "nvm"; then
+ if ask "$(error_message "NVM isn't installed, would you like to download and install it automatically?")" Y; then
+ # The .bash_profile file needs to exist for NVM to install
+ if [ ! -e ~/.bash_profile ]; then
+ touch ~/.bash_profile
+ fi
+
+ echo -en $(status_message "Installing NVM..." )
+ download "https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/install.sh" | bash >/dev/null 2>&1
+ echo ' done!'
+
+ echo -e $(warning_message "NVM was updated, please run this command to reload it:" )
+ echo -e $(warning_message "$(action_format ". \$HOME/.nvm/nvm.sh")" )
+ echo -e $(warning_message "After that, re-run the setup script to continue." )
+ else
+ echo -e $(error_message "")
+ echo -e $(error_message "Please install NVM manually, then re-run the setup script to continue.")
+ echo -e $(error_message "NVM installation instructions can be found here: $(action_format "https://github.com/creationix/nvm")")
+ fi
+
+ exit 1
+fi
+
+if [ "$TRAVIS" != "true" ] && [ $NVM_VERSION != "v$(nvm --version)" ]; then
+ echo -en $(status_message "Updating NVM..." )
+ download "https://raw.githubusercontent.com/creationix/nvm/$NVM_VERSION/install.sh" | bash >/dev/null 2>&1
+ echo ' done!'
+
+ echo -e $(warning_message "NVM was updated, please run this command to reload it:" )
+ echo -e $(warning_message "$(action_format ". \$HOME/.nvm/nvm.sh")" )
+ echo -e $(warning_message "After that, re-run the setup script to continue." )
+ exit 1
+fi
+
+# Check if the current node version is up to date.
+if [ "$TRAVIS" != "true" ] && [ "$(nvm current)" != "$(nvm version-remote --lts)" ]; then
+ echo -en $(status_message "Updating Node..." )
+ nvm install >/dev/null 2>&1
+ echo ' done!'
+
+ echo -e $(warning_message "A new node version was install, please run this command to use it:" )
+ echo -e $(warning_message "$(action_format "nvm use")" )
+ echo -e $(warning_message "After that, re-run the setup script to continue." )
+ exit 1
+fi
+
+# Install/update packages
+echo -e $(status_message "Installing and updating NPM packages..." )
+npm install
+
+# There was a bug in NPM that caused has changes in package-lock.json. Handle that.
+if [ "$TRAVIS" != "true" ] && ! git diff --exit-code package-lock.json >/dev/null; then
+ if ask "$(warning_message "Your package-lock.json changed, which may mean there's an issue with your NPM cache. Would you like to try and automatically clean it up?" )" N 10; then
+ rm -rf node_modules/
+ npm cache clean --force >/dev/null 2>&1
+ git checkout package-lock.json
+
+ echo -e $(status_message "Reinstalling NPM packages..." )
+ npm install
+
+ # Check that it's cleaned up now.
+ if git diff --exit-code package-lock.json >/dev/null; then
+ echo -e $(warning_message "Confirmed that the NPM cache is cleaned up." )
+ else
+ echo -e $(error_message "We were unable to clean the NPM cache, please manually review the changes to package-lock.json. Continuing with the setup process..." )
+ fi
+ else
+ echo -e $(warning_message "Please manually review the changes to package-lock.json. Continuing with the setup process..." )
+ fi
+fi
diff --git a/bin/install-php-phpunit.sh b/bin/install-php-phpunit.sh
old mode 100644
new mode 100755
diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh
index 48ab5199a50aa..26b5cc89cae3e 100755
--- a/bin/install-wp-tests.sh
+++ b/bin/install-wp-tests.sh
@@ -1,5 +1,8 @@
#!/usr/bin/env bash
+# Include useful functions
+. "$(dirname "$0")/includes.sh"
+
if [ $# -lt 3 ]; then
echo "usage: $0 [db-host] [wp-version] [skip-database-creation]"
exit 1
@@ -15,14 +18,6 @@ SKIP_DB_CREATE=${6-false}
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
-download() {
- if [ `which curl` ]; then
- curl -s "$1" > "$2";
- elif [ `which wget` ]; then
- wget -nv -O "$2" "$1"
- fi
-}
-
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
WP_TESTS_TAG="tags/$WP_VERSION"
elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then
diff --git a/bin/run-wp-unit-tests.sh b/bin/run-wp-unit-tests.sh
index cdea34e9dec45..1c05037780d78 100755
--- a/bin/run-wp-unit-tests.sh
+++ b/bin/run-wp-unit-tests.sh
@@ -8,11 +8,13 @@ if [ ${DOCKER} = "true" ]; then
else
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
source bin/install-php-phpunit.sh
+
+ # Run the build because otherwise there will be a bunch of warnings about
+ # failed `stat` calls from `filemtime()`.
+ composer install || exit 1
+ npm install || exit 1
fi
-# Run the build because otherwise there will be a bunch of warnings about
-# failed `stat` calls from `filemtime()`.
-composer install || exit 1
-npm install || exit 1
+
npm run build || exit 1
# Make sure phpegjs parser is up to date
diff --git a/bin/setup-local-env.sh b/bin/setup-local-env.sh
index 69f4fdf431a44..005ea5cdecdfe 100755
--- a/bin/setup-local-env.sh
+++ b/bin/setup-local-env.sh
@@ -3,29 +3,29 @@
# Exit if any command fails
set -e
+# Include useful functions
+. "$(dirname "$0")/includes.sh"
+
# Change to the expected directory
cd "$(dirname "$0")/.."
-# Launch the containers
-if ! docker-compose up -d; then
- # Launching may fail due to the docker config file directory having changed.
- # Remove the old wordpress-dev container, and try again.
- docker container rm -fv wordpress-dev
- docker-compose up -d
-fi
-
-# Wait until the docker containers are setup properely
-echo "Attempting to connect to wordpress"
-until $(curl -L http://localhost:8888 -so - | grep -q "WordPress"); do
- printf '.'
- sleep 5
-done
-
-# Install WordPress
-docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli core install --url=localhost:8888 --title=Gutenberg --admin_user=admin --admin_password=password --admin_email=test@test.com
-
-# Activate Gutenberg
-docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli plugin activate gutenberg
-
-# Install the PHPUnit test scaffolding
-docker-compose run --rm wordpress_phpunit /app/bin/install-wp-tests.sh wordpress_test root example mysql latest false
+# Check Node and NVM are installed
+. "$(dirname "$0")/install-node-nvm.sh"
+
+# Check Docker is installed and running
+. "$(dirname "$0")/install-docker.sh"
+
+! read -d '' GUTENBERG <<"EOT"
+,⁻⁻⁻. . |
+| _. . . |--- ,---. ,---. |---. ,---. ,---. ,---.
+| | | | | |---' | | | | |---' | | |
+`---' `---' `---’ `---’ ' ` `---' `---’ ` `---|
+ `---'
+EOT
+
+CURRENT_URL=$(docker run -it --rm --volumes-from wordpress-dev --network container:wordpress-dev wordpress:cli option get siteurl)
+CURRENT_URL="${CURRENT_URL//[[:space:]]/}"
+
+echo -e "\nWelcome to...\n"
+echo -e "\033[95m$GUTENBERG\033[0m"
+echo -e "Run $(action_format "npm run dev"), then open $(action_format "$CURRENT_URL") to get started!"
diff --git a/composer.json b/composer.json
index 20989e187af8b..1c35db62abd5a 100644
--- a/composer.json
+++ b/composer.json
@@ -18,5 +18,8 @@
},
"require": {
"composer/installers": "~1.0"
+ },
+ "scripts": {
+ "lint": "phpcs"
}
}
diff --git a/cypress.json b/cypress.json
index f0232a9c12b10..87ff4b29a8f83 100644
--- a/cypress.json
+++ b/cypress.json
@@ -7,5 +7,6 @@
"integrationFolder": "test/e2e/integration",
"supportFile": "test/e2e/support",
"videoRecording": false,
- "chromeWebSecurity": false
+ "chromeWebSecurity": false,
+ "pluginsFile": "test/e2e/plugins"
}
diff --git a/docker-compose.yml b/docker-compose.yml
index 7f59ef133b2f2..8be412160636a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -27,5 +27,10 @@ services:
- .:/app
- testsuite:/tmp
+ composer:
+ image: composer
+ volumes:
+ - .:/app
+
volumes:
testsuite: {}
diff --git a/docs/coding-guidelines.md b/docs/coding-guidelines.md
index e73d565c56e6a..ec45372e0c347 100644
--- a/docs/coding-guidelines.md
+++ b/docs/coding-guidelines.md
@@ -91,6 +91,6 @@ import VisualEditor from '../visual-editor';
We use
[`phpcs` (PHP\_CodeSniffer)](https://github.com/squizlabs/PHP_CodeSniffer) with the [WordPress Coding Standards ruleset](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) to run a lot of automated checks against all PHP code in this project. This ensures that we are consistent with WordPress PHP coding standards.
-When making any changes to the PHP code in this project, it's recommended to install and run `phpcs` on your computer. This is a step in our Travis CI build as well, but it is better to catch errors locally.
+The easiest way to use PHPCS is [local environment](https://github.com/WordPress/gutenberg/blob/master/CONTRIBUTING.md#local-environment). Once that's installed, you can check your PHP by running `npm run lint-php`.
-The easiest way to do this is using `composer`. [Install `composer`](https://getcomposer.org/download/) on your computer, then run `composer install`. This will install `phpcs` and `WordPress-Coding-Standards` which you can the run via `vendor/bin/phpcs`.
+If you prefer to install PHPCS locally, you should use `composer`. [Install `composer`](https://getcomposer.org/download/) on your computer, then run `composer install`. This will install `phpcs` and `WordPress-Coding-Standards` which you can the run via `vendor/bin/phpcs`.
diff --git a/package-lock.json b/package-lock.json
index bf35b9ea5ca2a..4f8d774cd4f75 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -164,10 +164,13 @@
}
},
"@cypress/xvfb": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.0.4.tgz",
- "integrity": "sha512-Ey34vw8L2L1tFBLAsjCYlv24TVjzuU+sCUwONj8xMdlM5iNEHgj+AoMPR6C1LCijm/9Ue/FNAMffDe/lmKYWTA==",
- "dev": true
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.1.3.tgz",
+ "integrity": "sha512-EfRzw+wgI0Zdb4ZlhSvjh3q7I+oenqEYPXvr7oH/2RnzQqGDrPr7IU1Pi2yzGwoXmkNUQbo6qvntnItvQj0F4Q==",
+ "dev": true,
+ "requires": {
+ "lodash.once": "4.1.1"
+ }
},
"@romainberger/css-diff": {
"version": "1.0.3",
@@ -187,11 +190,57 @@
"@types/jquery": "3.2.17"
}
},
+ "@types/blob-util": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@types/blob-util/-/blob-util-1.3.3.tgz",
+ "integrity": "sha512-4ahcL/QDnpjWA2Qs16ZMQif7HjGP2cw3AGjHabybjw7Vm1EKu+cfQN1D78BaZbS1WJNa1opSMF5HNMztx7lR0w==",
+ "dev": true
+ },
+ "@types/bluebird": {
+ "version": "3.5.18",
+ "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.18.tgz",
+ "integrity": "sha512-OTPWHmsyW18BhrnG5x8F7PzeZ2nFxmHGb42bZn79P9hl+GI5cMzyPgQTwNjbem0lJhoru/8vtjAFCUOu3+gE2w==",
+ "dev": true
+ },
+ "@types/chai": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.0.8.tgz",
+ "integrity": "sha512-m812CONwdZn/dMzkIJEY0yAs4apyTkTORgfB2UsMOxgkUbC205AHnm4T8I0I5gPg9MHrFc1dJ35iS75c0CJkjg==",
+ "dev": true
+ },
+ "@types/chai-jquery": {
+ "version": "1.1.35",
+ "resolved": "https://registry.npmjs.org/@types/chai-jquery/-/chai-jquery-1.1.35.tgz",
+ "integrity": "sha512-7aIt9QMRdxuagLLI48dPz96YJdhu64p6FCa6n4qkGN5DQLHnrIjZpD9bXCvV2G0NwgZ1FAmfP214dxc5zNCfgQ==",
+ "dev": true,
+ "requires": {
+ "@types/chai": "4.0.8",
+ "@types/jquery": "3.2.17"
+ }
+ },
"@types/jquery": {
"version": "3.2.17",
"resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.2.17.tgz",
"integrity": "sha512-lt8i2ZqymxxN1JnWSOTPU7Xc3ze32lhASkVdsMd6/SZnb/jtBsmFEoYCBSa0tzGDSyO7ZB+4r4aihj+KTlDs5w=="
},
+ "@types/lodash": {
+ "version": "4.14.87",
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.87.tgz",
+ "integrity": "sha512-AqRC+aEF4N0LuNHtcjKtvF9OTfqZI0iaBoe3dA6m/W+/YZJBZjBmW/QIZ8fBeXC6cnytSY9tBoFBqZ9uSCeVsw==",
+ "dev": true
+ },
+ "@types/minimatch": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.1.tgz",
+ "integrity": "sha512-rUO/jz10KRSyA9SHoCWQ8WX9BICyj5jZYu1/ucKEJKb4KzLZCKMURdYbadP157Q6Zl1x0vHsrU+Z/O0XlhYQDw==",
+ "dev": true
+ },
+ "@types/mocha": {
+ "version": "2.2.44",
+ "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.44.tgz",
+ "integrity": "sha512-k2tWTQU8G4+iSMvqKi0Q9IIsWAp/n8xzdZS4Q4YVIltApoMA00wFBFdlJnmoaK1/z7B0Cy0yPe6GgXteSmdUNw==",
+ "dev": true
+ },
"@types/node": {
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.1.tgz",
@@ -208,6 +257,22 @@
"resolved": "https://registry.npmjs.org/@types/react/-/react-15.6.7.tgz",
"integrity": "sha512-HMfRuwiTp7/MfjPOsVlvlduouJH3haDzjc0oXqZy3ZMn3OTl3i4gGgbxsqzA/u9gNyl/oKkwOrU2oVR6vG5SAw=="
},
+ "@types/sinon": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-4.0.0.tgz",
+ "integrity": "sha512-cuK4xM8Lg2wd8cxshcQa8RG4IK/xfyB6TNE6tNVvkrShR4xdrYgsV04q6Dp6v1Lp6biEFdzD8k8zg/ujQeiw+A==",
+ "dev": true
+ },
+ "@types/sinon-chai": {
+ "version": "2.7.29",
+ "resolved": "https://registry.npmjs.org/@types/sinon-chai/-/sinon-chai-2.7.29.tgz",
+ "integrity": "sha512-EkI/ZvJT4hglWo7Ipf9SX+J+R9htNOMjW8xiOhce7+0csqvgoF5IXqY5Ae1GqRgNtWCuaywR5HjVa1snkTqpOw==",
+ "dev": true,
+ "requires": {
+ "@types/chai": "4.0.8",
+ "@types/sinon": "4.0.0"
+ }
+ },
"@wordpress/a11y": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@wordpress/a11y/-/a11y-1.0.3.tgz",
@@ -2075,6 +2140,14 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.12.2.tgz",
"integrity": "sha512-BFnaq5ZOGcDN7FlrtBT4xxkgIToalIIxwjxLWVJ8bGTpe1LroqMiqQXdA7ygc7CRvaYS+9zfPGFnJqFSayx+AA=="
},
+ "comment-parser": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-0.4.2.tgz",
+ "integrity": "sha1-+lo/eAEwcBFIZtx7jpzzF6ljX3Q=",
+ "requires": {
+ "readable-stream": "2.3.3"
+ }
+ },
"common-tags": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.4.0.tgz",
@@ -2264,8 +2337,7 @@
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
- "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
- "dev": true
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"cosmiconfig": {
"version": "2.2.2",
@@ -2484,21 +2556,30 @@
}
},
"cypress": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/cypress/-/cypress-1.1.4.tgz",
- "integrity": "sha1-eC/ex+m++Dw+CBr/o5DdG5zlJWs=",
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/cypress/-/cypress-1.4.1.tgz",
+ "integrity": "sha1-YvQHSgDm8S4t/jiKf06BaknOsD8=",
"dev": true,
"requires": {
"@cypress/listr-verbose-renderer": "0.4.1",
- "@cypress/xvfb": "1.0.4",
+ "@cypress/xvfb": "1.1.3",
+ "@types/blob-util": "1.3.3",
+ "@types/bluebird": "3.5.18",
+ "@types/chai": "4.0.8",
+ "@types/chai-jquery": "1.1.35",
+ "@types/jquery": "3.2.16",
+ "@types/lodash": "4.14.87",
+ "@types/minimatch": "3.0.1",
+ "@types/mocha": "2.2.44",
+ "@types/sinon": "4.0.0",
+ "@types/sinon-chai": "2.7.29",
"bluebird": "3.5.0",
"chalk": "2.1.0",
"check-more-types": "2.24.0",
"commander": "2.11.0",
"common-tags": "1.4.0",
- "debug": "2.6.8",
- "dev-null": "0.1.1",
- "extract-zip": "1.6.5",
+ "debug": "3.1.0",
+ "extract-zip": "1.6.6",
"fs-extra": "4.0.1",
"getos": "2.8.4",
"glob": "7.1.2",
@@ -2512,11 +2593,18 @@
"ramda": "0.24.1",
"request": "2.81.0",
"request-progress": "0.3.1",
+ "supports-color": "5.1.0",
"tmp": "0.0.31",
"url": "0.11.0",
"yauzl": "2.8.0"
},
"dependencies": {
+ "@types/jquery": {
+ "version": "3.2.16",
+ "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.2.16.tgz",
+ "integrity": "sha512-q2WC02YxQoX2nY1HRKlYGHpGP1saPmD7GN0pwCDlTz35a4eOtJG+aHRlXyjCuXokUukSrR2aXyBhSW3j+jPc0A==",
+ "dev": true
+ },
"ansi-styles": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz",
@@ -2541,6 +2629,17 @@
"ansi-styles": "3.2.0",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
+ },
+ "dependencies": {
+ "supports-color": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
+ "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "dev": true,
+ "requires": {
+ "has-flag": "2.0.0"
+ }
+ }
}
},
"commander": {
@@ -2550,9 +2649,9 @@
"dev": true
},
"debug": {
- "version": "2.6.8",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz",
- "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=",
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
@@ -2571,9 +2670,9 @@
"dev": true
},
"supports-color": {
- "version": "4.5.0",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz",
- "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=",
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.1.0.tgz",
+ "integrity": "sha512-Ry0AwkoKjDpVKK4sV4h6o3UJmNRbjYm2uXhwfj3J56lMVdvnUNqzQVRztOOMGQ++w1K/TjNDFvpJk0F/LoeBCQ==",
"dev": true,
"requires": {
"has-flag": "2.0.0"
@@ -2752,12 +2851,6 @@
"integrity": "sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I=",
"dev": true
},
- "dev-null": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/dev-null/-/dev-null-0.1.1.tgz",
- "integrity": "sha1-WiBc48Ky73e2I41roXnrdMag6Bg=",
- "dev": true
- },
"diff": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz",
@@ -3172,6 +3265,44 @@
"estraverse": "4.2.0"
}
},
+ "eslines": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/eslines/-/eslines-1.1.0.tgz",
+ "integrity": "sha1-eA3YIE5bluBb3I8BUCzVJ1q/xGQ=",
+ "dev": true,
+ "requires": {
+ "jest-docblock": "20.0.3",
+ "optionator": "0.8.1"
+ },
+ "dependencies": {
+ "fast-levenshtein": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-1.1.4.tgz",
+ "integrity": "sha1-5qdUzI8V5YmHqpy9J69m/W9OWvk=",
+ "dev": true
+ },
+ "jest-docblock": {
+ "version": "20.0.3",
+ "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-20.0.3.tgz",
+ "integrity": "sha1-F76phDQswz2DxQ++FUXqDvqkRxI=",
+ "dev": true
+ },
+ "optionator": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.1.tgz",
+ "integrity": "sha1-4xtJMs3V+4Yqiw0QvGPT7h7H14s=",
+ "dev": true,
+ "requires": {
+ "deep-is": "0.1.3",
+ "fast-levenshtein": "1.1.4",
+ "levn": "0.3.0",
+ "prelude-ls": "1.1.2",
+ "type-check": "0.3.2",
+ "wordwrap": "1.0.0"
+ }
+ }
+ }
+ },
"eslint": {
"version": "4.9.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-4.9.0.tgz",
@@ -3329,6 +3460,11 @@
"pkg-dir": "1.0.0"
}
},
+ "eslint-plugin-i18n": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-i18n/-/eslint-plugin-i18n-1.1.0.tgz",
+ "integrity": "sha1-q+48yBH2PD3JVIgQHf0hetYnUDI="
+ },
"eslint-plugin-import": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz",
@@ -3352,6 +3488,15 @@
"integrity": "sha512-4fxfe2RcqzU+IVNQL5n4pqibLcUhKKxihYsA510+6kC/FTdGInszDDHgO4ntBzPWu8mcHAvKJLs8o3AQw6eHTg==",
"dev": true
},
+ "eslint-plugin-jsdoc": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-3.1.3.tgz",
+ "integrity": "sha512-ujXBhNQz57tLP0bs99QTDPiCX54EypczVhgg9CMJVD9iwfDeFZk5LkQHk+iPfKlV5tk8+dMm+Soxq8QmQK99ZA==",
+ "requires": {
+ "comment-parser": "0.4.2",
+ "lodash": "4.17.4"
+ }
+ },
"eslint-plugin-jsx-a11y": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.0.2.tgz",
@@ -3428,6 +3573,42 @@
}
}
},
+ "eslint-plugin-wordpress": {
+ "version": "git://github.com/WordPress-Coding-Standards/eslint-plugin-wordpress.git#327b6bdec434177a6e841bd3210e87627ccfcecb",
+ "requires": {
+ "eslint-plugin-i18n": "1.1.0",
+ "eslint-plugin-jsdoc": "3.1.3",
+ "eslint-plugin-node": "5.1.1",
+ "eslint-plugin-wpcalypso": "3.4.1",
+ "merge": "1.2.0"
+ },
+ "dependencies": {
+ "eslint-plugin-node": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-5.1.1.tgz",
+ "integrity": "sha512-3xdoEbPyyQNyGhhqttjgSO3cU/non8QDBJF8ttGaHM2h8CaY5zFIngtqW6ZbLEIvhpoFPDVwiQg61b8zanx5zQ==",
+ "requires": {
+ "ignore": "3.3.7",
+ "minimatch": "3.0.4",
+ "resolve": "1.5.0",
+ "semver": "5.3.0"
+ }
+ },
+ "semver": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
+ "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8="
+ }
+ }
+ },
+ "eslint-plugin-wpcalypso": {
+ "version": "3.4.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-wpcalypso/-/eslint-plugin-wpcalypso-3.4.1.tgz",
+ "integrity": "sha512-rHbCINm3qJmCgASUDKdmRiulwt06EcJTy9Hd+MpZMS4o9eFfS23Q1z1bBYVsJ4nFexvWswqcfCsgRQnFPtT5pQ==",
+ "requires": {
+ "requireindex": "1.1.0"
+ }
+ },
"eslint-scope": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz",
@@ -3649,26 +3830,17 @@
}
},
"extract-zip": {
- "version": "1.6.5",
- "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.5.tgz",
- "integrity": "sha1-maBnNbbqIOqbcF13ms/8yHz/BEA=",
+ "version": "1.6.6",
+ "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.6.6.tgz",
+ "integrity": "sha1-EpDt6NINCHK0Kf0/NRyhKOxe+Fw=",
"dev": true,
"requires": {
"concat-stream": "1.6.0",
- "debug": "2.2.0",
+ "debug": "2.6.9",
"mkdirp": "0.5.0",
"yauzl": "2.4.1"
},
"dependencies": {
- "debug": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz",
- "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=",
- "dev": true,
- "requires": {
- "ms": "0.7.1"
- }
- },
"mkdirp": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.0.tgz",
@@ -3678,12 +3850,6 @@
"minimist": "0.0.8"
}
},
- "ms": {
- "version": "0.7.1",
- "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
- "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=",
- "dev": true
- },
"yauzl": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz",
@@ -5327,8 +5493,7 @@
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
- "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
- "dev": true
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ini": {
"version": "1.3.5",
@@ -7167,7 +7332,7 @@
"log-update": "1.0.2",
"ora": "0.2.3",
"p-map": "1.2.0",
- "rxjs": "5.5.5",
+ "rxjs": "5.5.6",
"stream-to-observable": "0.1.0",
"strip-ansi": "3.0.1"
}
@@ -7377,6 +7542,12 @@
"integrity": "sha1-FQzwoWeR9ZA7iJHqsVRgknS96lU=",
"dev": true
},
+ "lodash.once": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
+ "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=",
+ "dev": true
+ },
"lodash.sortby": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
@@ -7635,8 +7806,7 @@
"merge": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/merge/-/merge-1.2.0.tgz",
- "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo=",
- "dev": true
+ "integrity": "sha1-dTHjnUlJwoGma4xabgJl6LBYlNo="
},
"merge-stream": {
"version": "1.0.1",
@@ -8966,8 +9136,7 @@
"process-nextick-args": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
- "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=",
- "dev": true
+ "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M="
},
"progress": {
"version": "1.1.8",
@@ -9383,7 +9552,6 @@
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
"integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==",
- "dev": true,
"requires": {
"core-util-is": "1.0.2",
"inherits": "2.0.3",
@@ -9673,6 +9841,11 @@
"resolve-from": "1.0.1"
}
},
+ "requireindex": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/requireindex/-/requireindex-1.1.0.tgz",
+ "integrity": "sha1-5UBLgVV+91225JxacgBIk/4D4WI="
+ },
"resolve": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz",
@@ -9845,9 +10018,9 @@
}
},
"rxjs": {
- "version": "5.5.5",
- "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.5.tgz",
- "integrity": "sha512-D/MfQnPMBk8P8gfwGxvCkuaWBcG58W7dUMT//URPoYzIbDEKT0GezdirkK5whMgKFBATfCoTpxO8bJQGJ04W5A==",
+ "version": "5.5.6",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.6.tgz",
+ "integrity": "sha512-v4Q5HDC0FHAQ7zcBX7T2IL6O5ltl1a2GX4ENjPXg6SjDY69Cmx9v4113C99a4wGF16ClPv5Z8mghuYorVkg/kg==",
"dev": true,
"requires": {
"symbol-observable": "1.0.1"
@@ -9864,8 +10037,7 @@
"safe-buffer": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz",
- "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==",
- "dev": true
+ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg=="
},
"sane": {
"version": "2.2.0",
@@ -10446,7 +10618,6 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
- "dev": true,
"requires": {
"safe-buffer": "5.1.1"
}
@@ -11052,8 +11223,7 @@
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
- "dev": true
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"util.promisify": {
"version": "1.0.0",
diff --git a/package.json b/package.json
index 4112799a5be24..e2bc28e960172 100644
--- a/package.json
+++ b/package.json
@@ -71,7 +71,7 @@
"codecov": "3.0.0",
"concurrently": "3.5.0",
"cross-env": "3.2.4",
- "cypress": "1.1.4",
+ "cypress": "1.4.1",
"deep-freeze": "0.0.1",
"enzyme": "3.2.0",
"enzyme-adapter-react-16": "1.1.0",
@@ -139,7 +139,7 @@
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack",
"gettext-strings": "cross-env BABEL_ENV=gettext webpack",
"lint": "eslint -f json . | eslines",
- "lint-php": "vendor/bin/phpcs",
+ "lint-php": "docker-compose run --rm composer run-script lint",
"predev": "check-node-version --package",
"dev": "cross-env BABEL_ENV=default webpack --watch",
"test": "npm run lint && npm run test-unit",
diff --git a/test/e2e/plugins/index.js b/test/e2e/plugins/index.js
new file mode 100644
index 0000000000000..b7d7be3628d8e
--- /dev/null
+++ b/test/e2e/plugins/index.js
@@ -0,0 +1,19 @@
+const promisify = require( 'util.promisify' );
+const exec = promisify( require( 'child_process' ).exec );
+
+module.exports = ( on, config ) => {
+ // Retrieve the port that the docker container is running on
+ return exec( 'docker inspect --format \'{{(index (index .HostConfig.PortBindings "80/tcp") 0).HostPort}}\' wordpress-dev' )
+ .then( ( stdout ) => {
+ const port = parseInt( stdout );
+ const url = 'http://localhost:' + port;
+ if ( stdout && config.baseUrl !== url ) {
+ config.baseUrl = url;
+ }
+
+ return config;
+ } )
+ .catch( () => {
+ return config;
+ } );
+};