Skip to content

Remove remaining need for fork of RN for win32 JS #3834

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

Merged
8 commits merged into from
Jan 7, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "patch",
"comment": "Remove remaining need for fork of RN for win32 JS",
"packageName": "@office-iss/react-native-win32",
"email": "acoates@microsoft.com",
"commit": "b17624cd44d682c73db5ae17a3d10c8bed07c5f8",
"date": "2019-12-20T19:19:05.418Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "Fix RNTester bundle (#2728)",
"packageName": "react-native-windows",
"email": "acoates@microsoft.com",
"commit": "65167fb5e52f042879d00891e89ed951bdda84bc",
"date": "2019-12-20T23:20:03.026Z"
}
158 changes: 158 additions & 0 deletions packages/react-native-win32/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
[ignore]
; We fork some components by platform - ignore all platforms except win32
.*/*[.]android.js
.*/*[.]ios.js
.*/*[.]macos.js
.*/*[.]windesktop.js

; These modules have base components and win32 versions.
; Ideally we'd delete the base versions of files that had .win32 overrides as part of the
; initRNLibraries build step
<PROJECT_ROOT>/Libraries/Alert/Alert.js
<PROJECT_ROOT>/Libraries/Color/normalizeColor.js
<PROJECT_ROOT>/Libraries/Color/normalizeColorObject.js
<PROJECT_ROOT>/Libraries/Color/NativeOrDynamicColorType.js
<PROJECT_ROOT>/Libraries/Components/SafeAreaView/SafeAreaView.js
<PROJECT_ROOT>/Libraries/Components/StatusBar/StatusBar.js
<PROJECT_ROOT>/Libraries/Components/TextInput/TextInput.js
<PROJECT_ROOT>/Libraries/Components/TextInput/TextInputState.js
<PROJECT_ROOT>/Libraries/Components/Touchable/TouchableNativeFeedback.js
<PROJECT_ROOT>/Libraries/Components/View/ReactNativeViewAttributes.js
<PROJECT_ROOT>/Libraries/Image/Image.js
<PROJECT_ROOT>/Libraries/Inspector/Inspector.js
<PROJECT_ROOT>/Libraries/Inspector/InspectorOverlay.js
<PROJECT_ROOT>/Libraries/Network/RCTNetworking.js
<PROJECT_ROOT>/Libraries/StyleSheet/StyleSheet.js
<PROJECT_ROOT>/Libraries/Utilities/DeviceInfo.js
<PROJECT_ROOT>/Libraries/Utilities/Dimensions.js
<PROJECT_ROOT>/Libraries/YellowBox/UI/YellowBoxInspectorHeader.js
<PROJECT_ROOT>/Libraries/YellowBox/UI/YellowBoxInspectorSourceMapStatus.js
<PROJECT_ROOT>/Libraries/YellowBox/UI/YellowBoxList.js
; This example currently uses mac dynamic colors
<PROJECT_ROOT>/RNTester/js/ActivityIndicatorExample.js
; This example currently uses mac dynamic colors
<PROJECT_ROOT>/RNTester/js/DarkModeExample.js


; Ignore react-native files in node_modules since they are copied into project root
.*/node_modules/react-native/.*

; These files dont need to be checked and just increase the build time
.*/node_modules/microsoft-reactnative-sampleapps/.*

; Ignore templates for 'react-native init'
<PROJECT_ROOT>/template/.*

; Ignore the Dangerfile
<PROJECT_ROOT>/bots/dangerfile.js

; 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
.*/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*

; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
.*/node_modules/warning/.*

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

; Ignore the src folder - flow files are combined with ones from react-native into the root Libraries folder
.*/react-native-win32/src/.*

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*
; Should work out how to do this properly
.*/react-native-win32/Libraries/Image/resolveAssetSource.win32.js

[include]
; Need to include hoisted modules
../../node_modules/

[libs]
Libraries/react-native/react-native-interface.js
flow/

[options]
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.file_ext=.js
module.file_ext=.json
module.file_ext=.win32.js

module.system=haste
module.system.haste.use_name_reducers=true
# keep the following in sync with server/haste/hasteImpl.js
# 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='^\(.*\)\.macos$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.win32$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.windesktop$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=<PROJECT_ROOT>/src/.*
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/Libraries/react-native/react-native-implementation.js
module.system.haste.paths.blacklist=<PROJECT_ROOT>/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/Libraries/Image/resolveAssetSource.js

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$' -> '<PROJECT_ROOT>/Libraries/react-native/react-native-implementation.js'
module.name_mapper='react-native/\(.*\)' -> '<PROJECT_ROOT>/\1'

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

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error

