Skip to content

Commit

Permalink
Add 'packages/react-native-editor/' from commit '665a5483741ecb90d403…
Browse files Browse the repository at this point in the history
…1a2c7c6ae280470ad49d'

git-subtree-dir: packages/react-native-editor
git-subtree-mainline: e33a49f
git-subtree-split: 665a548
  • Loading branch information
Tug committed Jan 16, 2020
2 parents e33a49f + 665a548 commit d175340
Show file tree
Hide file tree
Showing 381 changed files with 47,250 additions and 0 deletions.
177 changes: 177 additions & 0 deletions packages/react-native-editor/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
version: 2.1

commands:
yarn-install:
steps:
- restore_cache:
name: Restore Yarn Cache
keys:
- yarn-i18n-v4-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}
- run:
name: Yarn Install
command: yarn install --frozen-lockfile --prefer-offline
- save_cache:
name: Save Yarn Cache
key: yarn-i18n-v4-{{ .Environment.CIRCLE_JOB }}-{{ checksum "yarn.lock" }}
paths:
- node_modules
- i18n-cache/data
checkout-gutenberg:
steps:
- run:
name: Checkout Gutenberg
command: git submodule update --init --recursive
add-jest-reporter-dir:
steps:
- run:
name: Create reports directory
command: mkdir reports && mkdir reports/test-results

jobs:
checks:
parameters:
platform:
type: string
default: ""
check-tests:
type: boolean
default: false
check-correctness:
type: boolean
default: false
docker:
- image: circleci/node:8
steps:
- checkout
- checkout-gutenberg
- yarn-install
- add-jest-reporter-dir
- run:
name: Set Environment Variables
command: |
echo 'export CHECK_CORRECTNESS=<<parameters.check-correctness>>' >> $BASH_ENV
echo 'export CHECK_TESTS=<<parameters.check-tests>>' >> $BASH_ENV
echo 'export TEST_RN_PLATFORM=<<parameters.platform>>' >> $BASH_ENV
- run:
name: Run Checks
command: bin/ci-checks-js.sh
environment:
JEST_JUNIT_OUTPUT: "reports/test-results/android-test-results.xml"
- store_test_results:
path: ./reports/test-results
android-device-checks:
docker:
- image: circleci/android:api-29-node
steps:
- checkout
- run:
name: Checkout Gutenberg
command: git submodule update --init --recursive
- yarn-install
- add-jest-reporter-dir
- run:
name: Set Environment Variables
command: |
echo 'export TEST_RN_PLATFORM=android' >> $BASH_ENV
echo 'export TEST_ENV=sauce' >> $BASH_ENV
- run:
name: Bundle Android and Generate debug .apk file for testing
command: yarn test:e2e:build-app:android
- run:
name: Upload apk to sauce labs
command: |
source bin/sauce-pre-upload.sh
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/automattic/Gutenberg-$SAUCE_FILENAME.apk?overwrite=true --data-binary @./android/app/build/outputs/apk/debug/app-debug.apk
- run:
name: Run Device Tests
command: yarn device-tests
environment:
JEST_JUNIT_OUTPUT: "reports/test-results/android-test-results.xml"
- store_test_results:
path: ./reports/test-results
ios-device-checks:
macos:
xcode: "11.2.1"
steps:
- checkout
- checkout-gutenberg
- yarn-install
- add-jest-reporter-dir
- run:
name: Set Environment Variables
command: |
echo 'export TEST_RN_PLATFORM=ios' >> $BASH_ENV
echo 'export TEST_ENV=sauce' >> $BASH_ENV
- run:
name: Prepare build cache key
command: find yarn.lock ios react-native-aztec/ios react-native-gutenberg-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt
- restore_cache:
name: Restore Build Cache
keys:
- ios-build-cache-{{ checksum "ios-checksums.txt" }}
- restore_cache:
name: Restore Dependencies Cache
keys:
- dependencies-v2-{{ checksum "react-native-aztec/ios/Cartfile.resolved" }}-{{
checksum "yarn.lock" }}
- dependencies-v2-{{ checksum "react-native-aztec/ios/Cartfile.resolved" }}
- dependencies-v2-
- run:
name: Yarn preios (if needed)
command: test -e ios/build/gutenberg/Build/Products/Release-iphonesimulator/gutenberg.app || yarn preios
- save_cache:
name: Save Dependencies Cache
key: dependencies-v2-{{ checksum "react-native-aztec/ios/Cartfile.resolved" }}-{{
checksum "yarn.lock" }}
paths:
- react-native-aztec/ios/Carthage
- ~/.rncache
- run:
name: Build (if needed)
command: test -e ios/build/gutenberg/Build/Products/Release-iphonesimulator/gutenberg.app || yarn react-native run-ios --configuration Release --no-packager
- run:
name: Bundle iOS
command: yarn test:e2e:bundle:ios
- run:
name: Generate .app file for testing
command: WORK_DIR=$(pwd) && cd ./ios/build/gutenberg/Build/Products/Release-iphonesimulator && zip -r $WORK_DIR/ios/Gutenberg.app.zip gutenberg.app
- run:
name: Upload .app to sauce labs
command: |
source bin/sauce-pre-upload.sh
curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" -X POST -H "Content-Type: application/octet-stream" https://saucelabs.com/rest/v1/storage/automattic/Gutenberg-$SAUCE_FILENAME.app.zip?overwrite=true --data-binary @./ios/Gutenberg.app.zip
- run:
name: Run Device Tests
command: |
yarn device-tests
environment:
JEST_JUNIT_OUTPUT: "reports/test-results/ios-test-results.xml"
- store_test_results:
path: ./reports/test-results
- run:
name: Prepare build cache
command: rm ios/build/gutenberg/Build/Products/Release-iphonesimulator/gutenberg.app/main.jsbundle
- save_cache:
name: Save Build Cache
key: ios-build-cache-{{ checksum "ios-checksums.txt" }}
paths:
- ios/build/gutenberg/Build/Products/Release-iphonesimulator/gutenberg.app

