Ignore watchmanconfig in fbsource (#868)
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/868 As discussed in D20252170 Reviewed By: passy Differential Revision: D20278783 fbshipit-source-id: c965520a0ad44bf1838224003017177c149025e9
This commit is contained in:
committed by
Facebook Github Bot
parent
04acc9cfd7
commit
52b907fa25
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,6 +4,9 @@ website/build
|
|||||||
yarn-error.log
|
yarn-error.log
|
||||||
static/main.bundle.*
|
static/main.bundle.*
|
||||||
|
|
||||||
|
# conflicts with FB internal infra
|
||||||
|
.watchmanconfig
|
||||||
|
|
||||||
# iOS / Xcode
|
# iOS / Xcode
|
||||||
*.xcworkspace
|
*.xcworkspace
|
||||||
**/Pods/
|
**/Pods/
|
||||||
|
|||||||
@@ -11,8 +11,10 @@ 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',
|
||||||
@@ -26,6 +28,9 @@ 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')),
|
||||||
@@ -63,3 +68,15 @@ 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 +0,0 @@
|
|||||||
{}
|
|
||||||
3
static/_watchmanconfig
Normal file
3
static/_watchmanconfig
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"ignore_dirs": ["node_modules"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user