allow tilde in pluginPaths

Summary: `~` is not supported by node's `fs` functions. So we are replacing it manually.

Reviewed By: priteshrnandgaonkar

Differential Revision: D8658889

fbshipit-source-id: 36c9885a00a7e07e54ab416d6fda3b29bbda73b6
This commit is contained in:
Daniel Büchele
2018-07-03 09:54:04 -07:00
committed by Facebook Github Bot
parent c6eb0d6b1a
commit 0d5c98341a

View File

@@ -9,9 +9,10 @@ const path = require('path');
const url = require('url');
const fs = require('fs');
const compilePlugins = require('./compilePlugins.js');
const os = require('os');
// ensure .sonar folder and config exist
const sonarDir = path.join(require('os').homedir(), '.sonar');
const sonarDir = path.join(os.homedir(), '.sonar');
if (!fs.existsSync(sonarDir)) {
fs.mkdirSync(sonarDir);
}
@@ -33,6 +34,7 @@ const pluginPaths = config.pluginPaths
path.join(__dirname, '..', 'src', 'plugins'),
path.join(__dirname, '..', 'src', 'fb', 'plugins'),
)
.map(p => p.replace(/^~/, os.homedir()))
.filter(fs.existsSync);
process.env.CONFIG = JSON.stringify({