workflows:
gutenberg-mobile:
jobs:
- checks:
name: Check Correctness
check-correctness: true
- checks:
name: Test iOS
platform: ios
check-tests: true
- checks:
name: Test Android
platform: android
check-tests: true
- ios-device-checks:
name: Test iOS on Device
- android-device-checks:
name: Test Android on Device
7 changes: 7 additions & 0 deletions packages/react-native-editor/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; ignore the submodules
gutenberg
symlinked-packages
symlinked-packages-in-parent
react-native-aztec
bundle
react-native-aztec-old-submodule
74 changes: 74 additions & 0 deletions packages/react-native-editor/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* External dependencies
*/
const { map } = require( 'lodash' );

module.exports = {
parser: "babel-eslint",
env: {
browser: true,
"jest/globals": true
},
globals: {
__DEV__: true
},
plugins: [
"react",
"react-native",
"jest",
"flowtype"
],
extends: [
"plugin:@wordpress/eslint-plugin/recommended",
"plugin:flowtype/recommended",
],
settings: {
flowtype: {
onlyFilesWithFlowAnnotation: true,
},
react: {
pragma: "React",
version: "16.8.3",
flowVersion: "0.92.0",
},
},
rules: {
'no-restricted-syntax': [
'error',
// NOTE: We can't include the forward slash in our regex or
// we'll get a `SyntaxError` (Invalid regular expression: \ at end of pattern)
// here. That's why we use \\u002F in the regexes below.
{
selector: 'ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]',
message: 'Path access on WordPress dependencies is not allowed.',
},
{
selector: 'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] Literal[value=/\\.{3}/]',
message: 'Use ellipsis character (…) in place of three dots',
},
{
selector: 'ImportDeclaration[source.value="lodash"] Identifier.imported[name="memoize"]',
message: 'Use memize instead of Lodash’s memoize',
},
{
selector: 'CallExpression[callee.object.name="page"][callee.property.name="waitFor"]',
message: 'Prefer page.waitForSelector instead.',
},
{
selector: 'JSXAttribute[name.name="id"][value.type="Literal"]',
message: 'Do not use string literals for IDs; use withInstanceId instead.',
},
{
// Discourage the usage of `Math.random()` as it's a code smell
// for UUID generation, for which we already have a higher-order
// component: `withInstanceId`.
selector: 'CallExpression[callee.object.name="Math"][callee.property.name="random"]',
message: 'Do not use Math.random() to generate unique IDs; use withInstanceId instead. (If you’re not generating unique IDs: ignore this message.)',
},
{
selector: 'CallExpression[callee.name="withDispatch"] > :function > BlockStatement > :not(VariableDeclaration,ReturnStatement)',
message: 'withDispatch must return an object with consistent keys. Avoid performing logic in `mapDispatchToProps`.',
},
],
},
}
115 changes: 115 additions & 0 deletions packages/react-native-editor/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore templates for 'react-native init'
<PROJECT_ROOT>/node_modules/react-native/local-cli/templates/.*

