File tree Expand file tree Collapse file tree 6 files changed +35
-4
lines changed
react-devtools-shell/src/e2e-regression Expand file tree Collapse file tree 6 files changed +35
-4
lines changed Original file line number Diff line number Diff line change 18
18
"@reach/menu-button" : " ^0.16.1" ,
19
19
"@reach/tooltip" : " ^0.16.0" ,
20
20
"clipboard-js" : " ^0.3.6" ,
21
+ "compare-versions" : " ^5.0.3" ,
21
22
"json5" : " ^2.1.3" ,
22
23
"local-storage-fallback" : " ^4.1.1" ,
23
24
"lodash.throttle" : " ^4.1.1" ,
24
25
"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"
27
27
}
28
28
}
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ import {stackToComponentSources} from 'react-devtools-shared/src/devtools/utils'
15
15
import {
16
16
format ,
17
17
formatWithStyles ,
18
+ gt ,
19
+ gte ,
18
20
} from 'react-devtools-shared/src/backend/utils' ;
19
21
import {
20
22
REACT_SUSPENSE_LIST_TYPE as SuspenseList ,
@@ -252,4 +254,18 @@ describe('utils', () => {
252
254
] ) ;
253
255
} ) ;
254
256
} ) ;
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
+ } ) ;
255
271
} ) ;
Original file line number Diff line number Diff line change 7
7
* @flow
8
8
*/
9
9
10
- import { gt , gte } from 'semver' ;
11
10
import {
12
11
ComponentFilterDisplayName ,
13
12
ComponentFilterElementType ,
@@ -39,6 +38,7 @@ import {
39
38
utfEncodeString ,
40
39
} from 'react-devtools-shared/src/utils' ;
41
40
import { sessionStorageGetItem } from 'react-devtools-shared/src/storage' ;
41
+ import { gt , gte } from 'react-devtools-shared/src/backend/utils' ;
42
42
import {
43
43
cleanForBridge ,
44
44
copyToClipboard ,
Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
import { copy } from 'clipboard-js' ;
12
+ import { compareVersions } from 'compare-versions' ;
12
13
import { dehydrate } from '../hydration' ;
13
14
import isArray from 'shared/isArray' ;
14
15
@@ -275,3 +276,11 @@ export function isSynchronousXHRSupported(): boolean {
275
276
window . document . featurePolicy . allowsFeature ( 'sync-xhr' )
276
277
) ;
277
278
}
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 4
4
5
5
import * as React from 'react' ;
6
6
import * as ReactDOM from 'react-dom' ;
7
- import { gte } from 'semver' ;
8
7
import ListApp from '../e2e-apps/ListApp' ;
9
8
import ListAppLegacy from '../e2e-apps/ListAppLegacy' ;
9
+ import { gte } from 'react-devtools-shared/src/backend/utils' ;
10
+
10
11
const version = process . env . E2E_APP_REACT_VERSION ;
11
12
12
13
function mountApp ( App : ( ) = > React$Node ) {
Original file line number Diff line number Diff line change @@ -5458,6 +5458,11 @@ commondir@^1.0.1:
5458
5458
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
5459
5459
integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=
5460
5460
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
+
5461
5466
component-emitter@^1.2.1:
5462
5467
version "1.3.0"
5463
5468
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