Skip to content

Commit

Permalink
[Monorepo] Move dependencies to root package.json and change yarn to …
Browse files Browse the repository at this point in the history
…npm (#18531)

* move dependencies to root package.json and change yarn to npm

* fix lint issues

* use specified version instead of ranges in root package.json

* set imported packages as private

* First pass cleaning unused files and symlinks

* Fix lint errors

* Make travis CI run on feat/import-gutenberg-mobile-no-squash

* Update our react-native packages references in the codebase

* Fix native unit tests npm run test-unit:native et npm run native test

* Remove unnecessary changes in root package.json

* Fix npm run lint-types

* Only load required typescript definitions for npm run lint to pass, exclude react-native which currently conflicts

* Exclude bundle and native code from eslint

* Exclude react-native packages completely from linter checks, will need to fix all the errors later on

* Move local react-native package dependencies to the right section

* Fix npm run build: Do not build react-native packages from the main packages build for now

* Fix main build

* Fix npm run test-unit: exclude react native packages

* Remove all dependencies that are needed for native e2e testing

* Add missing dependency for ci

* Remove react-native-aztec/example package files

* Revert changes on react-native-aztec example/editor

* Fix package.json errors

* Bring back equivalent-key-map to please the CI

* Fix a bridge import

* package-lock update

Co-authored-by: Tugdual de Kerviler <dekervit@gmail.com>
  • Loading branch information
dratwas and Tug authored Feb 7, 2020
1 parent 393420d commit 4c4b66c
Show file tree
Hide file tree
Showing 115 changed files with 18,833 additions and 21,650 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-module
node_modules
packages/block-serialization-spec-parser/parser.js
packages/e2e-tests/plugins
packages/react-native-*
playground/dist
vendor
wordpress
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ branches:
- master
- rnmobile/master
- rnmobile/releases
- feat/import-gutenberg-mobile-no-squash
- /wp\/.*/

env:
Expand Down
1 change: 1 addition & 0 deletions bin/packages/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ if ( files.length ) {
`**/benchmark/**`,
`**/{__mocks__,__tests__,test}/**`,
`**/{storybook,stories}/**`,
`**/react-native-*/**`,
],
onlyFiles: true,
} );
Expand Down
18 changes: 18 additions & 0 deletions docs/manifest-devhub.json
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,24 @@
"markdown_source": "../packages/project-management-automation/README.md",
"parent": "packages"
},
{
"title": "@wordpress/react-native-aztec",
"slug": "packages-react-native-aztec",
"markdown_source": "../packages/react-native-aztec/README.md",
"parent": "packages"
},
{
"title": "@wordpress/react-native-bridge",
"slug": "packages-react-native-bridge",
"markdown_source": "../packages/react-native-bridge/README.md",
"parent": "packages"
},
{
"title": "@wordpress/react-native-editor",
"slug": "packages-react-native-editor",
"markdown_source": "../packages/react-native-editor/README.md",
"parent": "packages"
},
{
"title": "@wordpress/redux-routine",
"slug": "packages-redux-routine",
Expand Down
33,374 changes: 18,592 additions & 14,782 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
"@wordpress/nux": "file:packages/nux",
"@wordpress/plugins": "file:packages/plugins",
"@wordpress/priority-queue": "file:packages/priority-queue",
"@wordpress/react-native-aztec": "file:packages/react-native-aztec",
"@wordpress/react-native-bridge": "file:packages/react-native-bridge",
"@wordpress/react-native-editor": "file:packages/react-native-editor",
"@wordpress/redux-routine": "file:packages/redux-routine",
"@wordpress/rich-text": "file:packages/rich-text",
"@wordpress/server-side-render": "file:packages/server-side-render",
Expand Down Expand Up @@ -103,6 +106,7 @@
"@wordpress/npm-package-json-lint-config": "file:packages/npm-package-json-lint-config",
"@wordpress/postcss-themes": "file:packages/postcss-themes",
"@wordpress/scripts": "file:packages/scripts",
"babel-jest": "24.9.0",
"babel-loader": "8.0.6",
"babel-plugin-emotion": "10.0.23",
"babel-plugin-inline-json-import": "0.3.2",
Expand All @@ -120,6 +124,7 @@
"cssnano": "4.1.10",
"deep-freeze": "0.0.1",
"enzyme": "3.9.0",
"equivalent-key-map": "0.2.2",
"eslint-plugin-eslint-comments": "3.1.2",
"eslint-plugin-import": "2.18.2",
"fast-glob": "2.2.7",
Expand All @@ -128,6 +133,7 @@
"husky": "3.0.5",
"inquirer": "6.3.1",
"is-equal-shallow": "0.1.3",
"jest": "24.9.0",
"jest-emotion": "10.0.17",
"jest-junit": "6.4.0",
"jest-serializer-enzyme": "1.0.0",
Expand All @@ -146,7 +152,7 @@
"progress": "2.0.3",
"react": "16.9.0",
"react-dom": "16.9.0",
"react-native": "0.60.0",
"react-native": "jtreanor/react-native#v0.60.0-patched",
"react-test-renderer": "16.9.0",
"rimraf": "2.6.2",
"rtlcss": "2.4.0",
Expand Down Expand Up @@ -192,6 +198,7 @@
"lint-css:fix": "npm run lint-css -- --fix",
"lint-types": "tsc",
"lint-md": "wp-scripts lint-md",
"native": "npm run --prefix packages/react-native-editor",
"package-plugin": "./bin/build-plugin-zip.sh",
"pot-to-php": "./bin/pot-to-php.js",
"publish:check": "lerna updated",
Expand All @@ -209,7 +216,7 @@
"test-unit-php": "wp-scripts env test-php",
"test-unit-php-multisite": "cross-env WP_MULTISITE=1 wp-scripts env test-php",
"test-unit:native": "cd test/native/ && cross-env NODE_ENV=test jest --config ./jest.config.js",
"test-unit:native:debug": "cd test/native/ && node --inspect-brk ../../node_modules/.bin/jest --runInBand --verbose --config ./jest.config.js",
"test-unit:native:debug": "cd test/native/ && node --inspect ../../node_modules/.bin/jest --runInBand --config ./jest.config.js",
"prestorybook:build": "npm run build:packages",
"storybook:build": "build-storybook -c ./storybook -o ./playground/dist",
"prestorybook:dev": "npm run build:packages",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
*/
import React from 'react';
import { View } from 'react-native';
import {
subscribeMediaUpload,
} from 'react-native-gutenberg-bridge';

/**
* WordPress dependencies
Expand All @@ -14,6 +11,9 @@ import {
Spinner,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import {
subscribeMediaUpload,
} from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
* External dependencies
*/
import { shallow } from 'enzyme';

/**
* WordPress dependencies
*/
import {
sendMediaUpload,
} from 'react-native-gutenberg-bridge';
} from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand All @@ -17,7 +21,7 @@ import {
MEDIA_UPLOAD_STATE_RESET,
} from '../';

