Add watchman installation check
Summary: Doctor to show warning if Watchman is not available Reviewed By: mweststrate Differential Revision: D19298730 fbshipit-source-id: 68f915c63c5f78aad91f549aabda8d4d972f4e39
This commit is contained in:
committed by
Facebook Github Bot
parent
857b9816a0
commit
5c8ab0790b
@@ -1,12 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "flipper-doctor",
|
"name": "flipper-doctor",
|
||||||
"version": "0.4.1",
|
"version": "0.5.0",
|
||||||
"description": "Utility for checking for issues with a flipper installation",
|
"description": "Utility for checking for issues with a flipper installation",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.0.21",
|
"@types/jest": "^24.0.21",
|
||||||
|
"@types/fb-watchman": "2.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.8.0",
|
"@typescript-eslint/eslint-plugin": "^2.8.0",
|
||||||
"eslint": "^6.6.0",
|
"eslint": "^6.6.0",
|
||||||
"eslint-plugin-babel": "^5.3.0",
|
"eslint-plugin-babel": "^5.3.0",
|
||||||
@@ -41,6 +42,7 @@
|
|||||||
"author": "Facebook, Inc",
|
"author": "Facebook, Inc",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^12.12.12",
|
"@types/node": "^12.12.12",
|
||||||
"envinfo": "^7.4.0"
|
"envinfo": "^7.4.0",
|
||||||
|
"fb-watchman": "^2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {exec} from 'child_process';
|
|||||||
import {promisify} from 'util';
|
import {promisify} from 'util';
|
||||||
import {EnvironmentInfo, getEnvInfo} from './environmentInfo';
|
import {EnvironmentInfo, getEnvInfo} from './environmentInfo';
|
||||||
export {getEnvInfo} from './environmentInfo';
|
export {getEnvInfo} from './environmentInfo';
|
||||||
|
import * as watchman from 'fb-watchman';
|
||||||
|
|
||||||
export type HealthcheckCategory = {
|
export type HealthcheckCategory = {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -70,6 +71,15 @@ export function getHealthchecks(): Healthchecks {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Watchman Installed',
|
||||||
|
run: async (_: EnvironmentInfo) => {
|
||||||
|
const isAvailable = await isWatchmanAvailable();
|
||||||
|
return {
|
||||||
|
hasProblem: !isAvailable,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
android: {
|
android: {
|
||||||
@@ -179,3 +189,25 @@ async function commandSucceeds(command: string): Promise<boolean> {
|
|||||||
.then(() => true)
|
.then(() => true)
|
||||||
.catch(() => false);
|
.catch(() => false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isWatchmanAvailable(): Promise<boolean> {
|
||||||
|
const client = new watchman.Client();
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const complete = (result: boolean) => {
|
||||||
|
resolve(result);
|
||||||
|
client.removeAllListeners('error');
|
||||||
|
client.end();
|
||||||
|
};
|
||||||
|
client.once('error', () => complete(false));
|
||||||
|
client.capabilityCheck(
|
||||||
|
{optional: [], required: ['relative_root']},
|
||||||
|
error => {
|
||||||
|
if (error) {
|
||||||
|
complete(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
complete(true);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -326,6 +326,18 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@babel/types" "^7.3.0"
|
"@babel/types" "^7.3.0"
|
||||||
|
|
||||||
|
"@types/events@*":
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
|
||||||
|
integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==
|
||||||
|
|
||||||
|
"@types/fb-watchman@2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/fb-watchman/-/fb-watchman-2.0.0.tgz#ca60ded406baa8c81c65ac1f86763a5d00aa7c55"
|
||||||
|
integrity sha512-Ao2jlksPEUGCEXBvJz5e2MuDpYUtxXgtUk45cg0g5Mmy4f0j7bQuDlOlqBMgKGRl9dZAK4ZTzFtukuzj2mURlQ==
|
||||||
|
dependencies:
|
||||||
|
"@types/events" "*"
|
||||||
|
|
||||||
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
|
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
|
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
|
||||||
@@ -739,7 +751,7 @@ bs-logger@0.x:
|
|||||||
dependencies:
|
dependencies:
|
||||||
fast-json-stable-stringify "2.x"
|
fast-json-stable-stringify "2.x"
|
||||||
|
|
||||||
bser@^2.0.0:
|
bser@2.1.1, bser@^2.0.0:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05"
|
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05"
|
||||||
integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==
|
integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==
|
||||||
@@ -1481,6 +1493,13 @@ fb-watchman@^2.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
bser "^2.0.0"
|
bser "^2.0.0"
|
||||||
|
|
||||||
|
fb-watchman@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85"
|
||||||
|
integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==
|
||||||
|
dependencies:
|
||||||
|
bser "2.1.1"
|
||||||
|
|
||||||
figures@^3.0.0:
|
figures@^3.0.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec"
|
resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec"
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
"expand-tilde": "^2.0.2",
|
"expand-tilde": "^2.0.2",
|
||||||
"express": "^4.15.2",
|
"express": "^4.15.2",
|
||||||
"fb-watchman": "^2.0.0",
|
"fb-watchman": "^2.0.0",
|
||||||
"flipper-doctor": "^0.4.1",
|
"flipper-doctor": "^0.6.0",
|
||||||
"fs-extra": "^8.0.1",
|
"fs-extra": "^8.0.1",
|
||||||
"immer": "^5.0.1",
|
"immer": "^5.0.1",
|
||||||
"immutable": "^4.0.0-rc.12",
|
"immutable": "^4.0.0-rc.12",
|
||||||
@@ -193,7 +193,8 @@
|
|||||||
},
|
},
|
||||||
"greenkeeper": {
|
"greenkeeper": {
|
||||||
"ignore": [
|
"ignore": [
|
||||||
"tmp"
|
"tmp",
|
||||||
|
"flipper-doctor"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const HEALTHCHECKS: Healthchecks = {
|
|||||||
isRequired: true,
|
isRequired: true,
|
||||||
healthchecks: [
|
healthchecks: [
|
||||||
{
|
{
|
||||||
|
key: 'ios.sdk',
|
||||||
label: 'SDK Installed',
|
label: 'SDK Installed',
|
||||||
run: async (_env: EnvironmentInfo) => {
|
run: async (_env: EnvironmentInfo) => {
|
||||||
return {hasProblem: false};
|
return {hasProblem: false};
|
||||||
@@ -37,6 +38,7 @@ const HEALTHCHECKS: Healthchecks = {
|
|||||||
isRequired: true,
|
isRequired: true,
|
||||||
healthchecks: [
|
healthchecks: [
|
||||||
{
|
{
|
||||||
|
key: 'android.sdk',
|
||||||
label: 'SDK Installed',
|
label: 'SDK Installed',
|
||||||
run: async (_env: EnvironmentInfo) => {
|
run: async (_env: EnvironmentInfo) => {
|
||||||
return {hasProblem: true};
|
return {hasProblem: true};
|
||||||
@@ -50,6 +52,7 @@ const HEALTHCHECKS: Healthchecks = {
|
|||||||
isRequired: false,
|
isRequired: false,
|
||||||
healthchecks: [
|
healthchecks: [
|
||||||
{
|
{
|
||||||
|
key: 'common.openssl',
|
||||||
label: 'OpenSSL Istalled',
|
label: 'OpenSSL Istalled',
|
||||||
run: async (_env: EnvironmentInfo) => {
|
run: async (_env: EnvironmentInfo) => {
|
||||||
return {hasProblem: false};
|
return {hasProblem: false};
|
||||||
|
|||||||
23
yarn.lock
23
yarn.lock
@@ -2334,6 +2334,13 @@ bs-logger@0.x:
|
|||||||
dependencies:
|
dependencies:
|
||||||
fast-json-stable-stringify "2.x"
|
fast-json-stable-stringify "2.x"
|
||||||
|
|
||||||
|
bser@2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05"
|
||||||
|
integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==
|
||||||
|
dependencies:
|
||||||
|
node-int64 "^0.4.0"
|
||||||
|
|
||||||
bser@^2.0.0:
|
bser@^2.0.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5"
|
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.0.tgz#65fc784bf7f87c009b973c12db6546902fa9c7b5"
|
||||||
@@ -4054,6 +4061,13 @@ fb-watchman@^2.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
bser "^2.0.0"
|
bser "^2.0.0"
|
||||||
|
|
||||||
|
fb-watchman@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85"
|
||||||
|
integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg==
|
||||||
|
dependencies:
|
||||||
|
bser "2.1.1"
|
||||||
|
|
||||||
fbjs-css-vars@^1.0.0:
|
fbjs-css-vars@^1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8"
|
resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8"
|
||||||
@@ -4182,13 +4196,14 @@ flatted@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
|
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
|
||||||
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
|
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
|
||||||
|
|
||||||
flipper-doctor@^0.4.1:
|
flipper-doctor@^0.6.0:
|
||||||
version "0.4.1"
|
version "0.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/flipper-doctor/-/flipper-doctor-0.4.1.tgz#bc4ce11a920e983da04e492ba04d5fe108659bb5"
|
resolved "https://registry.yarnpkg.com/flipper-doctor/-/flipper-doctor-0.6.0.tgz#850eaf5e2f7abfb6cb3db0a383f7aa09c35d8176"
|
||||||
integrity sha512-1N7wgM03i1aHgTgMiv4V1mWkfkfoAgbBQmt4ai7AW2rhb2ocmy6p+8I51L2rJEOVmsRP/oDafpdgVNm1ggHp4w==
|
integrity sha512-aUdsw2b+9oVs/5V3X1TGEETu5TdheriY18pt8PWbhhliln7mUv0dnpvdA02tLlLfHKQ0B07OUrHO/kFaFAfI9Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "^12.12.12"
|
"@types/node" "^12.12.12"
|
||||||
envinfo "^7.4.0"
|
envinfo "^7.4.0"
|
||||||
|
fb-watchman "^2.0.1"
|
||||||
|
|
||||||
flow-bin@0.115.0:
|
flow-bin@0.115.0:
|
||||||
version "0.115.0"
|
version "0.115.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user