mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53f688f07c | ||
|
|
ff6d9cc03e | ||
|
|
91df57c0a5 | ||
|
|
e7bb56d676 | ||
|
|
444712052a | ||
|
|
035c181e77 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "React"
|
||||
s.version = "0.8.0"
|
||||
s.version = "0.14.0-rc"
|
||||
s.summary = "Build high quality mobile apps using React."
|
||||
s.description = <<-DESC
|
||||
React Native apps are built using the React JS
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=0.12.0-SNAPSHOT
|
||||
VERSION_NAME=0.14.0
|
||||
GROUP=com.facebook.react
|
||||
|
||||
POM_NAME=ReactNative
|
||||
|
||||
+14
-10
@@ -12,15 +12,7 @@ var path = require('path');
|
||||
*/
|
||||
var config = {
|
||||
getProjectRoots() {
|
||||
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli$/)) {
|
||||
// packager is running from node_modules of another project
|
||||
return [path.resolve(__dirname, '../../..')];
|
||||
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
|
||||
// packager is running from node_modules of another project
|
||||
return [path.resolve(__dirname, '../../..')];
|
||||
} else {
|
||||
return [path.resolve(__dirname, '..')];
|
||||
}
|
||||
return getRoots();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -29,7 +21,7 @@ var config = {
|
||||
* `./<image.extension>` don't require any entry in here.
|
||||
*/
|
||||
getAssetRoots() {
|
||||
return [];
|
||||
return getRoots();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -41,4 +33,16 @@ var config = {
|
||||
}
|
||||
};
|
||||
|
||||
function getRoots() {
|
||||
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]local-cli$/)) {
|
||||
// packager is running from node_modules of another project
|
||||
return [path.resolve(__dirname, '../../..')];
|
||||
} else if (__dirname.match(/Pods[\/\\]React[\/\\]packager$/)) {
|
||||
// packager is running from node_modules of another project
|
||||
return [path.resolve(__dirname, '../../..')];
|
||||
} else {
|
||||
return [path.resolve(__dirname, '..')];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -74,5 +74,5 @@ android {
|
||||
dependencies {
|
||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
||||
compile "com.android.support:appcompat-v7:23.0.1"
|
||||
compile "com.facebook.react:react-native:0.13.0"
|
||||
compile "com.facebook.react:react-native:0.14.+"
|
||||
}
|
||||
|
||||
Generated
+12
@@ -3733,6 +3733,18 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"opn": {
|
||||
"version": "3.0.2",
|
||||
"from": "opn@*",
|
||||
"resolved": "https://registry.npmjs.org/opn/-/opn-3.0.2.tgz",
|
||||
"dependencies": {
|
||||
"object-assign": {
|
||||
"version": "3.0.0",
|
||||
"from": "object-assign@>=3.0.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optimist": {
|
||||
"version": "0.6.1",
|
||||
"from": "optimist@0.6.1",
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native",
|
||||
"version": "0.12.0",
|
||||
"version": "0.14.0-rc",
|
||||
"description": "A framework for building native apps using React",
|
||||
"license": "BSD-3-Clause",
|
||||
"repository": {
|
||||
@@ -63,6 +63,7 @@
|
||||
"jstransform": "^11.0.3",
|
||||
"module-deps": "^3.9.1",
|
||||
"node-fetch": "^1.3.3",
|
||||
"opn": "^3.0.2",
|
||||
"optimist": "^0.6.1",
|
||||
"progress": "^1.1.8",
|
||||
"promise": "^7.0.4",
|
||||
|
||||
@@ -10,9 +10,21 @@
|
||||
|
||||
var execFile = require('child_process').execFile;
|
||||
var fs = require('fs');
|
||||
var opn = require('opn');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function(options) {
|
||||
function getChromeAppName() {
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
return 'google chrome';
|
||||
case 'win32':
|
||||
return 'chrome';
|
||||
default:
|
||||
return 'google-chrome';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function(options, isDebuggerConnected) {
|
||||
return function(req, res, next) {
|
||||
if (req.url === '/debugger-ui') {
|
||||
var debuggerPath = path.join(__dirname, 'debugger.html');
|
||||
@@ -29,19 +41,18 @@ module.exports = function(options) {
|
||||
'If you still need this, please let us know.'
|
||||
);
|
||||
} else if (req.url === '/launch-chrome-devtools') {
|
||||
if (isDebuggerConnected()) {
|
||||
// Dev tools are already open; no need to open another session
|
||||
res.end('OK');
|
||||
return;
|
||||
}
|
||||
var debuggerURL = 'http://localhost:' + options.port + '/debugger-ui';
|
||||
var script = 'launchChromeDevTools.applescript';
|
||||
console.log('Launching Dev Tools...');
|
||||
execFile(
|
||||
path.join(__dirname, script), [debuggerURL],
|
||||
function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
console.log('Failed to run ' + script, err);
|
||||
}
|
||||
console.log(stdout);
|
||||
console.warn(stderr);
|
||||
opn(debuggerURL, {app: [getChromeAppName()]}, function(err) {
|
||||
if (err) {
|
||||
console.error('Google Chrome exited with error:', err);
|
||||
}
|
||||
);
|
||||
});
|
||||
res.end('OK');
|
||||
} else {
|
||||
next();
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env osascript
|
||||
|
||||
-- Copyright (c) 2015-present, Facebook, Inc.
|
||||
-- All rights reserved.
|
||||
--
|
||||
-- This source code is licensed under the BSD-style license found in the
|
||||
-- LICENSE file in the root directory of this source tree. An additional grant
|
||||
-- of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
on run argv
|
||||
set theURL to item 1 of argv
|
||||
|
||||
tell application "Chrome"
|
||||
|
||||
if (count every window) = 0 then
|
||||
make new window
|
||||
end if
|
||||
|
||||
-- Find a tab currently running the debugger
|
||||
set found to false
|
||||
set theTabIndex to -1
|
||||
repeat with theWindow in every window
|
||||
set theTabIndex to 0
|
||||
repeat with theTab in every tab of theWindow
|
||||
set theTabIndex to theTabIndex + 1
|
||||
if theTab's URL is theURL then
|
||||
set found to true
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
if found then
|
||||
exit repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
if found then
|
||||
set index of theWindow to 1
|
||||
set theWindow's active tab index to theTabIndex
|
||||
else
|
||||
tell window 1
|
||||
activate
|
||||
make new tab with properties {URL:theURL}
|
||||
end tell
|
||||
end if
|
||||
end tell
|
||||
end run
|
||||
@@ -22,7 +22,7 @@ function attachToServer(server, path) {
|
||||
try {
|
||||
cn.send(JSON.stringify(message));
|
||||
} catch(e) {
|
||||
console.warn('WARN: ' + e.message);
|
||||
// Sometimes this call throws 'not opened'
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -57,7 +57,15 @@ function attachToServer(server, path) {
|
||||
});
|
||||
});
|
||||
|
||||
return wss;
|
||||
return {
|
||||
server: wss,
|
||||
isChromeConnected: function() {
|
||||
return clients
|
||||
.map(function(ws) { return ws.upgradeReq.headers['user-agent']; })
|
||||
.filter(Boolean)
|
||||
.some(function(userAgent) { return userAgent.includes('Chrome'); })
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -20,11 +20,13 @@ const path = require('path');
|
||||
const ReactPackager = require('../../../packager/react-packager');
|
||||
const statusPageMiddleware = require('../../../packager/statusPageMiddleware.js');
|
||||
const systraceProfileMiddleware = require('../../../packager/systraceProfileMiddleware.js');
|
||||
const webSocketProxy = require('../../../packager/webSocketProxy.js');
|
||||
|
||||
function runServer(args, config, readyCallback) {
|
||||
var wsProxy = null;
|
||||
const app = connect()
|
||||
.use(loadRawBodyMiddleware)
|
||||
.use(getDevToolsMiddleware(args))
|
||||
.use(getDevToolsMiddleware(args, () => wsProxy && wsProxy.isChromeConnected()))
|
||||
.use(openStackFrameInEditorMiddleware)
|
||||
.use(statusPageMiddleware)
|
||||
.use(systraceProfileMiddleware)
|
||||
@@ -39,7 +41,15 @@ function runServer(args, config, readyCallback) {
|
||||
.use(connect.compress())
|
||||
.use(connect.errorHandler());
|
||||
|
||||
return http.createServer(app).listen(args.port, '::', readyCallback);
|
||||
const serverInstance = http.createServer(app).listen(
|
||||
args.port,
|
||||
'::',
|
||||
function() {
|
||||
wsProxy = webSocketProxy.attachToServer(serverInstance, '/debugger-proxy');
|
||||
webSocketProxy.attachToServer(serverInstance, '/devtools');
|
||||
readyCallback();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getAppMiddleware(args, config) {
|
||||
|
||||
@@ -15,7 +15,6 @@ const parseCommandLine = require('../../../packager/parseCommandLine');
|
||||
const path = require('path');
|
||||
const Promise = require('promise');
|
||||
const runServer = require('./runServer');
|
||||
const webSocketProxy = require('../../../packager/webSocketProxy.js');
|
||||
|
||||
/**
|
||||
* Starts the React Native Packager Server.
|
||||
@@ -138,12 +137,9 @@ function _server(argv, config, resolve, reject) {
|
||||
}
|
||||
|
||||
function startServer(args, config) {
|
||||
const serverInstance = runServer(args, config, () =>
|
||||
runServer(args, config, () =>
|
||||
console.log('\nReact packager ready.\n')
|
||||
);
|
||||
|
||||
webSocketProxy.attachToServer(serverInstance, '/debugger-proxy');
|
||||
webSocketProxy.attachToServer(serverInstance, '/devtools');
|
||||
}
|
||||
|
||||
function argToArray(arg) {
|
||||
|
||||
Reference in New Issue
Block a user