Skip to content

Commit 460027e

Browse files
committed
Merge branch 'trunk' of github.com:WordPress/gutenberg into fix/env-wp-tests-config
* 'trunk' of github.com:WordPress/gutenberg: (88 commits) Components: refactor `AlignmentMatrixControl` to pass `exhaustive-deps` (#41167) [RNMobile] Add 'Insert from URL' option to Image block (#40334) [RNMobile] Improvements to Getting Started Guides (#40964) Post Author Name: Add to and from Post Author transformations (#41151) CheckboxControl: Add unit tests (#41165) Improve inline documentation (#41209) Mobile Release v1.76.1 (#41196) Use explicit type definitions for entity configuration (#40995) Scripts: Convert file extension to js in `block.json` during build (#41068) Reflects revert in 6446878 (#41221) get_style_nodes should be compatible with parent method. (#41217) Gallery: Opt-in to axial (column/row) block spacing controls (#41175) Table of Contents block: convert line breaks to spaces in headings. (#41206) Add support for button elements to theme.json (#40260) Global Styles: Load block CSS conditionally (#41160) Update URL (#41188) Improve autocompleter performance (#41197) Site Editor: Set min-width for styles preview (#41198) Remove Navigation Editor screen from experiments page (#40878) Fix broken Page title for pages created inline within in Nav block (#41063) ...
2 parents df6f7fa + 868aaf1 commit 460027e

File tree

468 files changed

+6108
-4766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

468 files changed

+6108
-4766
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Documentation
2-
/docs @ajitbohra @ryanwelcher @juanmaguitar
2+
/docs @ajitbohra @ryanwelcher @juanmaguitar @fabiankaegy
33

44
# Schemas
55
/schemas/json @ajlende

.github/workflows/publish-npm-packages.yml

+32-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ name: Publish npm packages
33
on:
44
workflow_dispatch:
55
inputs:
6-
wp_version:
7-
description: 'WordPress major version'
6+
release_type:
7+
description: 'Release type'
88
required: true
9+
type: choice
10+
default: 'development'
11+
options:
12+
- development
13+
- bugfix
14+
- wp
15+
wp_version:
16+
description: 'WordPress major version (`wp` only)'
917
type: string
1018

1119
# Cancels all previous workflow runs for pull requests that have not completed.
@@ -16,8 +24,8 @@ concurrency:
1624
cancel-in-progress: true
1725

1826
jobs:
19-
wp-release:
20-
name: WordPress major bugfix release
27+
release:
28+
name: Release - ${{ github.event.inputs.release_type }}
2129
runs-on: ubuntu-latest
2230
environment: WordPress packages
2331
steps:
@@ -47,7 +55,26 @@ jobs:
4755
node-version-file: 'main/.nvmrc'
4856
registry-url: 'https://registry.npmjs.org'
4957

50-
- name: Publish packages to npm ("wp/${{ github.event.inputs.wp_version }}" dist-tag)
58+
- name: Publish development packages to npm ("next" dist-tag)
59+
if: ${{ github.event.inputs.release_type == 'development' }}
60+
run: |
61+
cd main
62+
npm ci
63+
./bin/plugin/cli.js npm-next --ci --repository-path ../publish
64+
env:
65+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
67+
- name: Publish packages to npm with bug fixes ("latest" dist-tag)
68+
if: ${{ github.event.inputs.release_type == 'bugfix' }}
69+
run: |
70+
cd main
71+
npm ci
72+
./bin/plugin/cli.js npm-bugfix --ci --repository-path ../publish
73+
env:
74+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
75+
76+
- name: Publish packages to npm for WP major ("wp/${{ github.event.inputs.wp_version || 'X.Y' }}" dist-tag)
77+
if: ${{ github.event.inputs.release_type == 'wp' && github.event.inputs.wp_version }}
5178
run: |
5279
cd main
5380
npm ci

changelog.txt

+298
Large diffs are not rendered by default.

docs/contributors/code/coding-guidelines.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Coding Guidelines
22

3-
This living document serves to prescribe coding guidelines specific to the Gutenberg project. Base coding guidelines follow the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/). The following sections outline additional patterns and conventions used in the Gutenberg project.
3+
This living document serves to prescribe coding guidelines specific to the Gutenberg project. Base coding guidelines follow the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/). The following sections outline additional patterns and conventions used in the Gutenberg project.
44

