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