Skip to content
Merged
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
8 changes: 6 additions & 2 deletions tools/postinstall/apply-patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,12 @@ Object.keys(PATCHES_PER_FILE).forEach(filePath => {
* not apply cleanly.
*/
function applyPatch(patchFile) {
const patchMarkerFileName = `${path.basename(patchFile)}.patch_marker`;
const patchMarkerPath = path.join(projectDir, 'node_modules/', patchMarkerFileName);
// Note: We replace non-word characters from the patch marker file name.
// This is necessary because Yarn throws if cached node modules are restored
// which contain files with special characters. Below is an example error:
// ENOTDIR: not a directory, scandir '/<...>/node_modules/@angular_bazel_ng_module.<..>'".
const patchMarkerBasename = `${path.basename(patchFile).replace(/[^\w]/, '_')}`;
const patchMarkerPath = path.join(projectDir, 'node_modules/', patchMarkerBasename);

if (hasFileBeenPatched(patchMarkerPath)) {
return;
Expand Down