import * as path from 'path' ; const packagePath = path . join ( process . cwd ( ) , 'package.json' ) ; const dependecyToCheck = '@microsoft/sp-build-web' ; const packageJson = require ( packagePath ) ; export function getTemplatesPath ( fileName ) { const basePath = 'templates/' ; return path . join ( __dirname , '..' , basePath + fileName ) ; } export function getSpfxMinorVersion ( ) { let version = packageJson . devDependencies [ dependecyToCheck ] ; if ( version . indexOf ( '~' ) === 0 || version . indexOf ( '^' ) === 0 ) { version = version . substr ( 1 ) ; } return parseInt ( version . split ( '.' ) [ 1 ] ) ; } export function isBeta ( ) { const version = packageJson . devDependencies [ dependecyToCheck ] ; return version . indexOf ( '-beta' ) !== - 1 ; }