Skip to content

Commit 7ead62a

Browse files
Esemesekgrabbou
authored andcommitted
imp: Extract debugger-ui (#832)
* imp: Extract debugger-ui * Extract styles, images and audio file * Typescript reference * Remove IIFE and add copyright comment
1 parent 0d06bd9 commit 7ead62a

File tree

19 files changed

+3093
-385
lines changed

19 files changed

+3093
-385
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build/
88
.eslintcache
99
!packages/cli/src/commands/init/__fixtures__/editTemplate/node_modules
1010
*.tsbuildinfo
11+
.cache

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
],
66
"scripts": {
77
"prebuild": "yarn build:ts",
8-
"build": "node ./scripts/build.js",
8+
"build": "node ./scripts/build.js && yarn build:debugger",
99
"build:ts": "node ./scripts/buildTs.js",
10+
"build:debugger": "yarn workspace @react-native-community/debugger-ui build",
1011
"build-clean": "rm -rf ./packages/*/build",
1112
"build-clean-all": "rm -rf ./packages/*/build ./packages/*/tsconfig.tsbuildinfo",
1213
"watch": "node ./scripts/watch.js",
@@ -16,7 +17,7 @@
1617
"lint": "eslint --ext .js,.ts . --cache --report-unused-disable-directives",
1718
"test:ci:cocoapods": "ruby packages/platform-ios/native_modules.rb",
1819
"postinstall": "yarn build",
19-
"link-packages": "PACKAGES=('tools' 'platform-ios' 'platform-android' 'cli' 'cli-types' 'global-cli') && cd packages && for PACKAGE in \"${PACKAGES[@]}\"; do cd $PACKAGE && yarn link && cd ..; done",
20+
"link-packages": "PACKAGES=('tools' 'platform-ios' 'platform-android' 'cli' 'cli-types' 'global-cli' 'debugger-ui') && cd packages && for PACKAGE in \"${PACKAGES[@]}\"; do cd $PACKAGE && yarn link && cd ..; done",
2021
"publish": "yarn build-clean-all && yarn install && lerna publish"
2122
},
2223
"dependencies": {
@@ -47,6 +48,7 @@
4748
"typescript": "^3.7.0"
4849
},
4950
"devDependencies": {
50-
"@babel/plugin-proposal-class-properties": "^7.5.5"
51+
"@babel/plugin-proposal-class-properties": "^7.5.5",
52+
"@babel/plugin-transform-runtime": "^7.6.2"
5153
}
5254
}

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@react-native-community/cli-platform-ios": "^3.0.0-alpha.7",
3232
"@react-native-community/cli-tools": "^3.0.0-alpha.7",
3333
"@react-native-community/cli-types": "^3.0.0-alpha.7",
34+
"@react-native-community/debugger-ui": "^3.0.0-alpha.7",
3435
"@types/mkdirp": "^0.5.2",
3536
"@types/node-notifier": "^5.4.0",
3637
"@types/semver": "^6.0.2",

packages/cli/src/commands/server/debugger-ui/index.html

Lines changed: 0 additions & 266 deletions
This file was deleted.

packages/cli/src/commands/server/middleware/MiddlewareManager.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import compression from 'compression';
99
import connect from 'connect';
1010
import errorhandler from 'errorhandler';
11-
import path from 'path';
12-
import serveStatic from 'serve-static';
1311
import {Server as WebSocketServer} from 'ws';
12+
import serveStatic from 'serve-static';
13+
import {debuggerUIMiddleware} from '@react-native-community/debugger-ui';
1414

1515
import indexPageMiddleware from './indexPage';
1616
import copyToClipBoardMiddleware from './copyToClipBoardMiddleware';
@@ -39,15 +39,13 @@ export default class MiddlewareManager {
3939
options: Options;
4040

4141
constructor(options: Options) {
42-
const debuggerUIFolder = path.join(__dirname, '..', 'debugger-ui');
43-
4442
this.options = options;
4543
this.app = connect()
4644
.use(getSecurityHeadersMiddleware)
4745
.use(loadRawBodyMiddleware)
4846
// @ts-ignore compression and connect types mismatch
4947
.use(compression())
50-
.use('/debugger-ui', serveStatic(debuggerUIFolder))
48+
.use('/debugger-ui', debuggerUIMiddleware())
5149
.use(openStackFrameInEditorMiddleware(this.options))
5250
.use(openURLMiddleware)
5351
.use(copyToClipBoardMiddleware)

packages/cli/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
{"path": "../tools"},
99
{"path": "../cli-types"},
1010
{"path": "../platform-ios"},
11-
{"path": "../platform-android"}
11+
{"path": "../platform-android"},
12+
{"path": "../debugger-ui"}
1213
],
1314
"include": ["../package.json"]
1415
}

packages/debugger-ui/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": [["@babel/plugin-transform-runtime", {"regenerator": true}]]
3+
}

packages/debugger-ui/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "@react-native-community/debugger-ui",
3+
"version": "3.0.0-alpha.7",
4+
"license": "MIT",
5+
"main": "./build/middleware",
6+
"scripts": {
7+
"build": "yarn build:ui && yarn build:middleware",
8+
"build:ui": "parcel build src/ui/index.html --out-dir build/ui --public-url '/debugger-ui'",
9+
"build:middleware": "tsc"
10+
},
11+
"files": [
12+
"build"
13+
],
14+
"devDependencies": {
15+
"@babel/core": "^7.6.4",
16+
"parcel-bundler": "^1.12.4"
17+
},
18+
"dependencies": {
19+
"serve-static": "^1.13.1"
20+
}
21+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import serveStatic from 'serve-static';
2+
import path from 'path';
3+
4+
export function debuggerUIMiddleware() {
5+
return serveStatic(path.join(__dirname, '..', 'ui'));
6+
}
1.07 KB
Loading

0 commit comments

Comments
 (0)