UNPKG

1.76 kBSource Map (JSON)View Raw
1{"version":3,"file":"Project.js","sourceRoot":"","sources":["../src/Project.ts"],"names":[],"mappings":";;;;;AAAA,gEAAuC;AAEvC,qCAAuC;AACvC,uCAA6C;AAE7C,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,GAAuD;IAEvD,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,EAAE;QACzB,OAAO,GAAG,CAAC,UAAU,CAAC;KACvB;IACD,MAAM,eAAe,GAAG,0BAAgB,CAAC,mBAAmB,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;IAChF,IAAI,eAAe,EAAE;QACnB,MAAM,eAAe,GAAG,mBAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACxE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,eAAe,CAAC;QACpD,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;YACtC,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;YACvD,OAAO,GAAG,YAAY,MAAM,CAAC;SAC9B;KACF;IACD,MAAM,IAAI,oBAAW,CACnB,mKAAmK,EACnK,kBAAkB,CACnB,CAAC;AACJ,CAAC;AApBD,8CAoBC","sourcesContent":["import JsonFile from '@expo/json-file';\nimport { ExpoConfig } from './Config.types';\nimport { ConfigError } from './Errors';\nimport { projectHasModule } from './Modules';\n\nexport function getExpoSDKVersion(\n projectRoot: string,\n exp: Pick<ExpoConfig, 'sdkVersion' | 'nodeModulesPath'>\n): string {\n if (exp && exp.sdkVersion) {\n return exp.sdkVersion;\n }\n const packageJsonPath = projectHasModule('expo/package.json', projectRoot, exp);\n if (packageJsonPath) {\n const expoPackageJson = JsonFile.read(packageJsonPath, { json5: true });\n const { version: packageVersion } = expoPackageJson;\n if (typeof packageVersion === 'string') {\n const majorVersion = packageVersion.split('.').shift();\n return `${majorVersion}.0.0`;\n }\n }\n throw new ConfigError(\n `Cannot determine which native SDK version your project uses because the module \\`expo\\` is not installed. Please install it with \\`yarn add expo\\` and try again.`,\n 'MODULE_NOT_FOUND'\n );\n}\n"]}
\No newline at end of file