[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import

[version]
^0.98.0
2 changes: 2 additions & 0 deletions packages/react-native-win32/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/demo
/dist
/flow
/flow-typed
/index.*
/IntegrationTests
/jest
Expand Down
11 changes: 8 additions & 3 deletions packages/react-native-win32/just-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ task('copyPngFiles', () => {
return copyTask(['src/**/*.png'], '.');
});
task('initRNLibraries', () => {
require('./scripts/copyRNLibraries').copyRNLibraries();
require('../../vnext/scripts/copyRNLibraries').copyRNLibraries(__dirname);
});

task('flow-check', () => {
require('child_process').execSync('npx flow check', {stdio: 'inherit'});
});

task('ts', () => {
Expand All @@ -63,8 +67,8 @@ task('ts', () => {
});
task('clean', () => {
return cleanTask(
['jest', 'Libraries', 'RNTester', 'lib'].map(p =>
path.join(process.cwd(), p),
['dist', 'flow', 'flow-typed', 'jest', 'Libraries', 'RNTester', 'lib'].map(
p => path.join(process.cwd(), p),
),
);
});
Expand Down Expand Up @@ -95,6 +99,7 @@ task(
// trickle
// react-test
'ts',
'flow-check',
condition('apiExtractorVerify', () => argv().ci),
'apiExtractorUpdate',
'apiDocumenter',
Expand Down
19 changes: 11 additions & 8 deletions packages/react-native-win32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
"typings": "./Libraries/react-native/typings-main.d.ts",
"scripts": {
"build": "just-scripts build",
"bundle": "just-scripts prepareBundle && react-native bundle --platform win32 --entry-file RNTester.js --bundle-output dist/win32/dev/RNTester.bundle --assets-dest dist/win32/dev",
"change": "beachball change",
"clean": "just-scripts clean",
"start": "react-native start",
"lint": "just-scripts eslint",
"flow-check": "flow check",
"lint:fix": "eslint ./**/*.js ./**/*.ts? --fix",
"watch": "tsc -w",
"bundle": "just-scripts prepareBundle && react-native bundle --platform win32 --entry-file RNTester.js --bundle-output dist/win32/dev/RNTester.bundle --assets-dest dist/win32/dev",
"run-win32": "rex-win32 --bundle RNTester --component RNTesterApp --basePath ./dist/win32/dev",
"lint": "just-scripts eslint",
"run-win32-dev-web": "rex-win32 --bundle RNTester --component RNTesterApp --basePath ./dist/win32/dev --useWebDebugger",
"run-win32-devmain": "rex-win32 --bundle RNTester --component RNTesterApp --basePath ./dist/win32/dev --useDevMain",
"run-win32-dev-web": "rex-win32 --bundle RNTester --component RNTesterApp --basePath ./dist/win32/dev --useWebDebugger"
"run-win32": "rex-win32 --bundle RNTester --component RNTesterApp --basePath ./dist/win32/dev",
"start": "react-native start",
"watch": "tsc -w"
},
"dependencies": {
"@babel/runtime": "^7.4.0",
Expand All @@ -40,15 +41,17 @@
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"react-native": "https://github.com/microsoft/react-native/archive/v0.60.0-microsoft.31.tar.gz",
"@office-iss/rex-win32": "0.0.30",
"@types/es6-collections": "^0.5.29",
"@types/es6-promise": "0.0.32",
"@types/node": "^12.11.2",
"@types/prop-types": "15.5.1",
"@types/react": "16.9.11",
"@types/react-native": "~0.60.5",
"@types/react": "16.9.11",
"flow-bin": "^0.98.0",
"jscodeshift": "^0.6.2",
"just-scripts": "^0.24.2",
"react-native": "https://github.com/microsoft/react-native/archive/v0.60.0-microsoft.31.tar.gz",
"react": "16.8.6",
"rimraf": "^3.0.0"
},
Expand Down
98 changes: 0 additions & 98 deletions packages/react-native-win32/scripts/copyRNLibraries.js

This file was deleted.

Loading