Replace ad-hoc home dir expansion with package
Summary: Instead of replacing the tilde with home-dirs on an incomplete, ad-hoc basis, let's use a package for this. It also supports `~USER` resolution which someone might reasonbly expect to work if `~/DIR` is working. Reviewed By: jknoxville Differential Revision: D13940956 fbshipit-source-id: 5bfa9b8b2540fed8c05c856ff736e48e925f985d
This commit is contained in:
committed by
Facebook Github Bot
parent
ce80e03e8f
commit
dc412ce0bc
@@ -11,6 +11,7 @@ const fs = require('fs');
|
||||
const Metro = require('metro');
|
||||
const util = require('util');
|
||||
const recursiveReaddir = require('recursive-readdir');
|
||||
const expandTilde = require('expand-tilde');
|
||||
const HOME_DIR = require('os').homedir();
|
||||
|
||||
/* eslint-disable prettier/prettier */
|
||||
@@ -115,7 +116,7 @@ function pluginEntryPoints(additionalPaths = []) {
|
||||
return entryPoints;
|
||||
}
|
||||
function entryPointForPluginFolder(pluginPath) {
|
||||
pluginPath = pluginPath.replace('~', HOME_DIR);
|
||||
pluginPath = expandTilde(pluginPath);
|
||||
if (!fs.existsSync(pluginPath)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user