Scan a list of assigns in nodejs
The fact that you're parsing BASH means you're probably not worried about portability, which means you probably don't need the path module since the directory separator will always be /. So, you can replace p.join(__dirname, 'localEnv.sh') with __dirname+'/localEnv.sh'
There's a module for reading stuff line by line already, no need to home-roll it.
This is a better regex because it takes escaped quotes into account: "(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*' see here.




require('readline').createInterface({
  input: require('fs').createReadStream(__dirname+'/localEnv.sh')
}).on('line', function (line) {
  var tokens = line.split(' ')
  if (tokens[0] === 'export') {
    var [ name, value ] = tokens[1].split('=')
    process.env[name] = value.match(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/)[1]
  }
});