55
## CSS
66

docs/contributors/code/react-native/getting-started-react-native.md

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ To see a list of all of your available iOS devices, use `xcrun simctl list devic
7272

7373
### Troubleshooting
7474

75+
If the Android emulator doesn't start correctly, or compiling fails with `Could not initialize class org.codehaus.groovy.runtime.InvokerHelper` or similar, it may help to double check the set up of your development environment against the latest requirements in [React Native's documentation](https://reactnative.dev/docs/environment-setup). With Android Studio, for example, you will need to configure the `ANDROID_HOME` environment variable and ensure that your version of JDK matches the latest requirements.
76+
7577
Some times, and especially when tweaking anything in the `package.json`, Babel configuration (`.babelrc`) or the Jest configuration (`jest.config.js`), your changes might seem to not take effect as expected. On those times, you might need to stop the metro bunder process and restart it with `npm run native start:reset`. Other times, you might want to reinstall the NPM packages from scratch and the `npm run native clean:install` script can be handy.
7678

7779
## Developing with Visual Studio Code
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,36 @@
11
# Setup guide for React Native development (macOS)
22

3-
Are you interested in contributing to the native mobile editor? This
4-
guide is a detailed walk through designed to get you up and running!
3+
Are you interested in contributing to the native mobile editor? This guide is a detailed walk through designed to get you up and running!
54

6-
Note that the following instructions here are primarily focused on the
7-
macOS environment. For other environments, [the React Native quickstart documentation](https://reactnative.dev/docs/environment-setup)
8-
has helpful pointers and steps for getting set up.
9-
10-
## Install Xcode
11-
12-
Install [Xcode](https://developer.apple.com/xcode/) via the app store. We'll be using
13-
the XCode to both compile the iOS app and use the phone simulator app.
14-
15-
Once it has been installed from the App Store, open it by visiting `Applications > Xcode`
16-
17-
After opening the application:
18-
19-
- Accept the license agreement.
20-
- Verify that `Xcode > Preferences > Locations > Command Line Tools` points at the current Xcode version.
21-
22-
<img src="https://developer.wordpress.org/files/2021/10/xcode-command-line-tools.png" width="500" alt="Screenshot of XCode command line tools settings.">
5+
Note that these instructions are primarily focused on the macOS environment. For other environments, [the React Native quickstart documentation](https://reactnative.dev/docs/environment-setup) has helpful pointers and steps for getting set up.
236

247
## Clone Gutenberg
258

26-
If Xcode was installed successfully, we'll also have a version of git available. (It's possible to
27-
update this later if we want to use a more recent version).
28-
29-
In a terminal run:
30-
319
```sh
3210
git clone git@github.com:WordPress/gutenberg.git
3311
```
3412

3513
### Install node and npm
3614

37-
If you’re working in multiple JS projects, a node version manager may make sense. A manager will let you
38-
switch between different node and npm versions of your choosing.
39-
40-
Some good options are [nvm](https://github.com/nvm-sh/nvm) or [volta](https://volta.sh/).
15+
If you’re working in multiple JS projects, a node version manager may make sense. A manager will let you switch between different node and npm versions of your choosing.
4116

42-
Pick one and follow the install instructions noted on their website.
17+
We recommend [nvm](https://github.com/nvm-sh/nvm).
4318

44-
Then run:
19+
After installing nvm, run the following from the top-level directory of the cloned project:
4520

4621
```sh
4722
nvm install 'lts/*'
4823
nvm alias default 'lts/*' # sets this as the default when opening a new terminal
4924
nvm use # switches to the project settings
5025
```
5126

52-
Or
53-
54-
```sh
55-
volta install node #defaults to installing lts
56-
```
57-
58-
Then install dependencies from your Gutenberg checkout folder:
27+
Then install dependencies:
5928

6029
```
6130
npm ci
6231
```
6332

64-
#### Do you have an older existing Gutenberg checkout?
33+
### Do you have an older existing Gutenberg checkout?
6534

6635
If you have an existing Gutenberg checkout be sure to fully clean `node_modules` and re-install dependencies.
6736
This may help avoid errors in the future.
@@ -71,28 +40,56 @@ npm run distclean
7140
npm ci
7241
```
7342

