Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use latest gb master as per July 2nd, 2018 #61

Merged
merged 17 commits into from
Jul 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"react-native-aztec": "./react-native-aztec",
"@wordpress/blocks": "./blocks",
"@wordpress/editor": "./editor",
"@wordpress/element": "./element",
"@gutenberg": "./gutenberg"
},
"extensions": [
Expand Down
7 changes: 6 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<PROJECT_ROOT>/node_modules/metro/.*
<PROJECT_ROOT>/node_modules/react-native/.*

; Ignore the node_modules folders in GB packages
<PROJECT_ROOT>/gutenberg/packages/element/node_modules/.*

[include]

[libs]
Expand All @@ -82,7 +85,9 @@ munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.name_mapper='@gutenberg' -> '<PROJECT_ROOT>/gutenberg'
module.name_mapper='@wordpress/element' -> '<PROJECT_ROOT>/gutenberg/element'
module.name_mapper='@wordpress/data' -> '<PROJECT_ROOT>/gutenberg/packages/data'
module.name_mapper='@wordpress/element' -> '<PROJECT_ROOT>/gutenberg/packages/element'
module.name_mapper='@wordpress/deprecated' -> '<PROJECT_ROOT>/gutenberg/packages/deprecated'

; mock/ignore style files
module.name_mapper='.*\(.scss\)' -> 'empty/object'
Expand Down
5 changes: 5 additions & 0 deletions .travis/travis-checks-js.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ if [ "$CHECK_CORRECTNESS" = true ] ; then
fi

if [ "$CHECK_TESTS" = true ] ; then
# build the Gutenberg packages
pushd gutenberg
npm i || pFail
popd

# we'll run the tests twich (once for each platform) if the platform env var is not set
if [[ -z "${TEST_RN_PLATFORM}" ]] ; then
TEST_RN_PLATFORM=android npm test || pFail
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ Before running the demo app, you need to download and install the project depend
npm install
```

The Gutenberg packages need to be installed and built. This is done via the following commands:

```
pushd gutenberg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put it in the shell script and run as postinstall script for the repository?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps. I refrained from automating it from the beginning so to give us time/space to see how we use it actually but, I can give it a try now and see.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, gave postinstall. Our patterns these days involve more than a few yarn install attempts and that will cause npm i to be called too many times, unnecessarily. Ideally, we want npm i to be called rarely, like, when the GB repo is cloned or when the GB branch is changed.

I think we can leave npm i out of automation for the following days/weeks and re-assess, depending on the patterns we notice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And btw, thanks for the review @gziolo !

npm install
popd
```

## Run

Note: the most recent and complete version of this guide is available [here](https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md).
Expand Down
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 824 files
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module.exports = {
'node',
],
moduleNameMapper: {
'@wordpress\\/(blocks|editor|element)$': '<rootDir>/gutenberg/$1',
'@wordpress\\/(blocks|editor)$': '<rootDir>/gutenberg/$1',
'@wordpress\\/(data|element|deprecated)$': '<rootDir>/gutenberg/packages/$1',
'@gutenberg': '<rootDir>/gutenberg',

// Mock the CSS modules. See https://facebook.github.io/jest/docs/en/webpack.html#handling-static-assets
Expand Down
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,23 @@
"sprintf-js": "^1.1.1"
},
"scripts": {
"check-gb-unused-babelrc": "cd gutenberg/; git ls-files --error-unmatch .babelrc 2>/dev/null; ss=$?; cd ..; (if [[ $ss -gt 0 ]]; then (exit 0); else (echo \"'.babelrc' is tracked in Gutenberg, cannot overwrite!\"; exit 1); fi)",
"check-gb-unused-babelrc": "cd gutenberg/; git ls-files --error-unmatch .babelrc 2>/dev/null; tracked=$?; cd ..; (if [ \"$tracked\" -gt 0 ]; then (exit 0); else (echo \"'.babelrc' is tracked in Gutenberg, cannot overwrite!\"; exit 1); fi)",
"bypass-gb-babel": "echo '{}' > gutenberg/.babelrc",
"test:bypass-gb-babel": "echo '{\"presets\": [\"@wordpress/default\"]}' > gutenberg/.babelrc",
"pre-build": "yarn check-gb-unused-babelrc && yarn bypass-gb-babel",
"test:pre-build": "yarn check-gb-unused-babelrc && yarn test:bypass-gb-babel",
"start": "yarn pre-build && yarn react-native start",
"start:reset": "yarn clean:runtime && yarn start --reset-cache",
"start:debug": "yarn pre-build && node --inspect-brk node_modules/.bin/react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "cross-env NODE_ENV=test node node_modules/jest/bin/jest.js --verbose --config jest.config.js",
"test:debug": "cross-env NODE_ENV=test node --inspect-brk node_modules/jest/bin/jest.js --runInBand --verbose --config jest.config.js",
"test": "yarn test:pre-build && cross-env NODE_ENV=test node node_modules/jest/bin/jest.js --verbose --config jest.config.js",
"test:debug": "yarn pre-build && cross-env NODE_ENV=test node --inspect-brk node_modules/jest/bin/jest.js --runInBand --verbose --config jest.config.js",
"flow": "flow",
"prettier": "prettier-eslint --write $npm_package_config_jsfiles $npm_package_config_scssfiles",
"clean": "yarn cache clean; yarn test --clearCache; watchman watch-del-all; rm -rf node_modules; rm -f yarn.lock; rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/metro-cache-*; rm -rf $TMPDIR/jest_*",
"clean": "yarn clean:setup; yarn clean:runtime",
"clean:runtime": "yarn cache clean; yarn test --clearCache; watchman watch-del-all; rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/metro-cache-*; rm -rf $TMPDIR/jest_*",
"clean:setup": "rm -rf node_modules; rm -f yarn.lock",
"clean:install": "yarn clean; yarn",
"lint": "eslint $npm_package_config_jsfiles",
"lint:fix": "eslint $npm_package_config_jsfiles --fix"
Expand Down Expand Up @@ -76,7 +81,9 @@
"react-native-recyclerview-list": "git+https://github.com/wordpress-mobile/react-native-recyclerview-list.git#bfccbaab6b5954e18f8b0ed441ba38275853b79c",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"rememo": "^3.0.0",
"shallowequal": "^1.0.2",
"simple-html-tokenizer": "^0.5.1"
"simple-html-tokenizer": "^0.5.1",
"tinycolor2": "^1.4.1"
}
}
5 changes: 3 additions & 2 deletions sass-transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ if ( reactNativeMinorVersion >= 52 ) {
}

// TODO: need to find a way to pass the include paths and the default asset files via some config
const autoImportIncludePaths = [ path.join( path.dirname( __filename ), 'gutenberg/edit-post/assets/stylesheets' ) ];
const autoImportIncludePaths = [
path.join( path.dirname( __filename ), 'gutenberg/edit-post/assets/stylesheets' ),
];
const autoImportAssets = [
'_colors.scss',
'_admin-schemes.scss',
'_breakpoints.scss',
'_variables.scss',
'_mixins.scss',
Expand Down
2 changes: 1 addition & 1 deletion src/globals.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @format */

import { createElement } from '@gutenberg/element';
import { createElement } from '@wordpress/element';
import jsdom from 'jsdom-jscore';

global.wp = {
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6547,6 +6547,10 @@ remark-parse@4.0.0:
vfile-location "^2.0.0"
xtend "^4.0.1"

rememo@^3.0.0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only downside of the current setup is that we need to ensure that all npm packages are referenced in package.json in the main repository folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, thankfully, the ones missing get reported by Metro when yarn start the packager so it's rather easy to spot.

version "3.0.0"
resolved "https://registry.yarnpkg.com/rememo/-/rememo-3.0.0.tgz#06e8e76e108865cc1e9b73329db49f844eaf8392"

remote-redux-devtools@^0.5.12:
version "0.5.12"
resolved "https://registry.yarnpkg.com/remote-redux-devtools/-/remote-redux-devtools-0.5.12.tgz#42cb95dfa9e54c1d9671317c5e7bba41e68caec2"
Expand Down Expand Up @@ -7409,6 +7413,10 @@ timers-browserify@^2.0.2:
dependencies:
setimmediate "^1.0.4"

tinycolor2@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.1.tgz#f4fad333447bc0b07d4dc8e9209d8f39a8ac77e8"

tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
Expand Down