File tree Expand file tree Collapse file tree
react-devtools-shell/src/e2e-regression Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 "@reach/menu-button" : " ^0.16.1" ,
1919 "@reach/tooltip" : " ^0.16.0" ,
2020 "clipboard-js" : " ^0.3.6" ,
21+ "compare-versions" : " ^5.0.3" ,
2122 "json5" : " ^2.1.3" ,
2223 "local-storage-fallback" : " ^4.1.1" ,
2324 "lodash.throttle" : " ^4.1.1" ,
2425 "memoize-one" : " ^3.1.1" ,
25- "react-virtualized-auto-sizer" : " ^1.0.6" ,
26- "semver" : " ^6.3.0"
26+ "react-virtualized-auto-sizer" : " ^1.0.6"
2727 }
2828}
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ import {stackToComponentSources} from 'react-devtools-shared/src/devtools/utils'
1515import {
1616 format ,
1717 formatWithStyles ,
18+ gt ,
19+ gte ,
1820} from 'react-devtools-shared/src/backend/utils' ;
1921import {
2022 REACT_SUSPENSE_LIST_TYPE as SuspenseList ,
@@ -252,4 +254,18 @@ describe('utils', () => {
252254 ] ) ;
253255 } ) ;
254256 } ) ;
257+
258+ describe ( 'semver comparisons' , ( ) => {
259+ it ( 'gte should compare versions correctly' , ( ) => {
260+ expect ( gte ( '1.2.3' , '1.2.1' ) ) . toBe ( true ) ;
261+ expect ( gte ( '1.2.1' , '1.2.1' ) ) . toBe ( true ) ;
262+ expect ( gte ( '1.2.1' , '1.2.2' ) ) . toBe ( false ) ;
263+ } ) ;
264+
265+ it ( 'gt should compare versions correctly' , ( ) => {
266+ expect ( gt ( '1.2.3' , '1.2.1' ) ) . toBe ( true ) ;
267+ expect ( gt ( '1.2.1' , '1.2.1' ) ) . toBe ( false ) ;
268+ expect ( gt ( '1.2.1' , '1.2.2' ) ) . toBe ( false ) ;
269+ } ) ;
270+ } ) ;
255271} ) ;
Original file line number Diff line number Diff line change 77 * @flow
88 */
99
10- import { gt , gte } from 'semver' ;
1110import {
1211 ComponentFilterDisplayName ,
1312 ComponentFilterElementType ,
@@ -39,6 +38,7 @@ import {
3938 utfEncodeString ,
4039} from 'react-devtools-shared/src/utils' ;
4140import { sessionStorageGetItem } from 'react-devtools-shared/src/storage' ;
41+ import { gt , gte } from 'react-devtools-shared/src/backend/utils' ;
4242import {
4343 cleanForBridge ,
4444 copyToClipboard ,
Original file line number Diff line number Diff line change 99 */
1010
1111import { copy } from 'clipboard-js' ;
12+ import { compareVersions } from 'compare-versions' ;
1213import { dehydrate } from '../hydration' ;
1314import isArray from 'shared/isArray' ;
1415
@@ -275,3 +276,11 @@ export function isSynchronousXHRSupported(): boolean {
275276 window . document . featurePolicy . allowsFeature ( 'sync-xhr' )
276277 ) ;
277278}
279+
280+ export function gt ( a : string = '' , b : string = '' ) : boolean {
281+ return compareVersions ( a , b ) === 1 ;
282+ }
283+
284+ export function gte ( a : string = '' , b : string = '' ) : boolean {
285+ return compareVersions ( a , b ) > - 1 ;
286+ }
Original file line number Diff line number Diff line change 44
55import * as React from 'react' ;
66import * as ReactDOM from 'react-dom' ;
7- import { gte } from 'semver' ;
87import ListApp from '../e2e-apps/ListApp' ;
98import ListAppLegacy from '../e2e-apps/ListAppLegacy' ;
9+ import { gte } from 'react-devtools-shared/src/backend/utils' ;
10+
1011const version = process . env . E2E_APP_REACT_VERSION ;
1112
1213function mountApp ( App : ( ) = > React$Node ) {
Original file line number Diff line number Diff line change @@ -5458,6 +5458,11 @@ commondir@^1.0.1:
54585458 resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
54595459 integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=
54605460
5461+ compare-versions@^5.0.3:
5462+ version "5.0.3"
5463+ resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-5.0.3.tgz#a9b34fea217472650ef4a2651d905f42c28ebfd7"
5464+ integrity sha512-4UZlZP8Z99MGEY+Ovg/uJxJuvoXuN4M6B3hKaiackiHrgzQFEe3diJi1mf1PNHbFujM7FvLrK2bpgIaImbtZ1A==
5465+
54615466component-emitter@^1.2.1:
54625467 version "1.3.0"
54635468 resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
You can’t perform that action at this time.
0 commit comments