From 76403dd1d51cdf6c0fbe185df5cb1989c0b34719 Mon Sep 17 00:00:00 2001 From: Ganesh Rathinavel Medayil <182092+ganeshrvel@users.noreply.github.com> Date: Wed, 12 Jun 2024 14:58:47 +0530 Subject: [PATCH 1/2] Revert "Temporarily removing usb hotplug detection feature Notarize issue." --- .../components/HelpPhoneNotRecognized.jsx | 29 ++-- .../FileExplorerTableBodyEmptyRender.jsx | 5 +- .../Onboarding/components/Features.jsx | 13 +- .../Settings/components/SettingsDialog.jsx | 38 ++--- app/main.dev.js | 57 ++++---- package.json | 3 +- yarn.lock | 138 +++++++++++++++++- 7 files changed, 210 insertions(+), 73 deletions(-) diff --git a/app/containers/HelpFaqsPage/components/HelpPhoneNotRecognized.jsx b/app/containers/HelpFaqsPage/components/HelpPhoneNotRecognized.jsx index 5a3ff5e7..79409fd2 100644 --- a/app/containers/HelpFaqsPage/components/HelpPhoneNotRecognized.jsx +++ b/app/containers/HelpFaqsPage/components/HelpPhoneNotRecognized.jsx @@ -8,6 +8,7 @@ import ListItemText from '@material-ui/core/ListItemText'; import DeleteIcon from '@material-ui/icons/Delete'; import CloseIcon from '@material-ui/icons/Close'; import FiberManualRecordIcon from '@material-ui/icons/FiberManualRecord'; +import ToggleOffIcon from '@material-ui/icons/ToggleOff'; import CheckIcon from '@material-ui/icons/Check'; import ListAltIcon from '@material-ui/icons/ListAlt'; import SettingsIcon from '@material-ui/icons/Settings'; @@ -52,7 +53,7 @@ import { imgsrc } from '../../../utils/imgsrc'; import { helpPhoneNotConnecting } from '../../../templates/fileExplorer'; import { isKalamModeSupported } from '../../../helpers/binaries'; -// const hotplugSettingText = `Check if 'Enable auto device detection (USB Hotplug)' is enabled under Settings > General Tab`; +const hotplugSettingText = `Check if 'Enable auto device detection (USB Hotplug)' is enabled under Settings > General Tab`; const deviceLabel = DEVICES_LABEL[DEVICE_TYPE.mtp]; class HelpPhoneNotRecognized extends PureComponent { @@ -168,7 +169,7 @@ class HelpPhoneNotRecognized extends PureComponent { @@ -177,7 +178,7 @@ class HelpPhoneNotRecognized extends PureComponent { @@ -236,7 +237,7 @@ class HelpPhoneNotRecognized extends PureComponent { @@ -245,7 +246,7 @@ class HelpPhoneNotRecognized extends PureComponent { @@ -402,15 +403,15 @@ class HelpPhoneNotRecognized extends PureComponent { /> - {/* */} - {/* */} - {/* */} - {/* */} - {/* General Tab`} */} - {/* /> */} - {/* */} + + + + + General Tab`} + /> + diff --git a/app/containers/HomePage/components/FileExplorerTableBodyEmptyRender.jsx b/app/containers/HomePage/components/FileExplorerTableBodyEmptyRender.jsx index 15753119..779b1e49 100644 --- a/app/containers/HomePage/components/FileExplorerTableBodyEmptyRender.jsx +++ b/app/containers/HomePage/components/FileExplorerTableBodyEmptyRender.jsx @@ -6,6 +6,7 @@ import TableRow from '@material-ui/core/TableRow'; import Collapse from '@material-ui/core/Collapse'; import List from '@material-ui/core/List'; import ListItem from '@material-ui/core/ListItem'; +import ToggleOffIcon from '@material-ui/icons/ToggleOff'; import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemText from '@material-ui/core/ListItemText'; import Divider from '@material-ui/core/Divider'; @@ -162,7 +163,7 @@ class FileExplorerTableBodyEmptyRender extends PureComponent { /> - {/* + @@ -170,7 +171,7 @@ class FileExplorerTableBodyEmptyRender extends PureComponent { primary={`If you face frequent device disconnections, turn off 'USB Hotplug'`} secondary={`Settings > General Tab`} /> - */} + diff --git a/app/containers/Onboarding/components/Features.jsx b/app/containers/Onboarding/components/Features.jsx index 32a12d5f..97cd392c 100644 --- a/app/containers/Onboarding/components/Features.jsx +++ b/app/containers/Onboarding/components/Features.jsx @@ -8,6 +8,7 @@ import ListItemText from '@material-ui/core/ListItemText'; import UsbIcon from '@material-ui/icons/Usb'; import FileCopyIcon from '@material-ui/icons/FileCopy'; import Brightness4Icon from '@material-ui/icons/Brightness4'; +import FlashOnIcon from '@material-ui/icons/FlashOn'; import ViewListIcon from '@material-ui/icons/ViewList'; import SdStorageIcon from '@material-ui/icons/SdStorage'; import FlipToBackIcon from '@material-ui/icons/FlipToBack'; @@ -166,12 +167,12 @@ class Features extends PureComponent { - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} + + + + + + diff --git a/app/containers/Settings/components/SettingsDialog.jsx b/app/containers/Settings/components/SettingsDialog.jsx index 91b99361..882dab23 100644 --- a/app/containers/Settings/components/SettingsDialog.jsx +++ b/app/containers/Settings/components/SettingsDialog.jsx @@ -96,6 +96,8 @@ export default class SettingsDialog extends PureComponent { onShowDirectoriesFirstChange, onMtpModeChange, onFilesPreprocessingBeforeTransferChange, + onEnableUsbHotplug, + enableUsbHotplug, } = this.props; const { tabIndex } = this.state; @@ -213,24 +215,24 @@ export default class SettingsDialog extends PureComponent { )} - {/* */} - {/* Enable auto device detection (USB Hotplug) */} - {/* */} - {/* */} - {/* onEnableUsbHotplug(e, !enableUsbHotplug) */} - {/* } */} - {/* /> */} - {/* } */} - {/* label={enableUsbHotplug ? `Enabled` : `Disabled`} */} - {/* /> */} + + Enable auto device detection (USB Hotplug) + + + onEnableUsbHotplug(e, !enableUsbHotplug) + } + /> + } + label={enableUsbHotplug ? `Enabled` : `Disabled`} + /> diff --git a/app/main.dev.js b/app/main.dev.js index 0872d17a..bd17729d 100644 --- a/app/main.dev.js +++ b/app/main.dev.js @@ -4,6 +4,7 @@ import './services/sentry/index'; import { app, BrowserWindow, ipcMain, nativeTheme } from 'electron'; import electronIs from 'electron-is'; +import usbDetect from 'usb-detection'; import process from 'process'; import MenuBuilder from './menu'; import { log } from './utils/log'; @@ -18,10 +19,16 @@ import { nonBootableDeviceWindow } from './helpers/createWindows'; import { APP_TITLE } from './constants/meta'; import { isPackaged } from './utils/isPackaged'; import { getWindowBackgroundColor } from './helpers/windowHelper'; -import { APP_THEME_MODE_TYPE, DEVICE_TYPE, MTP_MODE } from './enums'; +import { + APP_THEME_MODE_TYPE, + DEVICE_TYPE, + MTP_MODE, + USB_HOTPLUG_EVENTS, +} from './enums'; import fileExplorerController from './data/file-explorer/controllers/FileExplorerController'; import { getEnablePrereleaseUpdatesSetting } from './helpers/settings'; import { getRemoteWindow } from './helpers/remoteWindowHelpers'; +import { IpcEvents } from './services/ipc-events/IpcEventType'; import IpcEventService from './services/ipc-events/IpcEventHandler'; import { isKalamModeSupported } from './helpers/binaries'; import { fileExistsSync } from './helpers/fileOps'; @@ -289,29 +296,29 @@ if (!isDeviceBootable) { } // send attach and detach events to the renderer - // usbDetect.startMonitoring(); - - // usbDetect.on('add', (device) => { - // if (!mainWindow) { - // return; - // } - // - // mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, { - // device: JSON.stringify(device), - // eventName: USB_HOTPLUG_EVENTS.attach, - // }); - // }); - - // usbDetect.on('remove', (device) => { - // if (!mainWindow) { - // return; - // } - // - // mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, { - // device: JSON.stringify(device), - // eventName: USB_HOTPLUG_EVENTS.detach, - // }); - // }); + usbDetect.startMonitoring(); + + usbDetect.on('add', (device) => { + if (!mainWindow) { + return; + } + + mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, { + device: JSON.stringify(device), + eventName: USB_HOTPLUG_EVENTS.attach, + }); + }); + + usbDetect.on('remove', (device) => { + if (!mainWindow) { + return; + } + + mainWindow?.webContents?.send(IpcEvents.USB_HOTPLUG, { + device: JSON.stringify(device), + eventName: USB_HOTPLUG_EVENTS.detach, + }); + }); process.stdout.on('error', (err) => { if (err.code === 'EPIPE') { @@ -347,7 +354,7 @@ if (!isDeviceBootable) { log.error(e, `main.dev -> before-quit`); }); - // usbDetect.stopMonitoring(); + usbDetect.stopMonitoring(); app.quitting = true; }); diff --git a/package.json b/package.json index ae19f1a1..5933190c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "openmtp", "productName": "OpenMTP", - "version": "3.2.22", + "version": "3.2.21", "description": "OpenMTP | Android File Transfer for macOS", "scripts": { "build": "yarn lint && concurrently \"yarn build-main\" \"yarn build-renderer\"", @@ -124,6 +124,7 @@ "source-map-support": "^0.5.21", "styled-components": "^4.4.1", "url": "^0.11.0", + "usb-detection": "^4.14.1", "util": "^0.12.4", "zlib": "^1.0.5" }, diff --git a/yarn.lock b/yarn.lock index fc712604..ba1f5435 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2884,6 +2884,15 @@ bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" +bl@^4.0.3: + version "4.1.0" + resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" + integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== + dependencies: + buffer "^5.5.0" + inherits "^2.0.4" + readable-stream "^3.4.0" + bluebird-lst@^1.0.9: version "1.0.9" resolved "https://registry.yarnpkg.com/bluebird-lst/-/bluebird-lst-1.0.9.tgz#a64a0e4365658b9ab5fe875eb9dfb694189bb41c" @@ -3095,7 +3104,7 @@ buffer-indexof@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-indexof/-/buffer-indexof-1.1.1.tgz#52fabcc6a606d1a00302802648ef68f639da268c" integrity sha512-4/rOEg86jivtPTeOUUT61jJO1Ya1TrR/OkqCSZDyq84WJh3LuuiphBYJN+fm5xufIk4XAFcEwte/8WzC8If/1g== -buffer@^5.1.0: +buffer@^5.1.0, buffer@^5.5.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -3392,6 +3401,11 @@ chokidar@^2.1.8: optionalDependencies: fsevents "^1.2.7" +chownr@^1.1.1: + version "1.1.4" + resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" + integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== + chownr@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" @@ -4193,6 +4207,13 @@ decompress-response@^3.3.0: dependencies: mimic-response "^1.0.0" +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + deep-diff@^0.3.5: version "0.3.8" resolved "https://registry.yarnpkg.com/deep-diff/-/deep-diff-0.3.8.tgz#c01de63efb0eec9798801d40c7e0dae25b582c84" @@ -4313,6 +4334,11 @@ destroy@1.2.0: resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== +detect-libc@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.1.tgz#e1897aa88fa6ad197862937fbc0441ef352ee0cd" + integrity sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w== + detect-node@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c" @@ -4816,7 +4842,7 @@ encodeurl@^1.0.2, encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= -end-of-stream@^1.0.0, end-of-stream@^1.1.0: +end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== @@ -5362,6 +5388,11 @@ event-stream@=3.3.4: stream-combiner "~0.0.4" through "~2.3.1" +eventemitter2@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-5.0.1.tgz#6197a095d5fb6b57e8942f6fd7eaad63a09c9452" + integrity sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg== + eventemitter3@^4.0.0: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" @@ -5457,6 +5488,11 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" +expand-template@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c" + integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg== + express@^4.16.3, express@^4.17.1: version "4.18.2" resolved "https://registry.yarnpkg.com/express/-/express-4.18.2.tgz#3fabe08296e930c796c19e3c516979386ba9fd59" @@ -5900,6 +5936,11 @@ from@~0: resolved "https://registry.yarnpkg.com/from/-/from-0.1.7.tgz#83c60afc58b9c56997007ed1a768b3ab303a44fe" integrity sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4= +fs-constants@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" + integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== + fs-extra@^10.0.0: version "10.0.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.0.0.tgz#9ff61b655dde53fb34a82df84bb214ce802e17c1" @@ -6106,6 +6147,11 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +github-from-package@0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" + integrity sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw== + glob-base@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" @@ -8552,6 +8598,11 @@ mimic-response@^1.0.0, mimic-response@^1.0.1: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" @@ -8615,7 +8666,7 @@ minimist-options@^3.0.1: arrify "^1.0.1" is-plain-obj "^1.1.0" -minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: +minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6: version "1.2.7" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18" integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g== @@ -8648,6 +8699,11 @@ mixpanel-browser@^2.43.0: resolved "https://registry.yarnpkg.com/mixpanel-browser/-/mixpanel-browser-2.43.0.tgz#a4d4f97f5a7ca85411697ef70fa833177e67eb95" integrity sha512-6zOjFXaRRWYo7YdcBwa9Z6nk9zRkkxPd9Qa/KNRcjSJ0OkMv7ka/p8rR+6VqMeY93pia/7X31c/HU5YhqAXnEQ== +mkdirp-classic@^0.5.2, mkdirp-classic@^0.5.3: + version "0.5.3" + resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" + integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== + mkdirp@^0.5.1, mkdirp@^0.5.5: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" @@ -8695,7 +8751,7 @@ multicast-dns@^6.0.1: dns-packet "^1.3.1" thunky "^1.0.2" -nan@^2.12.1: +nan@^2.12.1, nan@^2.15.0: version "2.17.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== @@ -8732,6 +8788,11 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +napi-build-utils@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/napi-build-utils/-/napi-build-utils-1.0.2.tgz#b1fddc0b2c46e380a0b7a76f984dd47c41a13806" + integrity sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -8765,7 +8826,7 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" -node-abi@^3.24.0: +node-abi@^3.24.0, node-abi@^3.3.0: version "3.24.0" resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.24.0.tgz#b9d03393a49f2c7e147d0c99f180e680c27c1599" integrity sha512-YPG3Co0luSu6GwOBsmIdGW6Wx0NyNDLg/hriIyDllVsNwnI6UeqaWShxC3lbH4LtEQUgoLP3XR1ndXiDAWvmRw== @@ -10015,6 +10076,24 @@ postcss@^8.4.19: picocolors "^1.0.0" source-map-js "^1.0.2" +prebuild-install@^7.0.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45" + integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw== + dependencies: + detect-libc "^2.0.0" + expand-template "^2.0.3" + github-from-package "0.0.0" + minimist "^1.2.3" + mkdirp-classic "^0.5.3" + napi-build-utils "^1.0.1" + node-abi "^3.3.0" + pump "^3.0.0" + rc "^1.2.7" + simple-get "^4.0.0" + tar-fs "^2.0.0" + tunnel-agent "^0.6.0" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -10286,7 +10365,7 @@ raw-body@2.5.1: iconv-lite "0.4.24" unpipe "1.0.0" -rc@^1.0.1, rc@^1.1.6, rc@^1.2.1, rc@^1.2.8: +rc@^1.0.1, rc@^1.1.6, rc@^1.2.1, rc@^1.2.7, rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw== @@ -10508,7 +10587,7 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.0.0, readable-stream@^3.0.6, readable-stream@^3.1.1: +readable-stream@^3.0.0, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -11446,6 +11525,20 @@ signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +simple-concat@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" + integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== + +simple-get@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543" + integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== + dependencies: + decompress-response "^6.0.0" + once "^1.3.1" + simple-concat "^1.0.0" + single-line-log@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/single-line-log/-/single-line-log-1.1.2.tgz#c2f83f273a3e1a16edb0995661da0ed5ef033364" @@ -12303,6 +12396,27 @@ tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== +tar-fs@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784" + integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng== + dependencies: + chownr "^1.1.1" + mkdirp-classic "^0.5.2" + pump "^3.0.0" + tar-stream "^2.1.4" + +tar-stream@^2.1.4: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" + integrity sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ== + dependencies: + bl "^4.0.3" + end-of-stream "^1.4.1" + fs-constants "^1.0.0" + inherits "^2.0.3" + readable-stream "^3.1.1" + tar@^6.1.11: version "6.1.11" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" @@ -12999,6 +13113,16 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" +usb-detection@^4.14.1: + version "4.14.1" + resolved "https://registry.yarnpkg.com/usb-detection/-/usb-detection-4.14.1.tgz#fe0d4a28299e98b77fe75e416408ebeda38feb0e" + integrity sha512-o9JCWXILJDXnlNhjc2abMa/9JTrARVGTjTSYNhgTa1iVJvIwuvmZ5r6hvTeAEZhndC0l1BSFdctMD6QeGwLpOw== + dependencies: + bindings "^1.5.0" + eventemitter2 "^5.0.1" + nan "^2.15.0" + prebuild-install "^7.0.1" + use@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" From 31bd3c9c4ec769599683afc3fd8df77fa471d712 Mon Sep 17 00:00:00 2001 From: Ganesh Rathinavel Medayil Date: Wed, 12 Jun 2024 15:18:01 +0530 Subject: [PATCH 2/2] Forcing npm@8.16.0 to fix the issue: https://github.com/ganeshrvel/openmtp/issues/367 --- codemagic.yaml | 4 ++-- internals/scripts/CheckYarn.js | 22 ++++++++++++++++++++++ package.json | 2 +- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/codemagic.yaml b/codemagic.yaml index 16eb708c..9ac0d084 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -7,12 +7,12 @@ definitions: mac_m1_env_versions: &mac_m1_env_versions node: 16.19.0 - npm: 8 + npm: 8.16.0 xcode: 15.3 mac_intel_x64_env_versions: &mac_intel_x64_env_versions node: 16.19.0 - npm: 8 + npm: 8.16.0 xcode: 14.2 mac_m1_arm64_artifacts: &mac_m1_arm64_artifacts diff --git a/internals/scripts/CheckYarn.js b/internals/scripts/CheckYarn.js index aa5be8d1..cf8a24a9 100644 --- a/internals/scripts/CheckYarn.js +++ b/internals/scripts/CheckYarn.js @@ -1,3 +1,25 @@ +const { execSync } = require('child_process'); +const semver = require('semver'); + +const requiredVersionRange = '>=6.x <=8.16.0'; + +try { + const npmVersion = execSync('npm -v').toString().trim(); + + if (!semver.satisfies(npmVersion, requiredVersionRange)) { + console.error( + `Error: This project requires npm version ${requiredVersionRange}. You have version ${npmVersion}.\nPlease downgrade your npm, this is due to a bug in node-gyp. Github issue: https://github.com/ganeshrvel/openmtp/issues/367.\ncommand: npm install -g npm@8.16.0` + ); + process.exit(1); + } + + console.info(`Using compatible npm version: ${npmVersion}`); +} catch (error) { + console.error('Error checking npm version:', error); + + process.exit(1); +} + if (!/yarn\.js$/.test(process.env.npm_execpath || '')) { console.warn( "\u001b[33mYou don't seem to be using yarn. This could produce unexpected results.\u001b[39m" diff --git a/package.json b/package.json index 5933190c..fd0d2487 100644 --- a/package.json +++ b/package.json @@ -235,7 +235,7 @@ }, "devEngines": { "node": ">=16.x", - "npm": ">=6.x", + "npm": ">=6.x <=8.16.0", "yarn": ">=0.21.3" } }