Skip to content

Commit

Permalink
[issue-988] Fix static server to support cors
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenduythuc committed Sep 28, 2023
1 parent f4dc29c commit 834a13c
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 316 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ There are 2 reasons why we do this:
### Requirement
- Install [yarn](https://yarnpkg.com/)
- Setup [react native development environment](https://reactnative.dev/docs/environment-setup) use React Native CLI.
- [CMake] is required on the build host for web runner.

- When building for **Android**, [CMake] should be installed as a part of your
_Android SDK_ (open _SDK Manager_, and look for [CMake] within
the _SDK Tools_ tab).

- On **MacOS**, the `pkg-config` dependency is also needed. You can install both via [Homebrew],
by executing:
```shell
$ brew install cmake pkg-config
```
**IMPORTANT:** [Homebrew] should have added `eval "$(/opt/homebrew/bin/brew shellenv)"'`
command to your `.zshrc` or `.bashrc`. Although this works for interactive terminals,
it might not work for sessions inside of other apps, such as XCode, therefore you might need to
manually create symbolic links:
```shell
$ sudo ln -s $(which cmake) /usr/local/bin/cmake
$ sudo ln -s $(which pkg-config) /usr/local/bin/pkg-config
```
For details read: https://earthly.dev/blog/homebrew-on-m1,
and [Issue#29](https://github.com/birdofpreyru/react-native-static-server/issues/29).
### Start development
- From package folder run `yarn start` to make sure we installed all required packages
Expand Down
54 changes: 25 additions & 29 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ PODS:
- React-Core
- CocoaAsyncSocket (7.6.5)
- DoubleConversion (1.1.6)
- dr-pogodin-react-native-fs (2.21.0-alpha.3):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- dr-pogodin-react-native-static-server (0.8.3):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- FBLazyVector (0.72.5)
- FBReactNativeSpec (0.72.5):
- RCT-Folly (= 2021.07.22.00)
Expand Down Expand Up @@ -71,25 +77,22 @@ PODS:
- FlipperKit/Core
- FlipperKit/FlipperKitNetworkPlugin
- fmt (6.2.1)
- GCDWebServer (3.5.4):
- GCDWebServer/Core (= 3.5.4)
- GCDWebServer/Core (3.5.4)
- glog (0.3.5)
- hermes-engine (0.72.5):
- hermes-engine/Pre-built (= 0.72.5)
- hermes-engine/Pre-built (0.72.5)
- libevent (2.1.12)
- libwebp (1.3.1):
- libwebp/demux (= 1.3.1)
- libwebp/mux (= 1.3.1)
- libwebp/sharpyuv (= 1.3.1)
- libwebp/webp (= 1.3.1)
- libwebp/demux (1.3.1):
- libwebp (1.3.2):
- libwebp/demux (= 1.3.2)
- libwebp/mux (= 1.3.2)
- libwebp/sharpyuv (= 1.3.2)
- libwebp/webp (= 1.3.2)
- libwebp/demux (1.3.2):
- libwebp/webp
- libwebp/mux (1.3.1):
- libwebp/mux (1.3.2):
- libwebp/demux
- libwebp/sharpyuv (1.3.1)
- libwebp/webp (1.3.1):
- libwebp/sharpyuv (1.3.2)
- libwebp/webp (1.3.2):
- libwebp/sharpyuv
- MMKV (1.3.1):
- MMKVCore (~> 1.3.1)
Expand Down Expand Up @@ -430,9 +433,6 @@ PODS:
- React-Core
- react-native-splash-screen (3.3.0):
- React-Core
- react-native-static-server (0.5.0):
- GCDWebServer (~> 3.0)
- React
- react-native-version-number (0.3.6):
- React
- react-native-video (5.2.1):
Expand Down Expand Up @@ -572,8 +572,6 @@ PODS:
- React-Core
- SDWebImage (~> 5.11.1)
- SDWebImageWebPCoder (~> 0.8.4)
- RNFS (2.20.0):
- React-Core
- RNGestureHandler (2.13.1):
- React-Core
- RNInAppBrowser (3.7.0):
Expand Down Expand Up @@ -639,6 +637,8 @@ DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- "dr-pogodin-react-native-fs (from `../node_modules/@dr.pogodin/react-native-fs`)"
- "dr-pogodin-react-native-static-server (from `../node_modules/@dr.pogodin/react-native-static-server`)"
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
- Flipper (= 0.182.0)
Expand Down Expand Up @@ -695,7 +695,6 @@ DEPENDENCIES:
- react-native-sensitive-info (from `../node_modules/react-native-sensitive-info`)
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
- react-native-splash-screen (from `../node_modules/react-native-splash-screen`)
- react-native-static-server (from `../node_modules/react-native-static-server`)
- react-native-version-number (from `../node_modules/react-native-version-number`)
- react-native-video (from `../node_modules/react-native-video`)
- react-native-view-shot (from `../node_modules/react-native-view-shot`)
Expand Down Expand Up @@ -725,7 +724,6 @@ DEPENDENCIES:
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNFastImage (from `../node_modules/react-native-fast-image`)
- RNFS (from `../node_modules/react-native-fs`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNInAppBrowser (from `../node_modules/react-native-inappbrowser-reborn`)
- RNKeychain (from `../node_modules/react-native-keychain`)
Expand All @@ -749,7 +747,6 @@ SPEC REPOS:
- Flipper-PeerTalk
- FlipperKit
- fmt
- GCDWebServer
- libevent
- libwebp
- MMKV
Expand All @@ -768,6 +765,10 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-linear-gradient"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
dr-pogodin-react-native-fs:
:path: "../node_modules/@dr.pogodin/react-native-fs"
dr-pogodin-react-native-static-server:
:path: "../node_modules/@dr.pogodin/react-native-static-server"
FBLazyVector:
:path: "../node_modules/react-native/Libraries/FBLazyVector"
FBReactNativeSpec:
Expand Down Expand Up @@ -833,8 +834,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/@react-native-community/slider"
react-native-splash-screen:
:path: "../node_modules/react-native-splash-screen"
react-native-static-server:
:path: "../node_modules/react-native-static-server"
react-native-version-number:
:path: "../node_modules/react-native-version-number"
react-native-video:
Expand Down Expand Up @@ -893,8 +892,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-device-info"
RNFastImage:
:path: "../node_modules/react-native-fast-image"
RNFS:
:path: "../node_modules/react-native-fs"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNInAppBrowser:
Expand All @@ -921,6 +918,8 @@ SPEC CHECKSUMS:
BVLinearGradient: 880f91a7854faff2df62518f0281afb1c60d49a3
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
dr-pogodin-react-native-fs: 6dd213e0cefdbd2ac1f2ad3f69f33260e8be627a
dr-pogodin-react-native-static-server: 7a6d1bdf696cb383bfbb35509730bf546ca5370c
FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7
FBReactNativeSpec: 448e08a759d29a96e15725ae532445bf4343567c
Flipper: 6edb735e6c3e332975d1b17956bcc584eccf5818
Expand All @@ -932,11 +931,10 @@ SPEC CHECKSUMS:
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
FlipperKit: 2efad7007d6745a3f95e4034d547be637f89d3f6
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
hermes-engine: f6cf92a471053245614d9d8097736f6337d5b86c
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: 33dc822fbbf4503668d09f7885bbfedc76c45e96
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
MMKV: 5a07930c70c70b86cd87761a42c8f3836fb681d7
MMKVCore: e50135dbd33235b6ab390635991bab437ab873c0
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
Expand Down Expand Up @@ -968,7 +966,6 @@ SPEC CHECKSUMS:
react-native-sensitive-info: d44e909d065f9c0e15734245e5dd6a24b82e3dcd
react-native-slider: 1cdd6ba29675df21f30544253bf7351d3c2d68c4
react-native-splash-screen: 4312f786b13a81b5169ef346d76d33bc0c6dc457
react-native-static-server: 201b2a945a35096be3ae7f43e367c65bcbd61343
react-native-version-number: b415bbec6a13f2df62bf978e85bc0d699462f37f
react-native-video: c26780b224543c62d5e1b2a7244a5cd1b50e8253
react-native-view-shot: f5507655f122e6b104888a11130f267a427f0d57
Expand Down Expand Up @@ -998,7 +995,6 @@ SPEC CHECKSUMS:
RNCPicker: 529d564911e93598cc399b56cc0769ce3675f8c8
RNDeviceInfo: bf8a32acbcb875f568217285d1793b0e8588c974
RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 38aa38413896620338948fbb5c90579a7b1c3fde
RNInAppBrowser: e36d6935517101ccba0e875bac8ad7b0cb655364
RNKeychain: a65256b6ca6ba6976132cc4124b238a5b13b3d9c
Expand All @@ -1017,4 +1013,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: d2e75413a9d4d28b9ab6ee8ae7baea6ba4324a25

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
},
"dependencies": {
"@coinbase/cbpay-js": "^1.7.0",
"@dr.pogodin/react-native-fs": ">=2.21.0-alpha.1",
"@dr.pogodin/react-native-static-server": "0.8.3",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-regular-svg-icons": "^6.2.1",
Expand Down Expand Up @@ -87,7 +89,6 @@
"react-native-elements": "^3.4.3",
"react-native-error-boundary": "^1.2.3",
"react-native-fast-image": "^8.6.3",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.9.0",
"react-native-image-picker": "^5.0.1",
"react-native-inappbrowser-reborn": "^3.7.0",
Expand All @@ -109,7 +110,6 @@
"react-native-sensitive-info": "^6.0.0-alpha.9",
"react-native-skeleton-placeholder": "^5.2.4",
"react-native-splash-screen": "^3.3.0",
"react-native-static-server": "^0.5.0",
"react-native-status-bar-height": "^2.6.0",
"react-native-svg": "^13.6.0",
"react-native-svg-transformer": "^1.0.0",
Expand Down
Loading

0 comments on commit 834a13c

Please sign in to comment.