Skip to content

Commit

Permalink
Merge branch 'master' of github.com:WordPress/gutenberg
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Silverstein committed Nov 16, 2017
2 parents 9d6b95c + b56f09c commit 1e9572c
Show file tree
Hide file tree
Showing 491 changed files with 13,303 additions and 7,147 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Expand Up @@ -2,4 +2,3 @@ build
coverage
vendor
node_modules
/assets/js
21 changes: 18 additions & 3 deletions .eslintrc.json
Expand Up @@ -47,13 +47,22 @@
"constructor-super": "error",
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": "error",
"func-call-spacing": "error",
"indent": [ "error", "tab", { "SwitchCase": 1 } ],
"jsx-a11y/label-has-for": [ "error", {
"required": "id"
} ],
"jsx-a11y/media-has-caption": "off",
"jsx-a11y/no-noninteractive-tabindex": "off",
"jsx-a11y/role-has-required-aria-props": "off",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": "error",
"lines-around-comment": "off",
"no-alert": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-console": "error",
"no-const-assign": "error",
"no-debugger": "error",
Expand All @@ -71,6 +80,7 @@
"no-mixed-spaces-and-tabs": "error",
"no-multiple-empty-lines": [ "error", { "max": 1 } ],
"no-multi-spaces": "error",
"no-multi-str": "off",
"no-negated-in-lhs": "error",
"no-nested-ternary": "error",
"no-redeclare": "error",
Expand All @@ -94,16 +104,18 @@
}
],
"no-shadow": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-unreachable": "error",
"no-unsafe-negation": "error",
"no-unused-expressions": "error",
"no-unused-vars": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-return": "error",
"no-var": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": [ "error", "always" ],
"one-var": "off",
"padded-blocks": [ "error", "never" ],
"prefer-const": "error",
"quote-props": [ "error", "as-needed" ],
Expand All @@ -113,7 +125,9 @@
"react/jsx-indent": [ "error", "tab" ],
"react/jsx-indent-props": [ "error", "tab" ],
"react/jsx-key": "error",
"react/jsx-space-before-closing": "error",
"react/jsx-tag-spacing": "error",
"react/no-children-prop": "off",
"react/no-find-dom-node": "warn",
"react/prop-types": "off",
"semi": "error",
"semi-spacing": "error",
Expand All @@ -128,6 +142,7 @@
} ],
"template-curly-spacing": [ "error", "always" ],
"valid-jsdoc": [ "error", { "requireReturn": false } ],
"valid-typeof": "error"
"valid-typeof": "error",
"yoda": "off"
}
}
9 changes: 6 additions & 3 deletions .github/ISSUE_TEMPLATE.md
Expand Up @@ -2,15 +2,15 @@
BEFORE POSTING YOUR ISSUE:
- These comments won't show up when you submit the issue.
- Try to add as much detail as possible. Be specific!
- Please add the version of Gutenberg you are using in the description
- Please add the version of Gutenberg you are using in the description.
- If you're requesting a new feature, explain why you'd like it to be added.
- Search this repository for the issue and whether it has been fixed or reported already.
- Ensure you are using the latest code before logging bugs.
- Disable all plugins to ensure it's not a plugin conflict issue.
-->

## Issue Overview
<!-- This is a brief overview of the issue. --->
<!-- This is a brief overview of the issue --->

## Steps to Reproduce (for bugs)
<!-- Provide a link to a live example, or an unambiguous set of steps to -->
Expand All @@ -33,8 +33,11 @@ BEFORE POSTING YOUR ISSUE:
<!-- Not obligatory, but suggest a fix/reason for the bug, -->
<!-- or ideas how to implement the addition or change -->

## Screenshots / Video
<!-- Visual records are oxygen for others to understand what you are sharing -->

## Related Issues and/or PRs
<!-- List related issues or PRs against other branches: -->
<!-- List related issues or PRs against other branches -->