jest.mock( 'react-native-gutenberg-bridge', () => {
jest.mock( '@wordpress/react-native-bridge', () => {
const callUploadCallback = ( payload ) => {
this.uploadCallBack( payload );
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* External dependencies
*/
import React from 'react';
import {
getOtherMediaOptions,
requestMediaPicker,
mediaSources,
} from 'react-native-gutenberg-bridge';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Picker } from '@wordpress/components';
import {
getOtherMediaOptions,
requestMediaPicker,
mediaSources,
} from '@wordpress/react-native-bridge';

export const MEDIA_TYPE_IMAGE = 'image';
export const MEDIA_TYPE_VIDEO = 'video';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
*/
import { shallow } from 'enzyme';
import { TouchableWithoutFeedback } from 'react-native';

/**
* WordPress dependencies
*/
import {
requestMediaPicker,
mediaSources,
} from 'react-native-gutenberg-bridge';
} from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
8 changes: 4 additions & 4 deletions packages/block-library/src/gallery/gallery-image.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
* External dependencies
*/
import { Image, StyleSheet, View, ScrollView, Text, TouchableWithoutFeedback } from 'react-native';
import {
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
} from 'react-native-gutenberg-bridge';
import { isEmpty } from 'lodash';

/**
Expand All @@ -17,6 +13,10 @@ import { __, sprintf } from '@wordpress/i18n';
import { Caption, MediaUploadProgress } from '@wordpress/block-editor';
import { isURL } from '@wordpress/url';
import { withPreferredColorScheme } from '@wordpress/compose';
import {
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
} from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
15 changes: 7 additions & 8 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
*/
import React from 'react';
import { View, ImageBackground, Text, TouchableWithoutFeedback, Dimensions } from 'react-native';
import {
requestMediaImport,
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
requestImageFullscreenPreview,
} from 'react-native-gutenberg-bridge';
import { isEmpty, map, get } from 'lodash';

/**
Expand All @@ -25,7 +18,6 @@ import {
ToolbarButton,
ToolbarGroup,
} from '@wordpress/components';

import {
BlockCaption,
MediaPlaceholder,
Expand All @@ -41,6 +33,13 @@ import { isURL } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import {
requestMediaImport,
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
requestImageFullscreenPreview,
} from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
10 changes: 5 additions & 5 deletions packages/block-library/src/media-text/media-container.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
* External dependencies
*/
import { View, ImageBackground, Text, TouchableWithoutFeedback } from 'react-native';
import {
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
} from 'react-native-gutenberg-bridge';

/**
* WordPress dependencies
Expand All @@ -31,6 +26,11 @@ import { Component } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { isURL } from '@wordpress/url';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import {
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
} from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
14 changes: 5 additions & 9 deletions packages/block-library/src/video/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ import React from 'react';
import { View, TouchableWithoutFeedback, Text } from 'react-native';
import { isEmpty } from 'lodash';

/**
* Internal dependencies
*/
import {
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
} from 'react-native-gutenberg-bridge';

/**
* WordPress dependencies
*/
Expand All @@ -38,6 +29,11 @@ import {
import { __, sprintf } from '@wordpress/i18n';
import { isURL } from '@wordpress/url';
import { doAction, hasAction } from '@wordpress/hooks';
import {
mediaUploadSync,
requestImageFailedRetryDialog,
requestImageUploadCancelDialog,
} from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/components/layout/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { Platform, SafeAreaView, View } from 'react-native';
import SafeArea from 'react-native-safe-area';
import { sendNativeEditorDidLayout } from 'react-native-gutenberg-bridge';

/**
* WordPress dependencies
Expand All @@ -14,6 +13,7 @@ import { BottomSheetSettings, __experimentalPageTemplatePicker, __experimentalWi
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import { HTMLTextInput, KeyboardAvoidingView, ReadableContentView } from '@wordpress/components';
import { AutosaveMonitor } from '@wordpress/editor';
import { sendNativeEditorDidLayout } from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/editor.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import memize from 'memize';
import { size, map, without } from 'lodash';
import { subscribeSetFocusOnTitle } from 'react-native-gutenberg-bridge';

/**
* WordPress dependencies
Expand All @@ -14,6 +13,7 @@ import { parse, serialize } from '@wordpress/blocks';
import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';
import { SlotFillProvider } from '@wordpress/components';
import { subscribeSetFocusOnTitle } from '@wordpress/react-native-bridge';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-post/src/test/editor.native.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* External dependencies
*/
import RNReactNativeGutenbergBridge from 'react-native-gutenberg-bridge';
import { mount } from 'enzyme';
import { act } from 'react-dom/test-utils';

/**
* WordPress dependencies
*/
import { registerCoreBlocks } from '@wordpress/block-library';
import RNReactNativeGutenbergBridge from '@wordpress/react-native-bridge';
// Force register 'core/editor' store.
import { store } from '@wordpress/editor'; // eslint-disable-line no-unused-vars

Expand Down
18 changes: 7 additions & 11 deletions packages/editor/src/components/provider/index.native.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
/**
* External dependencies
*/
import RNReactNativeGutenbergBridge, {
subscribeParentGetHtml,
subscribeParentToggleHTMLMode,
subscribeUpdateHtml,
subscribeSetTitle,
subscribeMediaAppend,
} from 'react-native-gutenberg-bridge';

/**
* WordPress dependencies
*/
Expand All @@ -17,6 +6,13 @@ import { parse, serialize, getUnregisteredTypeHandlerName, createBlock } from '@
import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';
import { doAction } from '@wordpress/hooks';
import RNReactNativeGutenbergBridge, {
subscribeParentGetHtml,
subscribeParentToggleHTMLMode,
subscribeUpdateHtml,
subscribeSetTitle,
subscribeMediaAppend,
} from '@wordpress/react-native-bridge';

const postTypeEntities = [
{ name: 'post', baseURL: '/wp/v2/posts' },
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/store/actions.native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
* WordPress dependencies
*/
import RNReactNativeGutenbergBridge from 'react-native-gutenberg-bridge';
import RNReactNativeGutenbergBridge from '@wordpress/react-native-bridge';

export * from './actions.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-aztec/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'react-native-aztec'
rootProject.name = '@wordpress/react-native-aztec'

Loading

0 comments on commit 4c4b66c

Please sign in to comment.