Resolve dev and peer dependencies for metro watcher
Summary: I've noticed that some plugins cannot be packaged after switching to Sandy and using "antd" as peer dependency. This change should fix this issue. Reviewed By: mweststrate Differential Revision: D25177510 fbshipit-source-id: cfb740a757c9eb83cf0e5165abed3f9c9f5591fa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4b10f39ebb
commit
31763b7499
@@ -27,10 +27,14 @@ export default async (packageDir: string): Promise<string[]> => {
|
|||||||
while (packagesToProcess.length > 0) {
|
while (packagesToProcess.length > 0) {
|
||||||
let currentDir = packagesToProcess.shift() as string;
|
let currentDir = packagesToProcess.shift() as string;
|
||||||
watchDirs.add(currentDir);
|
watchDirs.add(currentDir);
|
||||||
const {dependencies} = await fs.readJson(
|
const {dependencies, peerDependencies, devDependencies} = await fs.readJson(
|
||||||
path.join(currentDir, 'package.json'),
|
path.join(currentDir, 'package.json'),
|
||||||
);
|
);
|
||||||
const dependenciesSet = new Set<string>(Object.keys(dependencies ?? {}));
|
const dependenciesSet = new Set<string>([
|
||||||
|
...Object.keys(dependencies ?? {}),
|
||||||
|
...Object.keys(devDependencies ?? {}),
|
||||||
|
...Object.keys(peerDependencies ?? {}),
|
||||||
|
]);
|
||||||
while (dependenciesSet.size > 0) {
|
while (dependenciesSet.size > 0) {
|
||||||
const nodeModulesDir = path.join(currentDir, 'node_modules');
|
const nodeModulesDir = path.join(currentDir, 'node_modules');
|
||||||
if (await fs.pathExists(nodeModulesDir)) {
|
if (await fs.pathExists(nodeModulesDir)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user