1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = findProjectRoot;
|
7 | function _findUp() {
|
8 | const data = _interopRequireDefault(require("find-up"));
|
9 | _findUp = function () {
|
10 | return data;
|
11 | };
|
12 | return data;
|
13 | }
|
14 | function _path() {
|
15 | const data = _interopRequireDefault(require("path"));
|
16 | _path = function () {
|
17 | return data;
|
18 | };
|
19 | return data;
|
20 | }
|
21 | var _errors = require("./errors");
|
22 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23 |
|
24 |
|
25 |
|
26 | function findProjectRoot(cwd = process.cwd()) {
|
27 | const packageLocation = _findUp().default.sync('package.json', {
|
28 | cwd
|
29 | });
|
30 | |
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | if (!packageLocation) {
|
38 | throw new _errors.CLIError(`
|
39 | We couldn't find a package.json in your project.
|
40 | Are you sure you are running it inside a React Native project?
|
41 | `);
|
42 | }
|
43 | return _path().default.dirname(packageLocation);
|
44 | }
|
45 |
|
46 |
|
\ | No newline at end of file |