File tree Expand file tree Collapse file tree 5 files changed +11
-13
lines changed
__tests__/jest/sharedStyles Expand file tree Collapse file tree 5 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ beforeEach(() => {
88 jest . resetModules ( ) ;
99
1010 jest . mock ( '../../../src/utils/getSketchVersion' , ( ) => ( {
11- __esModule : true ,
12- default : jest . fn ( ( ) => '51' ) ,
11+ getSketchVersion : jest . fn ( ( ) => 51 ) ,
1312 } ) ) ;
1413
1514 TextStyles = require ( '../../../src/sharedStyles/TextStyles' ) ;
Original file line number Diff line number Diff line change 1- import getSketchVersion from './utils/getSketchVersion' ;
2-
31const Platform = {
42 OS : 'sketch' ,
5- Version : getSketchVersion ( ) ,
3+ Version : 1 ,
64 select : ( obj : { sketch : any } ) => obj . sketch ,
75} ;
86
Original file line number Diff line number Diff line change 66 TextStyle ,
77 PlatformBridge ,
88} from '../types' ;
9- import getSketchVersion from '../utils/getSketchVersion' ;
9+ import { getSketchVersion } from '../utils/getSketchVersion' ;
1010import isRunningInSketch from '../utils/isRunningInSketch' ;
1111import hashStyle from '../utils/hashStyle' ;
1212import { getDocument } from '../utils/getDocument' ;
@@ -65,7 +65,7 @@ const TextStyles = (getDefaultBridge: () => PlatformBridge) => ({
6565
6666 const doc = getDocument ( document ) ;
6767
68- if ( isRunningInSketch ( ) && doc != null && parseInt ( getSketchVersion ( ) ) < 50 ) {
68+ if ( isRunningInSketch ( ) && doc != null && getSketchVersion ( ) < 50 ) {
6969 doc . showMessage ( 'π Requires Sketch 50+ π' ) ;
7070 return { } ;
7171 }
Original file line number Diff line number Diff line change 1- export default function getSketchVersion ( ) : string {
2- return typeof NSBundle !== 'undefined'
3- ? NSBundle . mainBundle ( ) . infoDictionary ( ) . CFBundleShortVersionString
4- : '' ;
1+ export function getSketchVersion ( ) : number | 'NodeJS' {
2+ if ( typeof NSBundle !== 'undefined' ) {
3+ return parseFloat ( NSBundle . mainBundle ( ) . infoDictionary ( ) . CFBundleShortVersionString ) ;
4+ }
5+ return 'NodeJS' ;
56}
Original file line number Diff line number Diff line change 1- import getSketchVersion from './getSketchVersion' ;
1+ import { getSketchVersion } from './getSketchVersion' ;
22
33export default function isRunningInSketch ( ) {
4- return getSketchVersion ( ) !== '' ;
4+ return getSketchVersion ( ) !== 'NodeJS ' ;
55}
You canβt perform that action at this time.
0 commit comments