Compare commits

...
10 Commits
Author SHA1 Message Date
Felix OghinaandMartin Konicek 68c209a831 [cli] spawn xterm on linux to run the packager
Also use ANDROID_HOME env var when running adb.
2015-10-08 21:24:17 +01:00
Martin Konicek 6345e8c8a6 Bump version of react-native-cli to 0.1.5 2015-10-08 20:53:30 +01:00
Martin Konicek 869cb9dbac [0.12.0] Bump npm version 2015-10-08 20:09:09 +01:00
Benjamin WinterbergandMartin Konicek 790e505224 Add --verbose option (fixes #2797) 2015-10-08 15:57:55 +01:00
Nick SimmonsandMartin Konicek 68503d352a [cli] make init backwards-compatible for real 2015-10-08 15:57:44 +01:00
Felix OghinăandMartin Konicek 99e78b7fcf [cli] make init backwards-compatible 2015-10-08 15:57:34 +01:00
jmhdezandMartin Konicek e3ca4bf649 Respect projectName on template creation 2015-10-08 15:57:15 +01:00
Martin Konicek 090effb74a Don't depend on temp Maven repo anymore.
The artifacts are now in JCenter:
https://bintray.com/bintray/jcenter/com.facebook.react%3Areact-native/view
2015-10-08 15:42:35 +01:00
Martin Konicek 12b92c1520 Temporarily depend on 0.12 Android binaries from JCenter repo
Published version 0.12.0 of the Android binaries. Naming the
version 0.12.0-SNAPSHOT or 0.12.0-rc is not supported,
will come up with a better version scheme for next release.

The version has been published to Maven Central:
https://repo1.maven.org/maven2/com/facebook/react/react-native/

However, after more than an hour it's still not available and
Gradle won't fetch it because it hasn't been mirrored to JCenter:
http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22react-native%22
https://bintray.com/bintray/jcenter/com.facebook.react%3Areact-native/view

As a workaround to make it available now, I published it under my
account which makes it available immediately:
https://bintray.com/mkonicek/maven/react-native/view

I also submitted a request to Bintray to publish the binaries here:
https://bintray.com/bintray/jcenter/com.facebook.react%3Areact-native/view

Once 0.12.0 propagates, we can revert this commit.

None of this affects the npm versioning. The npm version is 0.12.0-rc.
2015-09-24 23:05:09 +01:00
Martin Konicek 77cde0c29c [0.12.0-rc] 2015-09-24 22:48:44 +01:00
8 changed files with 55 additions and 21 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "React"
s.version = "0.8.0"
s.version = "0.12.0-rc"
s.summary = "Build high quality mobile apps using React."
s.description = <<-DESC
React Native apps are built using the React JS
@@ -25,5 +25,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.11.+'
compile 'com.facebook.react:react-native:0.12.+'
}
+2 -2
View File
@@ -3,11 +3,11 @@
var path = require('path');
var yeoman = require('yeoman-environment');
function init(projectDir, appName) {
function init(projectDir, argsOrName) {
console.log('Setting up new React Native app in ' + projectDir);
var env = yeoman.createEnv();
env.register(require.resolve(path.join(__dirname, 'generator')), 'react:app');
var args = process.argv.slice(3);
var args = Array.isArray(argsOrName) ? argsOrName : [argsOrName].concat(process.argv.slice(4));
var generator = env.create('react:app', {args: args});
generator.destinationRoot(projectDir);
generator.run();
+6 -3
View File
@@ -31,9 +31,10 @@ function buildAndRun() {
}
try {
var packageName = fs.readFileSync('app/src/main/AndroidManifest.xml', 'utf8').match(/package="(.+?)"/)[1];
var adbPath = process.env.ANDROID_HOME ? process.env.ANDROID_HOME + '/platform-tools/adb' : 'adb';
var adbArgs = ['shell', 'am', 'start', '-n', packageName + '/.MainActivity'];
console.log(chalk.bold('Starting the app (adb ' + adbArgs.join(' ') + ')...'));
child_process.spawnSync('adb', adbArgs, {
console.log(chalk.bold('Starting the app (' + adbPath + ' ' + adbArgs.join(' ') + ')...'));
child_process.spawnSync(adbPath, adbArgs, {
stdio: [process.stdin, process.stdout, process.stderr]
});
} catch (e) {
@@ -62,6 +63,8 @@ module.exports = function() {
console.log(chalk.yellow('[warn] JS server not recognized, continuing with build...'));
}
buildAndRun();
// make sure we don't wait around for the packager process
process.exit();
});
});
statusReq.on('error', function() {
@@ -70,4 +73,4 @@ module.exports = function() {
runPackager(true);
buildAndRun();
});
};
};
+11 -4
View File
@@ -5,9 +5,16 @@ var child_process = require('child_process');
module.exports = function(newWindow) {
if (newWindow) {
child_process.spawnSync('open', [
path.resolve(__dirname, '..', 'packager', 'launchPackager.command')
]);
var launchPackagerScript =
path.resolve(__dirname, '..', 'packager', 'launchPackager.command');
if (process.platform === 'darwin') {
child_process.spawnSync('open', [launchPackagerScript]);
} else if (process.platform === 'linux') {
child_process.spawn(
'xterm',
['-e', 'sh', launchPackagerScript],
{detached: true});
}
} else {
child_process.spawn('sh', [
path.resolve(__dirname, '..', 'packager', 'packager.sh'),
@@ -15,4 +22,4 @@ module.exports = function(newWindow) {
process.cwd(),
], {stdio: 'inherit'});
}
};
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "react-native",
"version": "0.8.0",
"version": "0.12.0",
"description": "A framework for building native apps using React",
"license": "BSD-3-Clause",
"repository": {
+32 -8
View File
@@ -9,6 +9,7 @@
var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var prompt = require('prompt');
var CLI_MODULE_PATH = function() {
@@ -42,10 +43,11 @@ if (cli) {
switch (args[0]) {
case 'init':
if (args[1]) {
init(args[1]);
var verbose = process.argv.indexOf('--verbose') >= 0;
init(args[1], verbose);
} else {
console.error(
'Usage: react-native init <ProjectName>'
'Usage: react-native init <ProjectName> [--verbose]'
);
process.exit(1);
}
@@ -81,17 +83,17 @@ function validatePackageName(name) {
}
}
function init(name) {
function init(name, verbose) {
validatePackageName(name);
if (fs.existsSync(name)) {
createAfterConfirmation(name);
createAfterConfirmation(name, verbose);
} else {
createProject(name);
createProject(name, verbose);
}
}
function createAfterConfirmation(name) {
function createAfterConfirmation(name, verbose) {
prompt.start();
var property = {
@@ -104,7 +106,7 @@ function createAfterConfirmation(name) {
prompt.get(property, function (err, result) {
if (result.yesno[0] === 'y') {
createProject(name);
createProject(name, verbose);
} else {
console.log('Project initialization canceled');
process.exit();
@@ -112,7 +114,7 @@ function createAfterConfirmation(name) {
});
}
function createProject(name) {
function createProject(name, verbose) {
var root = path.resolve(name);
var projectName = path.basename(root);
@@ -137,6 +139,15 @@ function createProject(name) {
process.chdir(root);
console.log('Installing react-native package from npm...');
if (verbose) {
runVerbose(root, projectName);
} else {
run(root, projectName);
}
}
function run(root, projectName) {
exec('npm install --save react-native', function(e, stdout, stderr) {
if (e) {
console.log(stdout);
@@ -145,6 +156,19 @@ function createProject(name) {
process.exit(1);
}
var cli = require(CLI_MODULE_PATH());
cli.init(root, projectName);
});
}
function runVerbose(root, projectName) {
var proc = spawn('npm', ['install', '--verbose', '--save', 'react-native'], {stdio: 'inherit'});
proc.on('close', function (code) {
if (code !== 0) {
console.error('`npm install --save react-native` failed');
return;
}
cli = require(CLI_MODULE_PATH());
cli.init(root, projectName);
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "react-native-cli",
"version": "0.1.4",
"version": "0.1.5",
"description": "The ReactNative cli tools",
"main": "index.js",
"scripts": {