Skip to content

Commit

Permalink
nan can be installed in the top level node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavidkov committed Nov 6, 2024
1 parent 3fac91f commit 9776220
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/updatenan.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const spawn = require('child_process').spawn
const existsSync = require('fs').existsSync

if (process.platform === 'win32') {
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'})
}else{
spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', './node_modules/nan/nan.h'], { stdio: 'inherit'})
}


const nanPath = existsSync('./node_modules/nan/nan.h') ? './node_modules/nan/nan.h' : '../nan/nan.h'
spawn('powershell', ['-Command', `(Get-Content -Raw ${nanPath}) -replace '#include \"nan_scriptorigin.h\"', '// #include \"nan_scriptorigin.h\"' | Out-File -Encoding Utf8 ${nanPath}`], { stdio: 'inherit' })
} else {
spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', './node_modules/nan/nan.h'], { stdio: 'inherit' })
}

0 comments on commit 9776220

Please sign in to comment.