From a06bd8421329edebe3327afdbb3946fb7471737d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 12 Jul 2017 13:58:14 +0100 Subject: [PATCH] replace imports of `q` with bluebird update `package.json` ``` find src test -name '*.js' | xargs perl -i -pe 'if (/require\(.[qQ].\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }' find src test -name '*.js' | xargs perl -i -pe 'if (/import [qQ]/) { $_ = "import Promise from '\''bluebird'\'';\n"; }' ``` --- package.json | 2 +- src/ContentMessages.js | 2 +- src/Lifecycle.js | 2 +- src/Login.js | 2 +- src/RoomNotifs.js | 2 +- src/Rooms.js | 2 +- src/ScalarAuthClient.js | 2 +- src/UserSettingsStore.js | 2 +- src/autocomplete/Autocompleter.js | 2 +- src/components/structures/MatrixChat.js | 2 +- src/components/structures/RoomView.js | 2 +- src/components/structures/ScrollPanel.js | 2 +- src/components/structures/TimelinePanel.js | 2 +- src/components/structures/UserSettings.js | 2 +- src/components/structures/login/Registration.js | 2 +- src/components/views/dialogs/ChatInviteDialog.js | 2 +- src/components/views/dialogs/SetMxIdDialog.js | 2 +- src/components/views/elements/EditableTextContainer.js | 2 +- src/components/views/messages/MImageBody.js | 2 +- src/components/views/messages/MVideoBody.js | 2 +- src/components/views/room_settings/AliasSettings.js | 2 +- src/components/views/room_settings/ColorSettings.js | 2 +- src/components/views/room_settings/UrlPreviewSettings.js | 2 +- src/components/views/rooms/Autocomplete.js | 2 +- src/components/views/rooms/MemberList.js | 2 +- src/components/views/rooms/MessageComposerInput.js | 2 +- src/components/views/rooms/RoomSettings.js | 2 +- src/components/views/settings/ChangePassword.js | 2 +- src/createRoom.js | 2 +- src/languageHandler.js | 2 +- src/utils/DecryptFile.js | 2 +- src/utils/MultiInviter.js | 2 +- test/components/structures/ScrollPanel-test.js | 2 +- test/components/structures/TimelinePanel-test.js | 2 +- test/components/views/dialogs/InteractiveAuthDialog-test.js | 2 +- test/components/views/rooms/MessageComposerInput-test.js | 2 +- test/stores/RoomViewStore-test.js | 2 +- test/test-utils.js | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 2b637f68c6..831644083a 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ }, "dependencies": { "babel-runtime": "^6.11.6", + "bluebird": "^3.5.0", "blueimp-canvas-to-blob": "^3.5.0", "browser-encrypt-attachment": "^0.3.0", "browser-request": "^0.3.3", @@ -68,7 +69,6 @@ "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", "optimist": "^0.6.1", "prop-types": "^15.5.8", - "q": "^1.4.1", "react": "^15.4.0", "react-addons-css-transition-group": "15.3.2", "react-dom": "^15.4.0", diff --git a/src/ContentMessages.js b/src/ContentMessages.js index 315c312b9f..a9d02b1825 100644 --- a/src/ContentMessages.js +++ b/src/ContentMessages.js @@ -16,7 +16,7 @@ limitations under the License. 'use strict'; -var q = require('q'); +import Promise from 'bluebird'; var extend = require('./extend'); var dis = require('./dispatcher'); var MatrixClientPeg = require('./MatrixClientPeg'); diff --git a/src/Lifecycle.js b/src/Lifecycle.js index 00a82bad21..4d44e9839c 100644 --- a/src/Lifecycle.js +++ b/src/Lifecycle.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import q from 'q'; +import Promise from 'bluebird'; import Matrix from 'matrix-js-sdk'; import MatrixClientPeg from './MatrixClientPeg'; diff --git a/src/Login.js b/src/Login.js index 8225509919..038813cd62 100644 --- a/src/Login.js +++ b/src/Login.js @@ -18,7 +18,7 @@ limitations under the License. import Matrix from "matrix-js-sdk"; import { _t } from "./languageHandler"; -import q from 'q'; +import Promise from 'bluebird'; import url from 'url'; export default class Login { diff --git a/src/RoomNotifs.js b/src/RoomNotifs.js index 88b6e56c7f..eddf516b20 100644 --- a/src/RoomNotifs.js +++ b/src/RoomNotifs.js @@ -16,7 +16,7 @@ limitations under the License. import MatrixClientPeg from './MatrixClientPeg'; import PushProcessor from 'matrix-js-sdk/lib/pushprocessor'; -import q from 'q'; +import Promise from 'bluebird'; export const ALL_MESSAGES_LOUD = 'all_messages_loud'; export const ALL_MESSAGES = 'all_messages'; diff --git a/src/Rooms.js b/src/Rooms.js index 3ac7c68533..44d7bedcce 100644 --- a/src/Rooms.js +++ b/src/Rooms.js @@ -15,7 +15,7 @@ limitations under the License. */ import MatrixClientPeg from './MatrixClientPeg'; -import q from 'q'; +import Promise from 'bluebird'; /** * Given a room object, return the alias we should use for it, diff --git a/src/ScalarAuthClient.js b/src/ScalarAuthClient.js index 6908a7f67d..9702d21add 100644 --- a/src/ScalarAuthClient.js +++ b/src/ScalarAuthClient.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -var q = require("q"); +import Promise from 'bluebird'; var request = require('browser-request'); var SdkConfig = require('./SdkConfig'); diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index fef84468ec..8c04f35d02 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import q from 'q'; +import Promise from 'bluebird'; import MatrixClientPeg from './MatrixClientPeg'; import Notifier from './Notifier'; import { _t } from './languageHandler'; diff --git a/src/autocomplete/Autocompleter.js b/src/autocomplete/Autocompleter.js index 62b5a870f3..236c0aa0f2 100644 --- a/src/autocomplete/Autocompleter.js +++ b/src/autocomplete/Autocompleter.js @@ -22,7 +22,7 @@ import DuckDuckGoProvider from './DuckDuckGoProvider'; import RoomProvider from './RoomProvider'; import UserProvider from './UserProvider'; import EmojiProvider from './EmojiProvider'; -import Q from 'q'; +import Promise from 'bluebird'; export type SelectionRange = { start: number, diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 75a15d71ee..8bc91fdc18 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import q from 'q'; +import Promise from 'bluebird'; import React from 'react'; import Matrix from "matrix-js-sdk"; diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 75ab4a0db2..306cbe922d 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -22,7 +22,7 @@ limitations under the License. var React = require("react"); var ReactDOM = require("react-dom"); -var q = require("q"); +import Promise from 'bluebird'; var classNames = require("classnames"); var Matrix = require("matrix-js-sdk"); import { _t } from '../../languageHandler'; diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index f035efee92..0a593c29ac 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -17,7 +17,7 @@ limitations under the License. var React = require("react"); var ReactDOM = require("react-dom"); var GeminiScrollbar = require('react-gemini-scrollbar'); -var q = require("q"); +import Promise from 'bluebird'; var KeyCode = require('../../KeyCode'); var DEBUG_SCROLL = false; diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index cdee03ab63..4dcb9c5ef8 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -17,7 +17,7 @@ limitations under the License. var React = require('react'); var ReactDOM = require("react-dom"); -var q = require("q"); +import Promise from 'bluebird'; var Matrix = require("matrix-js-sdk"); var EventTimeline = Matrix.EventTimeline; diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index bfbb9831b0..0907c3e261 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -22,7 +22,7 @@ const PlatformPeg = require("../../PlatformPeg"); const Modal = require('../../Modal'); const dis = require("../../dispatcher"); import sessionStore from '../../stores/SessionStore'; -const q = require('q'); +import Promise from 'bluebird'; const packageJson = require('../../../package.json'); const UserSettingsStore = require('../../UserSettingsStore'); const CallMediaHandler = require('../../CallMediaHandler'); diff --git a/src/components/structures/login/Registration.js b/src/components/structures/login/Registration.js index 388198bb02..a2e2d02bb0 100644 --- a/src/components/structures/login/Registration.js +++ b/src/components/structures/login/Registration.js @@ -17,7 +17,7 @@ limitations under the License. import Matrix from 'matrix-js-sdk'; -import q from 'q'; +import Promise from 'bluebird'; import React from 'react'; import sdk from '../../../index'; diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index a85efadef7..f8ebaefec8 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -23,7 +23,7 @@ import MatrixClientPeg from '../../../MatrixClientPeg'; import DMRoomMap from '../../../utils/DMRoomMap'; import Modal from '../../../Modal'; import AccessibleButton from '../elements/AccessibleButton'; -import q from 'q'; +import Promise from 'bluebird'; import dis from '../../../dispatcher'; const TRUNCATE_QUERY_LIST = 40; diff --git a/src/components/views/dialogs/SetMxIdDialog.js b/src/components/views/dialogs/SetMxIdDialog.js index d428223ad6..4d4f672f2b 100644 --- a/src/components/views/dialogs/SetMxIdDialog.js +++ b/src/components/views/dialogs/SetMxIdDialog.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import q from 'q'; +import Promise from 'bluebird'; import React from 'react'; import sdk from '../../../index'; import MatrixClientPeg from '../../../MatrixClientPeg'; diff --git a/src/components/views/elements/EditableTextContainer.js b/src/components/views/elements/EditableTextContainer.js index d6f9c555c6..f986587966 100644 --- a/src/components/views/elements/EditableTextContainer.js +++ b/src/components/views/elements/EditableTextContainer.js @@ -16,7 +16,7 @@ limitations under the License. import React from 'react'; import sdk from '../../../index'; -import q from 'q'; +import Promise from 'bluebird'; /** * A component which wraps an EditableText, with a spinner while updates take diff --git a/src/components/views/messages/MImageBody.js b/src/components/views/messages/MImageBody.js index da6447c7e5..cd80785749 100644 --- a/src/components/views/messages/MImageBody.js +++ b/src/components/views/messages/MImageBody.js @@ -24,7 +24,7 @@ import Modal from '../../../Modal'; import sdk from '../../../index'; import dis from '../../../dispatcher'; import { decryptFile, readBlobAsDataUri } from '../../../utils/DecryptFile'; -import q from 'q'; +import Promise from 'bluebird'; import UserSettingsStore from '../../../UserSettingsStore'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/messages/MVideoBody.js b/src/components/views/messages/MVideoBody.js index f31b94df80..10008a8e46 100644 --- a/src/components/views/messages/MVideoBody.js +++ b/src/components/views/messages/MVideoBody.js @@ -20,7 +20,7 @@ import React from 'react'; import MFileBody from './MFileBody'; import MatrixClientPeg from '../../../MatrixClientPeg'; import { decryptFile, readBlobAsDataUri } from '../../../utils/DecryptFile'; -import q from 'q'; +import Promise from 'bluebird'; import UserSettingsStore from '../../../UserSettingsStore'; import { _t } from '../../../languageHandler'; diff --git a/src/components/views/room_settings/AliasSettings.js b/src/components/views/room_settings/AliasSettings.js index b9c9c7d989..0fb099422c 100644 --- a/src/components/views/room_settings/AliasSettings.js +++ b/src/components/views/room_settings/AliasSettings.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -var q = require("q"); +import Promise from 'bluebird'; var React = require('react'); var ObjectUtils = require("../../../ObjectUtils"); var MatrixClientPeg = require('../../../MatrixClientPeg'); diff --git a/src/components/views/room_settings/ColorSettings.js b/src/components/views/room_settings/ColorSettings.js index 5fc845a541..763c402d6f 100644 --- a/src/components/views/room_settings/ColorSettings.js +++ b/src/components/views/room_settings/ColorSettings.js @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -var q = require("q"); +import Promise from 'bluebird'; var React = require('react'); var sdk = require('../../../index'); diff --git a/src/components/views/room_settings/UrlPreviewSettings.js b/src/components/views/room_settings/UrlPreviewSettings.js index e5236b90cc..5ee18badaa 100644 --- a/src/components/views/room_settings/UrlPreviewSettings.js +++ b/src/components/views/room_settings/UrlPreviewSettings.js @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -var q = require("q"); +import Promise from 'bluebird'; var React = require('react'); var MatrixClientPeg = require('../../../MatrixClientPeg'); var sdk = require("../../../index"); diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index 026be0da62..a3315f61aa 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -5,7 +5,7 @@ import flatMap from 'lodash/flatMap'; import isEqual from 'lodash/isEqual'; import sdk from '../../../index'; import type {Completion} from '../../../autocomplete/Autocompleter'; -import Q from 'q'; +import Promise from 'bluebird'; import UserSettingsStore from '../../../UserSettingsStore'; import {getCompletions} from '../../../autocomplete/Autocompleter'; diff --git a/src/components/views/rooms/MemberList.js b/src/components/views/rooms/MemberList.js index 63737d5fad..37a9bcd0cd 100644 --- a/src/components/views/rooms/MemberList.js +++ b/src/components/views/rooms/MemberList.js @@ -17,7 +17,7 @@ var React = require('react'); import { _t } from '../../../languageHandler'; var classNames = require('classnames'); var Matrix = require("matrix-js-sdk"); -var q = require('q'); +import Promise from 'bluebird'; var MatrixClientPeg = require("../../../MatrixClientPeg"); var Modal = require("../../../Modal"); var Entities = require("../../../Entities"); diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index cf6dfbb6b7..bec74c15dd 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -22,7 +22,7 @@ import {Editor, EditorState, RichUtils, CompositeDecorator, import classNames from 'classnames'; import escape from 'lodash/escape'; -import Q from 'q'; +import Promise from 'bluebird'; import MatrixClientPeg from '../../../MatrixClientPeg'; import type {MatrixClient} from 'matrix-js-sdk/lib/matrix'; diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index d255670a52..caa9f1bdaf 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -import q from 'q'; +import Promise from 'bluebird'; import React from 'react'; import { _t, _tJsx } from '../../../languageHandler'; import MatrixClientPeg from '../../../MatrixClientPeg'; diff --git a/src/components/views/settings/ChangePassword.js b/src/components/views/settings/ChangePassword.js index 099ae2deae..9d91c007b1 100644 --- a/src/components/views/settings/ChangePassword.js +++ b/src/components/views/settings/ChangePassword.js @@ -21,7 +21,7 @@ var MatrixClientPeg = require("../../../MatrixClientPeg"); var Modal = require("../../../Modal"); var sdk = require("../../../index"); -import q from 'q'; +import Promise from 'bluebird'; import AccessibleButton from '../elements/AccessibleButton'; import { _t } from '../../../languageHandler'; diff --git a/src/createRoom.js b/src/createRoom.js index 916405776d..3b95c29b4c 100644 --- a/src/createRoom.js +++ b/src/createRoom.js @@ -21,7 +21,7 @@ import { _t } from './languageHandler'; import dis from "./dispatcher"; import * as Rooms from "./Rooms"; -import q from 'q'; +import Promise from 'bluebird'; /** * Create a new room, and switch to it. diff --git a/src/languageHandler.js b/src/languageHandler.js index 1f0e6326e0..7af4f7b200 100644 --- a/src/languageHandler.js +++ b/src/languageHandler.js @@ -17,7 +17,7 @@ limitations under the License. import request from 'browser-request'; import counterpart from 'counterpart'; -import q from 'q'; +import Promise from 'bluebird'; import React from 'react'; import UserSettingsStore from './UserSettingsStore'; diff --git a/src/utils/DecryptFile.js b/src/utils/DecryptFile.js index 8b5f014f2c..b9ef33ea6c 100644 --- a/src/utils/DecryptFile.js +++ b/src/utils/DecryptFile.js @@ -20,7 +20,7 @@ import encrypt from 'browser-encrypt-attachment'; import 'isomorphic-fetch'; // Grab the client so that we can turn mxc:// URLs into https:// URLS. import MatrixClientPeg from '../MatrixClientPeg'; -import q from 'q'; +import Promise from 'bluebird'; /** diff --git a/src/utils/MultiInviter.js b/src/utils/MultiInviter.js index 68a0800ed7..ecb5bd67f2 100644 --- a/src/utils/MultiInviter.js +++ b/src/utils/MultiInviter.js @@ -15,7 +15,7 @@ limitations under the License. */ import {getAddressType, inviteToRoom} from '../Invite'; -import q from 'q'; +import Promise from 'bluebird'; /** * Invites multiple addresses to a room, handling rate limiting from the server diff --git a/test/components/structures/ScrollPanel-test.js b/test/components/structures/ScrollPanel-test.js index a783f424e7..0f8b2416cd 100644 --- a/test/components/structures/ScrollPanel-test.js +++ b/test/components/structures/ScrollPanel-test.js @@ -18,7 +18,7 @@ var React = require('react'); var ReactDOM = require("react-dom"); var ReactTestUtils = require('react-addons-test-utils'); var expect = require('expect'); -var q = require('q'); +import Promise from 'bluebird'; var sdk = require('matrix-react-sdk'); diff --git a/test/components/structures/TimelinePanel-test.js b/test/components/structures/TimelinePanel-test.js index 748e37bee3..7822e14e2c 100644 --- a/test/components/structures/TimelinePanel-test.js +++ b/test/components/structures/TimelinePanel-test.js @@ -18,7 +18,7 @@ var React = require('react'); var ReactDOM = require('react-dom'); var ReactTestUtils = require('react-addons-test-utils'); var expect = require('expect'); -var q = require('q'); +import Promise from 'bluebird'; var sinon = require('sinon'); var jssdk = require('matrix-js-sdk'); diff --git a/test/components/views/dialogs/InteractiveAuthDialog-test.js b/test/components/views/dialogs/InteractiveAuthDialog-test.js index ecfaba4e2c..2816b987aa 100644 --- a/test/components/views/dialogs/InteractiveAuthDialog-test.js +++ b/test/components/views/dialogs/InteractiveAuthDialog-test.js @@ -15,7 +15,7 @@ limitations under the License. */ import expect from 'expect'; -import q from 'q'; +import Promise from 'bluebird'; import React from 'react'; import ReactDOM from 'react-dom'; import ReactTestUtils from 'react-addons-test-utils'; diff --git a/test/components/views/rooms/MessageComposerInput-test.js b/test/components/views/rooms/MessageComposerInput-test.js index 6d4b4e69cc..2edc1c9432 100644 --- a/test/components/views/rooms/MessageComposerInput-test.js +++ b/test/components/views/rooms/MessageComposerInput-test.js @@ -3,7 +3,7 @@ import ReactTestUtils from 'react-addons-test-utils'; import ReactDOM from 'react-dom'; import expect, {createSpy} from 'expect'; import sinon from 'sinon'; -import Q from 'q'; +import Promise from 'bluebird'; import * as testUtils from '../../../test-utils'; import sdk from 'matrix-react-sdk'; import UserSettingsStore from '../../../../src/UserSettingsStore'; diff --git a/test/stores/RoomViewStore-test.js b/test/stores/RoomViewStore-test.js index adcae90e9b..a0f804da18 100644 --- a/test/stores/RoomViewStore-test.js +++ b/test/stores/RoomViewStore-test.js @@ -7,7 +7,7 @@ import RoomViewStore from '../../src/stores/RoomViewStore'; import peg from '../../src/MatrixClientPeg'; import * as testUtils from '../test-utils'; -import q from 'q'; +import Promise from 'bluebird'; const dispatch = testUtils.getDispatchForStore(RoomViewStore); diff --git a/test/test-utils.js b/test/test-utils.js index bc6b484bb5..8f6b5c15e7 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -1,7 +1,7 @@ "use strict"; import sinon from 'sinon'; -import q from 'q'; +import Promise from 'bluebird'; import peg from '../src/MatrixClientPeg'; import dis from '../src/dispatcher';