UNPKG

1.81 kBJavaScriptView Raw
1"use strict";
2var __importDefault = (this && this.__importDefault) || function (mod) {
3 return (mod && mod.__esModule) ? mod : { "default": mod };
4};
5Object.defineProperty(exports, "__esModule", { value: true });
6const json_file_1 = __importDefault(require("@expo/json-file"));
7const find_yarn_workspace_root_1 = __importDefault(require("find-yarn-workspace-root"));
8const fs_extra_1 = __importDefault(require("fs-extra"));
9const path_1 = __importDefault(require("path"));
10const Errors_1 = require("./Errors");
11const Modules_1 = require("./Modules");
12function isUsingYarn(projectRoot) {
13 const workspaceRoot = find_yarn_workspace_root_1.default(projectRoot);
14 if (workspaceRoot) {
15 return fs_extra_1.default.existsSync(path_1.default.join(workspaceRoot, 'yarn.lock'));
16 }
17 else {
18 return fs_extra_1.default.existsSync(path_1.default.join(projectRoot, 'yarn.lock'));
19 }
20}
21exports.isUsingYarn = isUsingYarn;
22function getExpoSDKVersion(projectRoot, exp) {
23 if (exp && exp.sdkVersion) {
24 return exp.sdkVersion;
25 }
26 const packageJsonPath = Modules_1.projectHasModule('expo/package.json', projectRoot, exp);
27 if (packageJsonPath) {
28 const expoPackageJson = json_file_1.default.read(packageJsonPath, { json5: true });
29 const { version: packageVersion } = expoPackageJson;
30 if (typeof packageVersion === 'string') {
31 const majorVersion = packageVersion.split('.').shift();
32 return `${majorVersion}.0.0`;
33 }
34 }
35 throw new Errors_1.ConfigError(`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.`, 'MODULE_NOT_FOUND');
36}
37exports.getExpoSDKVersion = getExpoSDKVersion;
38//# sourceMappingURL=Project.js.map
\No newline at end of file