## Todos
- [ ] Tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
# Directories/files that may be generated by this project
build
coverage
cypress
node_modules
gutenberg.zip

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
v6.11.1
lts/*
43 changes: 19 additions & 24 deletions .travis.yml
@@ -1,8 +1,12 @@
sudo: false
sudo: required

dist: trusty

language: php

services:
- docker

notifications:
email:
on_success: never
Expand All @@ -15,56 +19,47 @@ cache:
- $HOME/.phpbrew

before_install:
- nvm install 6.11.1 && nvm use 6.11.1
- npm install --global npm@5
- nvm install && nvm use

jobs:
include:
- stage: unit
- stage: test
php: 5.6
script: composer install && ./vendor/bin/phpcs

- stage: unit
- stage: test
script:
- npm install || exit 1
- npm run ci || exit 1

- stage: unit
- stage: test
php: 7.1
env: WP_VERSION=latest
script:
- ./bin/run-wp-unit-tests.sh

- stage: unit
- stage: test
php: 5.6
env: WP_VERSION=latest
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- stage: unit
- stage: test
php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.3
script:
- ./bin/run-wp-unit-tests.sh
if: branch = master and type != "pull_request"

- stage: unit
- stage: test
php: 7.1
env: WP_VERSION=latest SWITCH_TO_PHP=5.2
script:
- ./bin/run-wp-unit-tests.sh

stages:
- unit

before_deploy:
- npm install
- cd docutron
- npm install
- cd ../
- npm run docs-build

deploy:
provider: surge
project: ./docutron/build/
skip_cleanup: true
domain: gutenberg-devdoc.surge.sh
- stage: test
script:
- npm install || exit 1
- npm run build || exit 1
- ./bin/run-e2e-tests.sh || exit 1
58 changes: 36 additions & 22 deletions CONTRIBUTING.md
@@ -1,24 +1,29 @@
# Contributing

## Installing & Building the Plugin
## Getting Started

Gutenberg is a Node.js-based project, built primarily in JavaScript. Be sure to have <a href="https://nodejs.org/en/">Node.js installed first</a>. If you already have Node.js installed, make sure it's version 6.11.1 or higher 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. Be sure to have <a href="https://nodejs.org/en/">Node.js installed first</a>. 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 <a href="https://npmjs.org">npm installed</a>, 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`

To test the plugin, or to contribute to it, you can clone this repository and build the plugin files using Node. How you do that depends on whether you're developing locally or uploading the plugin to a remote host.

### On A Remote Server
### Local Environment

Open a terminal (or if on Windows, a command prompt) and navigate to the repository you cloned. Now type `npm install` to get the dependencies all set up. Once that finishes, you can type `npm run build`. You can now upload the entire repository to your `wp-content/plugins` directory on your webserver and activate the plugin from the WordPress admin. You'll get a separate WordPress menu item called Gutenberg.
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`.

You can also type `npm run package-plugin` which will run the two commands above and create a zip file automatically for you which you can use to install Gutenberg through the WordPress admin.
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.

### On a Local WordPress Environment
Alternatively, you can use your own local WordPress environment and clone this repository right into your `wp-content/plugins` directory.

If you have a local WordPress environment, you can clone this repository right into your `wp-content/plugins` directory. `npm install` will get the dependencies set up. Then you can type `npm run dev` in your terminal or command prompt to keep the plugin building in the background as you work on it.
Next, open a terminal (or if on Windows, a command prompt) and navigate to the repository you cloned. Now type `npm install` to get the dependencies all set up. Then you can type `npm run dev` in your terminal or command prompt to keep the plugin building in the background as you work on it.

### On A Remote Server

Some good options for a local WordPress development environment include <a href="https://varyingvagrantvagrants.org/">VVV</a> and <a href="https://www.mamp.info/">Mamp</a>.
Open a terminal (or if on Windows, a command prompt) and navigate to the repository you cloned. Now type `npm install` to get the dependencies all set up. Once that finishes, you can type `npm run build`. You can now upload the entire repository to your `wp-content/plugins` directory on your webserver and activate the plugin from the WordPress admin.

You can also type `npm run package-plugin` which will run the two commands above and create a zip file automatically for you which you can use to install Gutenberg through the WordPress admin.

## Workflow

Expand Down Expand Up @@ -52,6 +57,27 @@ To run unit tests only, use `npm run test-unit` instead.

Code style in JavaScript is enforced using [ESLint](http://eslint.org/). The above `npm test` will execute both unit tests and code linting. Code linting can be verified independently by running `npm run lint`.

### End to end Testing (integration tests)

If you're using the built-in local environment above, you can run the e2e tests locally using this command:

```bash
npm run test-e2e
```

or interactively

```bash
npm run test-e2e:watch
```

If you're using another local environment setup, you can still run the e2e tests by overriding the base URL and the default WP username/password used in the tests like so:

```bash
cypress_base_url=http://my-custom-basee-url cypress_username=myusername cypress_password=mypassword npm run test-e2e
```


### PHP Testing

Tests for PHP use [PHPUnit](https://phpunit.de/) as the testing framework. Before starting, you should install PHPUnit and have a copy of [WordPress Develop](https://github.com/WordPress/wordpress-develop) available and setup a [`wp-tests-config.php`](https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/#setup) file. If the Gutenberg plugin is installed in the context of a WordPress Develop site, you can run `phpunit` directly from the command-line. Otherwise, you will need to specify the path to WordPress Develop's test directory as an environment variable:
Expand All @@ -76,18 +102,6 @@ If you'd like to contribute to the design or front-end, feel free to contribute

### Contribute to the Documentation

We're using an internal tool called `docutron` to generate the [Gutenberg Documentation Website](http://gutenberg-devdoc.surge.sh). You can run a local version of this website by cloning the repository and then running :

```bash
npm install && npm run docs-start
```

To add a new documentation page, you'll have to create a markdown file in the [docs](https://github.com/WordPress/gutenberg/tree/master/docs) folder and create a story referencing this file in the docs [stories file](https://github.com/WordPress/gutenberg/blob/master/docs/index.js) like so:
Documentation is automatically synced from master to the [Gutenberg Documentation Website](https://wordpress.org/gutenberg/handbook/) every 15 minutes.

```js
addStory( {
name: 'story-name', // used in the url
title: 'Story Title',
markdown: require( './story-markdown-file.md' ),
} );
```
To add a new documentation page, you'll have to create a Markdown file in the [docs](https://github.com/WordPress/gutenberg/tree/master/docs) folder and add an item to the [manifest file](https://github.com/WordPress/gutenberg/blob/master/docs/manifest.json).
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Expand Up @@ -85,3 +85,4 @@ This list is manually curated to include valuable contributions by volunteers th
| @rahmon | @rahmohn |
| @vladanost | |
| @gziolo | @gziolo |
| @lancewillett
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -4,15 +4,15 @@

Printing since 1440.

![Text block](https://wpcoredesign.mystagingwebsite.com/gutenberg/gutenberg.png)
![Gutenberg editing](https://cldup.com/H0oKBfpidk.png)

This is the development hub for the <a href="https://make.wordpress.org/core/2017/01/04/focus-tech-and-design-leads/">editor focus in core</a>. Gutenberg is the project name. If you want the latest release for your WordPress, <a href="https://wordpress.org/plugins/gutenberg/">download Gutenberg from the WordPress.org plugins repository</a>. Conversations and discussions take place in #core-editor on <a href="https://make.wordpress.org/chat/">the core WordPress Slack</a>. This is our kickoff goal:

> The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery. — Matt Mullenweg
WordPress already supports a large amount of "blocks", but doesn't surface them very well, nor does it give them much in the way of layout options. By embracing the blocky nature of rich post content, we will surface the blocks that already exist, as well as provide more advanced layout options for each of them. This will allow you to easily compose beautiful posts like <a href="http://moc.co/sandbox/example-post/">this example</a>.

Check out the <a href="https://github.com/WordPress/gutenberg/blob/master/docs/faq.md">FAQ</a> for answers to the most common questions about the project.
Check out the <a href="https://wordpress.org/gutenberg/handbook/reference/faq/">FAQ</a> for answers to the most common questions about the project.

## Contributors

Expand All @@ -24,7 +24,7 @@ Gutenberg is built by many contributors and volunteers. Please see the full list
- <a href="https://make.wordpress.org/core/2017/05/05/editor-how-little-blocks-work/">How Blocks Work</a>
- <a href="https://github.com/Automattic/wp-post-grammar">WP Post Grammar Parser</a>
- <a href="https://make.wordpress.org/core/tag/gutenberg/">Development updates on make.wordpress.org</a>
- <a href="http://gutenberg-devdoc.surge.sh/">Documentation: Creating Blocks, Reference, and Guidelines</a>
- <a href="https://wordpress.org/gutenberg/handbook/">Documentation: Creating Blocks, Reference, and Guidelines</a>

## How You Can Contribute

Expand Down
47 changes: 0 additions & 47 deletions assets/js/meta-box-resize.js

This file was deleted.

1 change: 0 additions & 1 deletion bin/build-plugin-zip.sh
Expand Up @@ -93,7 +93,6 @@ mv gutenberg.tmp.php gutenberg.php
status "Creating archive..."
zip -r gutenberg.zip \
gutenberg.php \
assets/js/*.js \
lib/*.php \
blocks/library/*/*.php \
post-content.js \
Expand Down
11 changes: 11 additions & 0 deletions bin/run-e2e-tests.sh
@@ -0,0 +1,11 @@
# Exit if any command fails
set -e

# Change to the expected directory
cd "$(dirname "$0")/../"

# Setup local environement
( ./bin/setup-local-env.sh )

# Run the tests
npm run test-e2e

0 comments on commit 1e9572c

Please sign in to comment.