From 58225fe113c8bd0e45f18a2eda44db81fab08e51 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Fri, 28 Feb 2020 04:06:25 -0800 Subject: [PATCH] Yarn start is hanging Summary: Fixed hanging on "yarn start" Reviewed By: passy, cekkaewnumchai Differential Revision: D20158451 fbshipit-source-id: 0aa834e33ce622cc264005d0648546608f208d07 --- package.json | 4 +-- src/devices/IOSDevice.tsx | 2 +- src/reducers/application.tsx | 2 +- static/package.json | 4 +-- static/watchman.ts | 54 +++++++++++++++++++----------------- static/yarn.lock | 8 +++--- yarn.lock | 18 ++++++------ 7 files changed, 47 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index 521833ac7..4e3a83c14 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "@types/socket.io": "^2.1.4", "@types/testing-library__react": "^9.1.2", "@types/tmp": "^0.1.0", - "@types/uuid": "^3.4.5", + "@types/uuid": "^7.0.0", "@types/ws": "^7.2.0", "@types/yazl": "^2.4.2", "@typescript-eslint/eslint-plugin": "^2.19.2", @@ -215,7 +215,7 @@ "socket.io": "^2.0.4", "string-natural-compare": "^3.0.0", "tmp": "0.0.33", - "uuid": "^7.0.0", + "uuid": "^7.0.1", "websocket": "^1.0.31", "which": "^2.0.1", "ws": "^7.2.0", diff --git a/src/devices/IOSDevice.tsx b/src/devices/IOSDevice.tsx index d5dc86790..283913bb9 100644 --- a/src/devices/IOSDevice.tsx +++ b/src/devices/IOSDevice.tsx @@ -14,7 +14,7 @@ import JSONStream from 'JSONStream'; import {Transform} from 'stream'; import electron from 'electron'; import fs from 'fs'; -import uuid from 'uuid/v1'; +import {v1 as uuid} from 'uuid'; import path from 'path'; import {promisify} from 'util'; import {exec} from 'child_process'; diff --git a/src/reducers/application.tsx b/src/reducers/application.tsx index bc0c44316..a71e33da4 100644 --- a/src/reducers/application.tsx +++ b/src/reducers/application.tsx @@ -8,7 +8,7 @@ */ import {remote} from 'electron'; -import uuidv1 from 'uuid/v1'; +import {v1 as uuidv1} from 'uuid'; import {ReactElement} from 'react'; import CancellableExportStatus from '../chrome/CancellableExportStatus'; import {Actions} from './'; diff --git a/static/package.json b/static/package.json index 90fe72af3..40efe234a 100644 --- a/static/package.json +++ b/static/package.json @@ -2,7 +2,7 @@ "name": "flipper-static", "version": "1.0.0", "main": "index.js", - "license": "MIT", + "license": "MIT", "dependencies": { "@babel/core": "^7.8.3", "@babel/generator": "^7.8.3", @@ -24,7 +24,7 @@ "mkdirp": "^1.0.0", "p-map": "^3.0.0", "recursive-readdir": "2.2.2", - "uuid": "^7.0.0", + "uuid": "^7.0.1", "xdg-basedir": "^4.0.0", "yargs": "^15.0.1" }, diff --git a/static/watchman.ts b/static/watchman.ts index cce6b7b43..d301030ca 100644 --- a/static/watchman.ts +++ b/static/watchman.ts @@ -8,7 +8,7 @@ */ import {Client} from 'fb-watchman'; -import uuid from 'uuid'; +import {v4 as uuid} from 'uuid'; import path from 'path'; export default class Watchman { @@ -76,35 +76,39 @@ export default class Watchman { return reject(error); } - const {clock} = resp; + try { + const {clock} = resp; - const sub = { - expression: [ - 'allof', - ['not', ['type', 'd']], - ...options!.excludes.map(e => ['not', ['match', e, 'wholename']]), - ], - fields: ['name'], - since: clock, - relative_root: this.relativeRoot - ? path.join(this.relativeRoot, relativeDir) - : relativeDir, - }; + const sub = { + expression: [ + 'allof', + ['not', ['type', 'd']], + ...options!.excludes.map(e => ['not', ['match', e, 'wholename']]), + ], + fields: ['name'], + since: clock, + relative_root: this.relativeRoot + ? path.join(this.relativeRoot, relativeDir) + : relativeDir, + }; - const id = uuid.v4(); + const id = uuid(); - this.client!.command(['subscribe', this.watch, id, sub], error => { - if (error) { - return reject(error); - } - this.client!.on('subscription', resp => { - if (resp.subscription !== id || !resp.files) { - return; + this.client!.command(['subscribe', this.watch, id, sub], error => { + if (error) { + return reject(error); } - handler(resp); + this.client!.on('subscription', resp => { + if (resp.subscription !== id || !resp.files) { + return; + } + handler(resp); + }); + resolve(); }); - resolve(); - }); + } catch (err) { + reject(err); + } }); }); } diff --git a/static/yarn.lock b/static/yarn.lock index e90c84396..3575e2ec7 100644 --- a/static/yarn.lock +++ b/static/yarn.lock @@ -3557,10 +3557,10 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= -uuid@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.0.tgz#1833d4b9ce50b732bfaa271f9cb74e974d303c79" - integrity sha512-LNUrNsXdI/fUsypJbWM8Jt4DgQdFAZh41p9C7WE9Cn+CULOEkoG2lgQyH68v3wnIy5K3fN4jdSt270K6IFA3MQ== +uuid@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.1.tgz#95ed6ff3d8c881cbf85f0f05cc3915ef994818ef" + integrity sha512-yqjRXZzSJm9Dbl84H2VDHpM3zMjzSJQ+hn6C4zqd5ilW+7P4ZmLEEqwho9LjP+tGuZlF4xrHQXT0h9QZUS/pWA== vlq@^1.0.0: version "1.0.1" diff --git a/yarn.lock b/yarn.lock index f6159bf59..793028594 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1735,12 +1735,10 @@ resolved "https://registry.yarnpkg.com/@types/url-join/-/url-join-4.0.0.tgz#72eff71648a429c7d4acf94e03780e06671369bd" integrity sha512-awrJu8yML4E/xTwr2EMatC+HBnHGoDxc2+ImA9QyeUELI1S7dOCIZcyjki1rkwoA8P2D2NVgLAJLjnclkdLtAw== -"@types/uuid@^3.4.5": - version "3.4.5" - resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-3.4.5.tgz#d4dc10785b497a1474eae0ba7f0cb09c0ddfd6eb" - integrity sha512-MNL15wC3EKyw1VLF+RoVO4hJJdk9t/Hlv3rt1OL65Qvuadm4BYo6g9ZJQqoq7X8NBFSsQXgAujWciovh2lpVjA== - dependencies: - "@types/node" "*" +"@types/uuid@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-7.0.0.tgz#9f6993ccc8210efa90bda7e1afabbb06a9f860cd" + integrity sha512-RiX1I0lK9WFLFqy2xOxke396f0wKIzk5sAll0tL4J4XDYJXURI7JOs96XQb3nP+2gEpQ/LutBb66jgiT5oQshQ== "@types/which@^1.3.2": version "1.3.2" @@ -9839,10 +9837,10 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== -uuid@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.0.tgz#1833d4b9ce50b732bfaa271f9cb74e974d303c79" - integrity sha512-LNUrNsXdI/fUsypJbWM8Jt4DgQdFAZh41p9C7WE9Cn+CULOEkoG2lgQyH68v3wnIy5K3fN4jdSt270K6IFA3MQ== +uuid@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.1.tgz#95ed6ff3d8c881cbf85f0f05cc3915ef994818ef" + integrity sha512-yqjRXZzSJm9Dbl84H2VDHpM3zMjzSJQ+hn6C4zqd5ilW+7P4ZmLEEqwho9LjP+tGuZlF4xrHQXT0h9QZUS/pWA== v8-compile-cache@^2.0.3: version "2.1.0"