File tree Expand file tree Collapse file tree
react-devtools-shared/src/backend
react-devtools-shell/src/e2e-regression Expand file tree Collapse file tree 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 @@ -275,3 +275,26 @@ export function isSynchronousXHRSupported(): boolean {
275275 window . document . featurePolicy . allowsFeature ( 'sync-xhr' )
276276 ) ;
277277}
278+
279+ // https://www.npmjs.com/package/semver-compare
280+ export function semvercmp ( a : string = '' , b : string = '' ) : number {
281+ const pa = a . split ( '.' ) ;
282+ const pb = b . split ( '.' ) ;
283+ for ( let i = 0 ; i < 3 ; i ++ ) {
284+ const na = + pa [ i ] ;
285+ const nb = + pb [ i ] ;
286+ if ( na > nb ) return 1 ;
287+ if ( nb > na ) return - 1 ;
288+ if ( ! isNaN ( na ) && isNaN ( nb ) ) return 1 ;
289+ if ( isNaN ( na ) && ! isNaN ( nb ) ) return - 1 ;
290+ }
291+ return 0 ;
292+ }
293+
294+ export function gt ( a : string = '' , b : string = '' ) : boolean {
295+ return semvercmp ( a , b ) === 1 ;
296+ }
297+
298+ export function gte ( a : string = '' , b : string = '' ) : boolean {
299+ return semvercmp ( a , b ) > - 1 ;
300+ }
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 ) {
You can’t perform that action at this time.
0 commit comments