Skip to content

Use different packager script depending on RN version #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const url = require('url');
const express = require('express');
const spawn = require('child_process').spawn;
const mkdirp = Promise.promisifyAll(require('mkdirp'));
const semver = require('semver');
const SourceNode = require('source-map').SourceNode;
const SourceMapConsumer = require('source-map').SourceMapConsumer;
const webpack = require('webpack');
Expand Down Expand Up @@ -260,15 +261,18 @@ class Server {
// XXX: Uses the node only invocation so we don't have to deal with bash
// as well... Fixes issues where server cannot be killed cleanly.
const cmd = 'node';
const args = [
'./node_modules/react-native/local-cli/cli.js',
'start',
const reactNativeVersion = require('react-native/package.json').version;
const script =
semver.lt(reactNativeVersion, '0.14.0')
? ['./node_modules/react-native/packager/packager.js']
: ['./node_modules/react-native/local-cli/cli.js', 'start'];
const args = script.concat([
'--root', this.entryDir,
'--port', this.packagerPort,
].concat(
this.resetCache ?
'--reset-cache' :
[]
]).concat(
this.resetCache
? '--reset-cache'
: []
);
const opts = {stdio: 'inherit'};
this.packageServer = spawn(cmd, args, opts);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"commander": "^2.8.1",
"express": "^4.13.3",
"mkdirp": "^0.5.1",
"semver": "^5.0.3",
"socket-retry-connect": "0.0.1",
"source-map": "^0.5.1"
},
Expand Down