; Ignore RN jest
<PROJECT_ROOT>/node_modules/react-native/jest/.*

; Ignore RNTester
<PROJECT_ROOT>/node_modules/react-native/RNTester/.*

; Ignore the website subdir
<PROJECT_ROOT>/node_modules/react-native/website/.*

; Ignore the Dangerfile
<PROJECT_ROOT>/node_modules/react-native/danger/dangerfile.js

; Ignore Fbemitter
<PROJECT_ROOT>/node_modules/fbemitter/.*

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/node_modules/react-native/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore polyfills
<PROJECT_ROOT>/node_modules/react-native/Libraries/polyfills/.*

; Ignore various node_modules
<PROJECT_ROOT>/node_modules/react-native-gesture-handler/.*
<PROJECT_ROOT>/node_modules/expo/.*
<PROJECT_ROOT>/node_modules/react-navigation/.*
<PROJECT_ROOT>/node_modules/xdl/.*
<PROJECT_ROOT>/node_modules/reqwest/.*
<PROJECT_ROOT>/node_modules/metro-bundler/.*
<PROJECT_ROOT>/node_modules/fbjs/.*
<PROJECT_ROOT>/node_modules/graphql/.*
<PROJECT_ROOT>/node_modules/prettier/.*
<PROJECT_ROOT>/node_modules/jsx-to-string/.*
<PROJECT_ROOT>/node_modules/jest-enzyme/.*
<PROJECT_ROOT>/node_modules/enzyme-matchers/.*

; Ignore react-native-recyclerview-list example app
<PROJECT_ROOT>/node_modules/react-native-recyclerview-list/example

; Ignore immutable-js. See https://github.com/facebook/immutable-js/issues/1308
<PROJECT_ROOT>/node_modules/immutable/.*

; Gutenberg tools
<PROJECT_ROOT>/gutenberg/node_modules/findup/.*
<PROJECT_ROOT>/gutenberg/node_modules/cypress/.*
<PROJECT_ROOT>/gutenberg/node_modules/config-chain/.*
<PROJECT_ROOT>/gutenberg/node_modules/editions/es2015/.*
<PROJECT_ROOT>/gutenberg/node_modules/@parcel/.*

; Mirror some ignores from Gutenberg tools
<PROJECT_ROOT>/node_modules/config-chain/.*

; Hack to make Flow works on OS X with a RN project
<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]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/expo/flow/
libdefs.js

[options]
emoji=true

module.system=haste
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=symlinked-packages

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.ios.js
module.file_ext=.scss

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'

; mock/ignore style files
module.name_mapper='.*\(.scss\)' -> 'empty/object'

server.max_workers=4

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[untyped]
<PROJECT_ROOT>/node_modules/react-native-keyboard-aware-scroll-view/.*
<PROJECT_ROOT>/node_modules/react-native-safe-area/.*

[version]
^0.92.0
1 change: 1 addition & 0 deletions packages/react-native-editor/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RELEASE-NOTES.txt merge=union
Loading

0 comments on commit d175340

Please sign in to comment.