Skip to content

Commit 0c2cede

Browse files
authored
Merge pull request #167 from gdavidkov/bugfix/update-nan-patch
Patch nan in Top-Level node_modules Directory
2 parents 3fac91f + 94dec01 commit 0c2cede

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tools/updatenan.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
const spawn = require('child_process').spawn
2-
2+
const existsSync = require('fs').existsSync
3+
const nanPath = existsSync('./node_modules/nan/nan.h') ? './node_modules/nan/nan.h' : '../nan/nan.h'
34
if (process.platform === 'win32') {
4-
spawn('powershell', ['-Command', "(Get-Content -Raw ./node_modules/nan/nan.h) -replace '#include \"nan_scriptorigin.h\"', '// #include \"nan_scriptorigin.h\"' | Out-File -Encoding Utf8 ./node_modules/nan/nan.h"], { stdio: 'inherit'})
5-
}else{
6-
spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', './node_modules/nan/nan.h'], { stdio: 'inherit'})
7-
}
8-
9-
5+
spawn('powershell', ['-Command', `(Get-Content -Raw ${nanPath}) -replace '#include \"nan_scriptorigin.h\"', '// #include \"nan_scriptorigin.h\"' | Out-File -Encoding Utf8 ${nanPath}`], { stdio: 'inherit' })
6+
} else {
7+
spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', nanPath], { stdio: 'inherit' })
8+
}

0 commit comments

Comments
 (0)