Skip to content

Commit e4f678d

Browse files
authored
Self-host deelay proxy (#428)
1 parent d827d42 commit e4f678d

File tree

9 files changed

+91
-10
lines changed

9 files changed

+91
-10
lines changed

examples/react-native/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"ios": "react-native run-ios",
88
"start": "react-native start",
99
"test": "jest",
10-
"storybook": "(adb reverse tcp:7007 tcp:7007 > /dev/null || true) && echo 'y' | start-storybook -p 7007 | react-native start --projectRoot storybook --watchFolders $PWD",
10+
"storybook": "(adb reverse tcp:7007 tcp:7007 > /dev/null || true) && echo 'y' | start-storybook -p 7007 | react-native start --projectRoot storybook --watchFolders $PWD | deelay",
1111
"update-loki": "LOKI_FILE=`cd ../.. && echo \\`pwd\\`/\\`npm pack\\`` && npm install $LOKI_FILE --no-save && rm $LOKI_FILE"
1212
},
1313
"dependencies": {
@@ -24,6 +24,7 @@
2424
"@storybook/react-native": "^5.3.23",
2525
"@storybook/react-native-server": "^5.3.23",
2626
"babel-jest": "^26.6.3",
27+
"deelay": "^2.0.0",
2728
"jest": "^26.6.3",
2829
"loki": "*",
2930
"metro-react-native-babel-preset": "^0.67.0",

examples/react-native/storybook/stories/Logo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Image } from 'react-native';
44

5-
const DELAY_URL_PREFIX = 'https://www.deelay.me';
5+
const DELAY_URL_PREFIX = 'http://localhost:4567';
66

77
const Logo = ({ delay, logoUrl }) => (
88
<Image

examples/react/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"build": "react-scripts build",
1818
"test": "loki",
1919
"pretest-ci": "build-storybook",
20-
"test-ci": "loki --requireReference --reactUri file:./storybook-static",
20+
"test-ci": "concurrently --kill-others --raw --success first 'loki --requireReference --reactUri file:./storybook-static' 'deelay'",
2121
"eject": "react-scripts eject",
22-
"storybook": "start-storybook -p 6006 -s public",
22+
"storybook": "concurrently --kill-others --raw --success first 'start-storybook -p 6006 -s public' 'deelay'",
2323
"build-storybook": "build-storybook -s public --quiet"
2424
},
2525
"eslintConfig": {
@@ -52,6 +52,8 @@
5252
"@storybook/preset-create-react-app": "^4.1.0",
5353
"@storybook/react": "^6.4.19",
5454
"@storybook/testing-library": "^0.0.9",
55+
"concurrently": "^7.6.0",
56+
"deelay": "^2.0.0",
5557
"loki": "^0.30.3",
5658
"webpack": "^5.70.0"
5759
}

examples/react/src/async/Logo.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
const DELAY_URL_PREFIX = 'http://www.deelay.me';
4+
const getDelayUrl = (url, delay) =>
5+
`http://${
6+
window.navigator.webdriver ? 'host.docker.internal' : 'localhost'
7+
}:4567/${delay}/${url}`;
58

69
const Logo = ({ delay, logoUrl }) => (
710
<img
811
style={{ width: 75, height: 75 }}
912
alt=""
10-
src={delay ? `${DELAY_URL_PREFIX}/${delay}/${logoUrl}` : logoUrl}
13+
src={delay ? getDelayUrl(logoUrl, delay) : logoUrl}
1114
/>
1215
);
1316

packages/runner/src/commands/approve/parse-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22
const minimist = require('minimist');
3-
const defaults = require('../test/default-options');
3+
const defaults = require('../test/default-options.json');
44

