Yarn start Failed with "Error: Unable to resolve module react-redux" (#883)
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/883 https://github.com/facebook/flipper/issues/835 Reviewed By: passy Differential Revision: D20363818 fbshipit-source-id: 66b7cb7236c7b066db32473a9e993ba2ace529bc
This commit is contained in:
committed by
Facebook Github Bot
parent
8a7e0578ff
commit
82881b7463
@@ -1,3 +1,2 @@
|
|||||||
{
|
{
|
||||||
"ignore_dirs": ["node_modules", "build", "dist"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,7 +232,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "yarn config set ignore-engines",
|
"preinstall": "node scripts/prepare-watchman-config.js && yarn config set ignore-engines",
|
||||||
"postinstall": "cross-env TS_NODE_FILES=true node --require ts-node/register scripts/yarn-install.ts && patch-package",
|
"postinstall": "cross-env TS_NODE_FILES=true node --require ts-node/register scripts/yarn-install.ts && patch-package",
|
||||||
"rm-dist": "rimraf dist",
|
"rm-dist": "rimraf dist",
|
||||||
"rm-modules": "rimraf node_modules static/node_modules",
|
"rm-modules": "rimraf node_modules static/node_modules",
|
||||||
|
|||||||
30
scripts/prepare-watchman-config.js
Normal file
30
scripts/prepare-watchman-config.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const util = require('util');
|
||||||
|
const {exists: existsImport, copyFile} = require('fs');
|
||||||
|
const exists = util.promisify(existsImport);
|
||||||
|
|
||||||
|
const rootDir = path.resolve(__dirname, '..');
|
||||||
|
const hasGit = exists(path.join(rootDir, '.git'));
|
||||||
|
|
||||||
|
async function prepareWatchmanConfig(dir) {
|
||||||
|
const hasWatchmanConfig = exists(path.join(dir, '.watchmanconfig'));
|
||||||
|
if ((await hasGit) && !(await hasWatchmanConfig)) {
|
||||||
|
console.log(`Creating .watchmanconfig in ${dir}`);
|
||||||
|
await util.promisify(copyFile)(
|
||||||
|
path.join(dir, '_watchmanconfig'),
|
||||||
|
path.join(dir, '.watchmanconfig'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareWatchmanConfig(rootDir);
|
||||||
|
prepareWatchmanConfig(path.join(rootDir, 'static'));
|
||||||
@@ -11,10 +11,8 @@ import path from 'path';
|
|||||||
import util from 'util';
|
import util from 'util';
|
||||||
import globImport from 'glob';
|
import globImport from 'glob';
|
||||||
import {exec as execImport} from 'child_process';
|
import {exec as execImport} from 'child_process';
|
||||||
import {exists as existsImport, copyFile} from 'fs';
|
|
||||||
const glob = util.promisify(globImport);
|
const glob = util.promisify(globImport);
|
||||||
const exec = util.promisify(execImport);
|
const exec = util.promisify(execImport);
|
||||||
const exists = util.promisify(existsImport);
|
|
||||||
const PACKAGES = [
|
const PACKAGES = [
|
||||||
'headless-tests',
|
'headless-tests',
|
||||||
'static',
|
'static',
|
||||||
@@ -28,9 +26,6 @@ const YARN_PATH =
|
|||||||
? path.join(__dirname, process.argv[2])
|
? path.join(__dirname, process.argv[2])
|
||||||
: 'yarn' + (WINDOWS ? '.cmd' : '');
|
: 'yarn' + (WINDOWS ? '.cmd' : '');
|
||||||
|
|
||||||
prepareWatchmanConfig(path.join(__dirname, '..'));
|
|
||||||
prepareWatchmanConfig(path.join(__dirname, '..', 'static'));
|
|
||||||
|
|
||||||
Promise.all(
|
Promise.all(
|
||||||
PACKAGES.map(pattern =>
|
PACKAGES.map(pattern =>
|
||||||
glob(path.join(__dirname, '..', pattern, 'package.json')),
|
glob(path.join(__dirname, '..', pattern, 'package.json')),
|
||||||
@@ -68,15 +63,3 @@ Promise.all(
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
async function prepareWatchmanConfig(dir: string) {
|
|
||||||
const hasGit = exists(path.join(__dirname, '..', '.git'));
|
|
||||||
const hasWatchmanConfig = exists(path.join(dir, '.watchmanconfig'));
|
|
||||||
if ((await hasGit) && !(await hasWatchmanConfig)) {
|
|
||||||
console.log(`Creating .watchmanconfig in ${dir}`);
|
|
||||||
await util.promisify(copyFile)(
|
|
||||||
path.join(dir, '_watchmanconfig'),
|
|
||||||
path.join(dir, '.watchmanconfig'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
{
|
{
|
||||||
"ignore_dirs": ["node_modules"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user