mirror of https://github.com/status-im/metro.git
[Packager] Windows support for Packager - Blacklist changes
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 https://github.com/facebook/react-native/pull/893 Github Author: Joe Wood <joewood> Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
parent
15a0f07c5f
commit
157a77e48d
|
@ -8,6 +8,8 @@
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
// Don't forget to everything listed here to `testConfig.json`
|
// Don't forget to everything listed here to `testConfig.json`
|
||||||
// modulePathIgnorePatterns.
|
// modulePathIgnorePatterns.
|
||||||
var sharedBlacklist = [
|
var sharedBlacklist = [
|
||||||
|
@ -39,7 +41,9 @@ var platformBlacklists = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function escapeRegExp(str) {
|
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) {
|
function blacklist(platform, additionalBlacklist) {
|
||||||
|
|
|
@ -69,8 +69,9 @@ if (options.projectRoots) {
|
||||||
options.projectRoots = options.projectRoots.split(',');
|
options.projectRoots = options.projectRoots.split(',');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (__dirname.match(/node_modules\/react-native\/packager$/)) {
|
// match on either path separator
|
||||||
// packager is running from node_modules of another project
|
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {
|
||||||
|
// packager is running from node_modules of another project
|
||||||
options.projectRoots = [path.resolve(__dirname, '../../..')];
|
options.projectRoots = [path.resolve(__dirname, '../../..')];
|
||||||
} else if (__dirname.match(/Pods\/React\/packager$/)) {
|
} else if (__dirname.match(/Pods\/React\/packager$/)) {
|
||||||
// packager is running from node_modules of another project
|
// packager is running from node_modules of another project
|
||||||
|
@ -97,7 +98,8 @@ if (options.assetRoots) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} 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, '../../..')];
|
options.assetRoots = [path.resolve(__dirname, '../../..')];
|
||||||
} else if (__dirname.match(/Pods\/React\/packager$/)) {
|
} else if (__dirname.match(/Pods\/React\/packager$/)) {
|
||||||
options.assetRoots = [path.resolve(__dirname, '../../..')];
|
options.assetRoots = [path.resolve(__dirname, '../../..')];
|
||||||
|
|
Loading…
Reference in New Issue