Skip to content

Commit

Permalink
[REFACTOR] Workspace repo setup (#121)
Browse files Browse the repository at this point in the history
* WIP: Workspace setup

* fix: move scripts to root
  • Loading branch information
wojteg1337 authored and michalchudziak committed Oct 30, 2019
1 parent ae81c16 commit 5220303
Show file tree
Hide file tree
Showing 37 changed files with 1,223 additions and 795 deletions.
13 changes: 7 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ jobs:
- run:
name: Jest
command: yarn run test:jest
- run:
name: Build Android JavaScript Bundle
command: yarn run test:detox:android:bundle:release
- run:
name: Build iOS JavaScript Bundle
command: yarn run test:detox:ios:bundle:release
# TODO: Uncomment after fixing detox setup
# - run:
# name: Build Android JavaScript Bundle
# command: yarn run test:detox:android:bundle:release
# - run:
# name: Build iOS JavaScript Bundle
# command: yarn run test:detox:ios:bundle:release

# To be uncommented as a part of https://github.com/react-native-community/react-native-slider/issues/34
# publish:
Expand Down
35 changes: 5 additions & 30 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

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

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
node_modules/react-native/Libraries/react-native/React.js

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

Expand All @@ -21,7 +13,7 @@ node_modules/react-native/Libraries/polyfills/.*
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/HMRLoadingView.js
.*/Libraries/Utilities/LoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
Expand All @@ -42,28 +34,11 @@ module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

module.system=haste
module.system.haste.use_name_reducers=true
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*

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='^\@react-native-community/slider\(.*\)$' -> '<PROJECT_ROOT>/js/Slider.js\1'
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
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\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
Expand Down Expand Up @@ -97,4 +72,4 @@ untyped-import
untyped-type-import

[version]
^0.98.0
^0.105.2
11 changes: 0 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
alias: {
'@react-native-community/slider': './js/Slider.js',
},
cwd: 'babelrc',
},
],
],
};
7 changes: 4 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ import com.android.build.OutputFile
*/

project.ext.react = [
entryFile: "index.js"
entryFile: "example/index.js",
// TODO: remove once @esemesek's patch is merged
cliPath: "../node_modules/react-native/cli.js"
]

apply from: "../../../node_modules/react-native/react.gradle"
Expand Down Expand Up @@ -166,7 +168,6 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-slider')

// JSC from node_modules
if (useIntlJsc) {
Expand All @@ -185,4 +186,4 @@ task copyDownloadableDepsToLibs(type: Copy) {

apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
// set custom root because we're in a monorepo
applyNativeModulesAppBuildGradle(project, "../..")
applyNativeModulesAppBuildGradle(project)
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ buildscript {
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
classpath("com.android.tools.build:gradle:3.4.2")

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -34,5 +33,6 @@ allprojects {

google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
4 changes: 2 additions & 2 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rootProject.name = 'example'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
// set custom root because we're in a monorepo
applyNativeModulesSettingsGradle(settings, "../..")
include ':app', ':react-native-slider'
applyNativeModulesSettingsGradle(settings)
include ':app'

18 changes: 12 additions & 6 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ require_relative "#{$node_modules_path}/@react-native-community/cli-platform-ios

target 'example' do
# Pods for example
pod 'FBLazyVector', :path => "#{$node_modules_path}/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "#{$node_modules_path}/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "#{$node_modules_path}/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "#{$node_modules_path}/react-native/Libraries/TypeSafety"

pod 'React', :path => "#{$node_modules_path}/react-native"
pod 'React-Core', :path => "#{$node_modules_path}/react-native/React"
pod 'React-DevSupport', :path => "#{$node_modules_path}/react-native/React"
pod 'React-fishhook', :path => "#{$node_modules_path}/react-native/Libraries/fishhook"
pod 'React-CoreModules', :path => "#{$node_modules_path}/react-native/React/CoreModules"
pod 'React-Core/DevSupport', :path => "#{$node_modules_path}/react-native/"
pod 'React-RCTActionSheet', :path => "#{$node_modules_path}/react-native/Libraries/ActionSheetIOS"
pod 'React-RCTAnimation', :path => "#{$node_modules_path}/react-native/Libraries/NativeAnimation"
pod 'React-RCTBlob', :path => "#{$node_modules_path}/react-native/Libraries/Blob"
Expand All @@ -19,17 +23,19 @@ target 'example' do
pod 'React-RCTSettings', :path => "#{$node_modules_path}/react-native/Libraries/Settings"
pod 'React-RCTText', :path => "#{$node_modules_path}/react-native/Libraries/Text"
pod 'React-RCTVibration', :path => "#{$node_modules_path}/react-native/Libraries/Vibration"
pod 'React-RCTWebSocket', :path => "#{$node_modules_path}/react-native/Libraries/WebSocket"
pod 'React-Core/RCTWebSocket', :path => "#{$node_modules_path}/react-native/"

pod 'React-cxxreact', :path => "#{$node_modules_path}/react-native/ReactCommon/cxxreact"
pod 'React-jsi', :path => "#{$node_modules_path}/react-native/ReactCommon/jsi"
pod 'React-jsiexecutor', :path => "#{$node_modules_path}/react-native/ReactCommon/jsiexecutor"
pod 'React-jsinspector', :path => "#{$node_modules_path}/react-native/ReactCommon/jsinspector"
pod 'yoga', :path => "#{$node_modules_path}/react-native/ReactCommon/yoga"
pod 'ReactCommon/jscallinvoker', :path => "#{$node_modules_path}/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "#{$node_modules_path}/react-native/ReactCommon"
pod 'Yoga', :path => "#{$node_modules_path}/react-native/ReactCommon/yoga"

pod 'DoubleConversion', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/glog.podspec"
pod 'Folly', :podspec => "#{$node_modules_path}/react-native/third-party-podspecs/Folly.podspec"

use_native_modules!("../..")
use_native_modules!
end
Loading

0 comments on commit 5220303

Please sign in to comment.