Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan committed Apr 20, 2019
1 parent 1de73a4 commit b885300
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions internal/npm_install/generate_build_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ module.exports = {
*/
function renameBazelFiles(pkg) {
pkg._files = pkg._files.map(file => {
if (/^node_modules[/\\]/.test(file)) {
// don't rename files in nested node_modules
return file;
}
const basename = path.basename(file);
if (/^WORKSPACE$/i.test(basename) || /^BUILD$/i.test(basename) ||
/^BUILD\.bazel$/i.test(basename)) {
Expand Down Expand Up @@ -680,9 +684,10 @@ function filterFiles(files, exts = []) {
files = files.filter(f => !f.match(/[^\x21-\x7E]/));
files = files.filter(f => {
const basename = path.basename(f);
// Bazel files would have been renamed earlier with a _ prefix
if (/^_WORKSPACE$/i.test(basename) || /^_BUILD$/i.test(basename) ||
/^_BUILD\.bazel$/i.test(basename)) {
// Bazel files of non-nested node_modules would have been renamed earlier with a _ prefix
if (/^WORKSPACE$/i.test(basename) || /^BUILD$/i.test(basename) ||
/^BUILD\.bazel$/i.test(basename) || /^_WORKSPACE$/i.test(basename) ||
/^_BUILD$/i.test(basename) || /^_BUILD\.bazel$/i.test(basename)) {
return false;
} else {
return true;
Expand Down

0 comments on commit b885300

Please sign in to comment.