Skip to content

Commit

Permalink
[Packager] Windows support for Packager - Blacklist changes
Browse files Browse the repository at this point in the history
Summary:
Another Pull Request implementing the changes in issue #468 - Enabled Packager to run on Windows
This change relates to the blacklist fixes. It includes the path conversion for blacklist and changes to the default watched directory.  It has no impact on Mac OSX.
Closes #893
Github Author: Joe Wood <joewood>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
  • Loading branch information
Joe Wood committed Jun 27, 2015
1 parent de020b4 commit 19e3239
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packager/blacklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
*/
'use strict';

var path = require('path');

// Don't forget to everything listed here to `testConfig.json`
// modulePathIgnorePatterns.
var sharedBlacklist = [
Expand Down Expand Up @@ -39,7 +41,9 @@ var platformBlacklists = {
};

function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
var escaped = str.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
// convert the '/' into an escaped local file separator
return escaped.replace(/\//g,'\\' + path.sep);
}

function blacklist(platform, additionalBlacklist) {
Expand Down
8 changes: 5 additions & 3 deletions packager/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ if (options.projectRoots) {
options.projectRoots = options.projectRoots.split(',');
}
} else {
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
// packager is running from node_modules of another project
// match on either path separator
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
// packager is running from node_modules of another project
options.projectRoots = [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods\/React\/packager$/)) {
// packager is running from node_modules of another project
Expand All @@ -97,7 +98,8 @@ if (options.assetRoots) {
});
}
} else {
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
// match on either path separator
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
options.assetRoots = [path.resolve(__dirname, '../../..')];
} else if (__dirname.match(/Pods\/React\/packager$/)) {
options.assetRoots = [path.resolve(__dirname, '../../..')];
Expand Down

0 comments on commit 19e3239

Please sign in to comment.