-
Notifications
You must be signed in to change notification settings - Fork 934
Expand file tree
/
Copy pathfindManifest.ts
More file actions
39 lines (36 loc) · 1.08 KB
/
findManifest.ts
File metadata and controls
39 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import glob from 'tinyglobby';
import path from 'path';
import {unixifyPaths} from '@react-native-community/cli-tools';
export default function findManifest(folder: string) {
let manifestPaths = glob.globSync('**/AndroidManifest.xml', {
cwd: unixifyPaths(folder),
expandDirectories: false,
ignore: [
'**/build/**',
'**/debug/**',
'Examples/**',
'examples/**',
'**/sdks/hermes/android/**',
'**/src/androidTest/**',
'**/src/test/**',
'**/.cxx/**',
],
});
if (manifestPaths.length > 1) {
// if we have more than one manifest, pick the one in the main folder if present
const mainManifest = manifestPaths.filter((manifestPath) =>
manifestPath.includes('src/main/'),
);
if (mainManifest.length === 1) {
manifestPaths = mainManifest;
}
}
return manifestPaths[0] ? path.join(folder, manifestPaths[0]) : null;
}