74-
## Unit Tests
43+
## iOS
7544

76-
Unit tests should work at this point.
45+
### CocoaPods
7746

78-
```sh
79-
npm run native test
47+
[CocoaPods](https://guides.cocoapods.org/using/getting-started.html) is required to fetch React and third-party dependencies. The steps to install it vary depending on how Ruby is managed on your machine.
48+
49+
#### System Ruby
50+
51+
If you're using the default Ruby available with MacOS, you'll need to use the `sudo` command to install gems like Cocoapods:
52+
53+
```
54+
sudo gem install cocoapods
8055
```
8156

82-
## iOS
57+
Note, Mac M1 is not directly compatible with Cocoapods. If you encounter issues, try running these commands to install the ffi package, which will enable pods to be installed with the proper architecture:
58+
59+
```
60+
sudo arch -x86_64 gem install ffi
61+
arch -x86_64 pod install
62+
```
63+
64+
#### Ruby Manager
65+
66+
It may not be necessary to manually install Cocoapods or the `ffi` package if you're using a Ruby Version manager. Please refer to your chosen manager's documentation for guidance.
67+
68+
[`rbenv`](https://github.com/rbenv/rbenv) is the recommended manager if you're running Gutenberg from within [the WordPress iOS app](https://github.com/wordpress-mobile/WordPress-iOS) (vs. only the demo app).
8369

84-
The easiest way to figure out what needs to be installed is using the
85-
[react native doctor](https://reactnative.dev/blog/2019/11/18/react-native-doctor). From your checkout, or
86-
relative to `/packages/react-native-editor folder`, run:
70+
### Set up Xcode
71+
72+
Install [Xcode](https://developer.apple.com/xcode/) via the app store and then open it up:
73+
74+
- Accept the license agreement.
75+
- Verify that `Xcode > Preferences > Locations > Command Line Tools` points to the current Xcode version.
76+
77+
<img src="https://developer.wordpress.org/files/2021/10/xcode-command-line-tools.png" width="700px" alt="Screenshot of XCode command line tools settings.">
78+
79+
### react-native doctor
80+
81+
[react-native doctor](https://reactnative.dev/blog/2019/11/18/react-native-doctor) can be used to identify anything that's missing from your development environment. From your Gutenberg checkout, or relative to `/packages/react-native-editor folder`, run:
8782

8883
```sh
8984
npx @react-native-community/cli doctor
9085
```
9186

92-
<img src="https://developer.wordpress.org/files/2021/10/react-native-doctor.png" width="500px" alt="Screenshot of react-native-community/cli doctor tool running in the terminal.">
87+
<img src="https://developer.wordpress.org/files/2021/10/react-native-doctor.png" width="700px" alt="Screenshot of react-native-community/cli doctor tool running in the terminal.">
9388

9489
See if `doctor` can fix both "common" and "iOS" issues. (Don't worry if "Android" still has ❌s at this stage, we'll get to those later!)
9590

91+
### Run the demo app
92+
9693
Once all common and iOS issues are resolved, try:
9794

9895
```
@@ -105,37 +102,46 @@ In another terminal type:
105102
npm run native ios
106103
```
107104

108-
After waiting for everything to build we should see:
105+
After waiting for everything to build, the demo app should be running from the iOS simulator:
109106

110-
<img src="https://developer.wordpress.org/files/2021/10/iOS-Simulator.png" alt="Screenshot of the block editor in iOS simulator." />
107+
<img src="https://developer.wordpress.org/files/2021/10/iOS-Simulator.png" width="700px" alt="Screenshot of the block editor in iOS simulator." />
111108

112109
## Android
113110

114-
To keep things simple, let's use Android Studio for all JDK and SDK package management.
115-
The first step is [downloading Android Studio](https://developer.android.com/studio).
111+
### Java Development Kit (JDK)
116112

117-
Next, open an existing project and select the gutenberg folder you cloned:
113+
The JDK recommended in [the React Native documentation](https://reactnative.dev/docs/environment-setup) is called Azul Zulu. It can be installed using [Homebrew](https://brew.sh/). To install it, run the following commands in a terminal after installing Homebrew:
118114

119-
Click on the cube with the down arrow:
115+
```
116+
brew tap homebrew/cask-versions
117+
brew install --cask zulu11
118+
```
120119

121-
<img src="https://developer.wordpress.org/files/2021/10/react-native-package-manager.png" alt="Screenshot highlighting where the package manager button is located in Android Studio.">
120+
If you already have a JDK installed on your system, it should be JDK 11 or newer.
122121

123-
We can download SDK platforms, packages and other tools on this screen. Specific versions are
124-
hidden behind the "Show package details" checkbox, check it, since our build requires specific versions for E2E and
125-
development:
122+
### Set up Android Studio
126123

127-
<img src="https://developer.wordpress.org/files/2021/10/react-native-show-package-details.png" alt="Screenshot of the package manager in Android Studio, highlighting the Show Package Details checkbox.">
124+
To compile the Android app, [download Android Studio](https://developer.android.com/studio).
128125

129-
Check all related packages from [build.gradle](https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/android/build.gradle).
130-
Then click on "Apply" to download items. There may be other related dependencies from build.gradle files in node_modules.
131-
If you don’t want to dig through files, stack traces will complain of missing packages, but it does take quite a number
132-
of tries if you go through this route.
126+
Next, open an existing project and select the Gutenberg folder you cloned.
133127

134-
<img src="https://developer.wordpress.org/files/2021/10/react-native-editor-build-gradle.png" alt="Screenshot of the build.gradle configuration file.">
128+
From here, click on the cube icon that's highlighted in the following screenshot to access the SDK Manager. Another way to the SDK Manager is to navigate to `Tools > SDK Manager`:
135129

136-
<img src="https://developer.wordpress.org/files/2021/10/react-native-sdk.png" width="500" alt="Screenshot of the package manager displaying SDK Platforms.">
130+
<img src="https://developer.wordpress.org/files/2021/10/react-native-package-manager.png" width="700px" alt="Screenshot highlighting where the package manager button is located in Android Studio.">
137131

138-
<img src="https://developer.wordpress.org/files/2021/10/react-native-sdk-tools.png" width="500" alt="Screenshot of the package manager displaying SDK Tools.">
132+
We can download SDK platforms, packages and other tools on this screen. Specific versions are hidden behind the "Show package details" checkbox, check it, since our build requires specific versions for E2E and development:
133+
134+
<img src="https://developer.wordpress.org/files/2021/10/react-native-show-package-details.png" width="700px" alt="Screenshot of the package manager in Android Studio, highlighting the Show Package Details checkbox.">
135+
136+
Check all related packages from [build.gradle](https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/android/build.gradle). Then click on "Apply" to download items. There may be other related dependencies from build.gradle files in node_modules.
137+
138+
If you don’t want to dig through files, stack traces will complain of missing packages, but it does take quite a number of tries if you go through this route.
139+
140+
<img src="https://developer.wordpress.org/files/2021/10/react-native-editor-build-gradle.png" width="700px" alt="Screenshot of the build.gradle configuration file.">
141+
142+
<img src="https://developer.wordpress.org/files/2021/10/react-native-sdk.png" width="700px" alt="Screenshot of the package manager displaying SDK Platforms.">
143+
144+
<img src="https://developer.wordpress.org/files/2021/10/react-native-sdk-tools.png" width="700px" alt="Screenshot of the package manager displaying SDK Tools.">
139145

140146
### Update Paths
141147

@@ -167,26 +173,25 @@ source ~/.bash_profile
167173

168174
If the SDK path can't be found, you can verify its location by visiting Android Studio > Preferences > System Settings > Android SDK
169175

170-
<img src="https://developer.wordpress.org/files/2021/10/sdk-path.png" alt="Screenshot of where the SDK Path may be found in Android Studio.">
176+
<img src="https://developer.wordpress.org/files/2021/10/sdk-path.png" width="700px" alt="Screenshot of where the SDK Path may be found in Android Studio.">
171177

172178
### Create a new device image
173179

174180
Next, let’s create a virtual device image. Click on the phone icon with an android to the bottom-right.
175181

176-
<img src="https://developer.wordpress.org/files/2021/10/react-native-android-device-manager-button.png" alt="Screenshot of where to find the android device manager button.">
182+
<img src="https://developer.wordpress.org/files/2021/10/react-native-android-device-manager-button.png" width="700px" alt="Screenshot of where to find the android device manager button.">
177183

178184
This brings up the “Android Virtual Device Manager” or (AVD). Click on “Create Virtual Device”. Pick a phone type of your choice:
179185

180-
<img src="https://developer.wordpress.org/files/2021/10/react-native-android-select-hardware.png" alt="Screenshot of the Virtual Device Configuration setup.">
186+
<img src="https://developer.wordpress.org/files/2021/10/react-native-android-select-hardware.png" width="700px" alt="Screenshot of the Virtual Device Configuration setup.">
181187

182-
Pick the target SDK version. This is the targetSdkVersion set in the
183-
[build.gradle](https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/android/build.gradle) file.
188+
Pick the target SDK version. This is the targetSdkVersion set in the [build.gradle](https://github.com/WordPress/gutenberg/blob/trunk/packages/react-native-editor/android/build.gradle) file.
184189

185-
<img src="https://developer.wordpress.org/files/2021/10/react-native-adv-system-image.png" alt="Screenshot of picking a system image in the Android Device Manager workflow.">
190+
<img src="https://developer.wordpress.org/files/2021/10/react-native-adv-system-image.png" width="700px" alt="Screenshot of picking a system image in the Android Device Manager workflow.">
186191

187192
There are some advanced settings we can toggle, but these are optional. Click finish.
188193

189-
### Putting it all together
194+
### Run the demo app
190195

191196
Start metro:
192197

@@ -202,7 +207,13 @@ npm run native android
202207

203208
After a bit of a wait, we’ll see something like this:
204209

205-
<img src="https://developer.wordpress.org/files/2021/10/android-simulator.png" alt="Screenshot of a the block editor in Android Simulator.">
210+
<img src="https://developer.wordpress.org/files/2021/10/android-simulator.png" width="700px" alt="Screenshot of a the block editor in Android Simulator.">
211+
212+
## Unit Tests
213+
214+
```sh
215+
npm run native test
216+
```
206217

207218
## Integration Tests
208219

@@ -212,14 +223,13 @@ After a bit of a wait, we’ll see something like this:
212223
npx appium-doctor
213224
```
214225

