mirror of
https://github.com/status-im/metro.git
synced 2025-02-07 16:54:09 +00:00
Packager status page & build validating against it.
Summary: Creating a packager status page so React can validate a proper packager instance is running on 8081. See #257 for details on this bug. The biggest thing in this PR is I have it perform an exit 2 in the build script if the check fails. This will cause the build to fail, they can click on the error and see a nice message. Not sure if there is a way to throw a warning instead. Also, I broke the bash script into several lines, in the Xcode editor it looks fine but in the source code it looks less than ideal. We might want to break that out into it's own bash script that is called. Let me know if you want to do that. Closes https://github.com/facebook/react-native/pull/308 Github Author: Justin Carmony <justin@justincarmony.com> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
parent
ab9f78496f
commit
ceeb06eb1a
12
packager.js
12
packager.js
@ -150,6 +150,17 @@ function getDevToolsLauncher(options) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A status page so the React/project.pbxproj build script
|
||||||
|
// can verify that packager is running on 8081 and not
|
||||||
|
// another program / service.
|
||||||
|
function statusPageMiddleware(req, res, next) {
|
||||||
|
if (req.url === '/status') {
|
||||||
|
res.end('packager-status:running');
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getAppMiddleware(options) {
|
function getAppMiddleware(options) {
|
||||||
return ReactPackager.middleware({
|
return ReactPackager.middleware({
|
||||||
projectRoots: options.projectRoots,
|
projectRoots: options.projectRoots,
|
||||||
@ -168,6 +179,7 @@ function runServer(
|
|||||||
.use(loadRawBody)
|
.use(loadRawBody)
|
||||||
.use(openStackFrameInEditor)
|
.use(openStackFrameInEditor)
|
||||||
.use(getDevToolsLauncher(options))
|
.use(getDevToolsLauncher(options))
|
||||||
|
.use(statusPageMiddleware)
|
||||||
.use(getAppMiddleware(options));
|
.use(getAppMiddleware(options));
|
||||||
|
|
||||||
options.projectRoots.forEach(function(root) {
|
options.projectRoots.forEach(function(root) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user