55
function parseOptions(args, config) {
66
const argv = minimist(args);

packages/runner/src/commands/test/parse-options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path');
22
const minimist = require('minimist');
33
const ciInfo = require('ci-info');
4-
const defaults = require('./default-options');
4+
const defaults = require('./default-options.json');
55

66
function parseOptions(args, config) {
77
const argv = minimist(args, {

packages/target-chrome-docker/src/create-chrome-docker-target.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function createChromeDockerTarget({
6363
if (!chromeDockerWithoutSeccomp) {
6464
runArgs.push(`--security-opt=seccomp=${__dirname}/docker-seccomp.json`);
6565
}
66+
runArgs.push('--add-host=host.docker.internal:host-gateway');
6667

6768
if (dockerUrl.indexOf('http://localhost') === 0) {
6869
const ip = getLocalIPAddress();

packages/target-native-android-emulator/src/create-android-emulator-target.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require('fs-extra');
22
const tempy = require('tempy');
3-
const osnap = require('@ferocia-oss/src/android');
3+
const osnap = require('@ferocia-oss/osnap/src/android');
44
const { createWebsocketTarget } = require('@loki/target-native-core');
55

66
const captureScreenshot = async (device) => {

yarn.lock

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7571,6 +7571,15 @@ cliui@^7.0.2:
75717571
strip-ansi "^6.0.0"
75727572
wrap-ansi "^7.0.0"
75737573

7574+
cliui@^8.0.1:
7575+
version "8.0.1"
7576+
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa"
7577+
integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==
7578+
dependencies:
7579+
string-width "^4.2.0"
7580+
strip-ansi "^6.0.1"
7581+
wrap-ansi "^7.0.0"
7582+
75747583
clone-deep@^4.0.1:
75757584
version "4.0.1"
75767585
resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387"
@@ -7868,6 +7877,21 @@ concat-with-sourcemaps@*:
78687877
dependencies:
78697878
source-map "^0.6.1"
78707879

7880+
concurrently@^7.6.0:
7881+
version "7.6.0"
7882+
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-7.6.0.tgz#531a6f5f30cf616f355a4afb8f8fcb2bba65a49a"
7883+
integrity sha512-BKtRgvcJGeZ4XttiDiNcFiRlxoAeZOseqUvyYRUp/Vtd+9p1ULmeoSqGsDA+2ivdeDFpqrJvGvmI+StKfKl5hw==
7884+
dependencies:
7885+
chalk "^4.1.0"
7886+
date-fns "^2.29.1"
7887+
lodash "^4.17.21"
7888+
rxjs "^7.0.0"
7889+
shell-quote "^1.7.3"
7890+
spawn-command "^0.0.2-1"
7891+
supports-color "^8.1.0"
7892+
tree-kill "^1.2.2"
7893+
yargs "^17.3.1"
7894+
78717895
config-chain@^1.1.11:
78727896
version "1.1.12"
78737897
resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa"
@@ -8674,6 +8698,11 @@ data-urls@^2.0.0:
86748698
whatwg-mimetype "^2.3.0"
86758699
whatwg-url "^8.0.0"
86768700

8701+
date-fns@^2.29.1:
8702+
version "2.29.3"
8703+
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
8704+
integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==
8705+
86778706
dateformat@^3.0.0:
86788707
version "3.0.3"
86798708
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
@@ -8821,6 +8850,11 @@ dedent@^0.7.0:
88218850
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
88228851
integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=
88238852

8853+
deelay@^2.0.0:
8854+
version "2.0.0"
8855+
resolved "https://registry.yarnpkg.com/deelay/-/deelay-2.0.0.tgz#8804351b51c1d5dcbb60473a4df9eafab4e172ba"
8856+
integrity sha512-fT9u5WAwtuYM2oZjrwvkWW7DYYZ+AGIbakUx3w/FR2BjwyxXaK7XoxubQ2+MpFEa+qzVWldsO3ek5oxPexT4UA==
8857+
88248858
deep-equal@^1.0.1:
88258859
version "1.1.1"
88268860
resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.1.tgz#b5c98c942ceffaf7cb051e24e1434a25a2e6076a"
@@ -18684,6 +18718,13 @@ rxjs@^6.4.0, rxjs@^6.6.3:
1868418718
dependencies:
1868518719
tslib "^1.9.0"
1868618720

18721+
rxjs@^7.0.0:
18722+
version "7.6.0"
18723+
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.6.0.tgz#361da5362b6ddaa691a2de0b4f2d32028f1eb5a2"
18724+
integrity sha512-DDa7d8TFNUalGC9VqXvQ1euWNN7sc63TrUCuM9J998+ViviahMIjKSOU7rfcgFOF+FCD71BhDRv4hrFz+ImDLQ==
18725+
dependencies:
18726+
tslib "^2.1.0"
18727+
1868718728
safe-buffer@5.1.1:
1868818729
version "5.1.1"
1868918730
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
@@ -19344,6 +19385,11 @@ space-separated-tokens@^1.0.0:
1934419385
resolved "https://registry.yarnpkg.com/space-separated-tokens/-/space-separated-tokens-1.1.4.tgz#27910835ae00d0adfcdbd0ad7e611fb9544351fa"
1934519386
integrity sha512-UyhMSmeIqZrQn2UdjYpxEkwY9JUrn8pP+7L4f91zRzOQuI8MF1FGLfYU9DKCYeLdo7LXMxwrX5zKFy7eeeVHuA==
1934619387

19388+
spawn-command@^0.0.2-1:
19389+
version "0.0.2-1"
19390+
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"
19391+
integrity sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==
19392+
1934719393
spdx-correct@^3.0.0:
1934819394
version "3.1.1"
1934919395
resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9"
@@ -19918,7 +19964,7 @@ supports-color@^7.0.0, supports-color@^7.1.0:
1991819964
dependencies:
1991919965
has-flag "^4.0.0"
1992019966

19921-
supports-color@^8.0.0:
19967+
supports-color@^8.0.0, supports-color@^8.1.0:
1992219968
version "8.1.1"
1992319969
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
1992419970
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
@@ -20475,6 +20521,11 @@ transliteration@^2.2.0:
2047520521
dependencies:
2047620522
yargs "^16.1.0"
2047720523

20524+
tree-kill@^1.2.2:
20525+
version "1.2.2"
20526+
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
20527+
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
20528+
2047820529
tree-node-cli@^1.2.5:
2047920530
version "1.2.5"
2048020531
resolved "https://registry.yarnpkg.com/tree-node-cli/-/tree-node-cli-1.2.5.tgz#afd75437976bbf2cc0c52b9949798e7530e8fd8c"
@@ -20587,6 +20638,11 @@ tslib@^2.0.3, tslib@^2.3.0:
2058720638
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
2058820639
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
2058920640

20641+
tslib@^2.1.0:
20642+
version "2.4.1"
20643+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e"
20644+
integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==
20645+
2059020646
tsutils@^3.17.1:
2059120647
version "3.17.1"
2059220648
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
@@ -22015,6 +22071,11 @@ yargs-parser@^20.2.2:
2201522071
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
2201622072
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
2201722073

22074+
yargs-parser@^21.1.1:
22075+
version "21.1.1"
22076+
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
22077+
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
22078+
2201822079
yargs@^14.2.2:
2201922080
version "14.2.2"
2202022081
resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.2.tgz#2769564379009ff8597cdd38fba09da9b493c4b5"
@@ -22058,6 +22119,19 @@ yargs@^16.2.0:
2205822119
y18n "^5.0.5"
2205922120
yargs-parser "^20.2.2"
2206022121

22122+
yargs@^17.3.1:
22123+
version "17.6.2"
22124+
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541"
22125+
integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==
22126+
dependencies:
22127+
cliui "^8.0.1"
22128+
escalade "^3.1.1"
22129+
get-caller-file "^2.0.5"
22130+
require-directory "^2.1.1"
22131+
string-width "^4.2.3"
22132+
y18n "^5.0.5"
22133+
yargs-parser "^21.1.1"
22134+
2206122135
yargs@^2.3.0:
2206222136
version "2.3.0"
2206322137
resolved "https://registry.yarnpkg.com/yargs/-/yargs-2.3.0.tgz#e900c87250ec5cd080db6009fe3dd63156f1d7fb"

0 commit comments

Comments
 (0)