215-
<img src="https://developer.wordpress.org/files/2021/10/CleanShot-2021-10-27-at-15.20.16.png" width="500px" alt="Screenshot of the appium-doctor tool running in the terminal.">
226+
<img src="https://developer.wordpress.org/files/2021/10/CleanShot-2021-10-27-at-15.20.16.png" width="700px" alt="Screenshot of the appium-doctor tool running in the terminal.">
216227

217228
Resolve any required dependencies.
218229

219230
### iOS Integration Tests
220231

221-
If we know we can run the iOS local environment without issue, E2Es for iOS are straightforward. Stop any running metro processes.
222-
This was launched previously with `npm run native start:reset`.
232+
If we know we can run the iOS local environment without issue, E2Es for iOS are straightforward. Stop any running metro processes. This was launched previously with `npm run native start:reset`.
223233

224234
Then in terminal type:
225235

@@ -243,7 +253,7 @@ If all things go well, it should look like:
243253

244254
Start the virtual device first. Go back to the AVD by clicking on the phone icon, then click the green play button.
245255

246-
<img src="https://developer.wordpress.org/files/2021/10/adv-integration.png" alt="A screenshot of how to start the Android Simulator.">
256+
<img src="https://developer.wordpress.org/files/2021/10/adv-integration.png" width="700px" alt="A screenshot of how to start the Android Simulator.">
247257

248258
Make sure no metro processes are running. This was launched previously with `npm run native start:reset`.
249259

@@ -261,4 +271,4 @@ npm run native test:e2e:android:local gutenberg-editor-paragraph.test.js
261271

262272
After a bit of a wait we should see:
263273

264-
<img src="https://developer.wordpress.org/files/2021/10/CleanShot-2021-10-27-at-15.28.22.png" alt="A screenshot of block editor integration tests in Android Simulator.">
274+
<img src="https://developer.wordpress.org/files/2021/10/CleanShot-2021-10-27-at-15.28.22.png" width="700px" alt="A screenshot of block editor integration tests in Android Simulator.">

0 commit comments

Comments
 (0)