Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ import {extractComponentDescriptors} from './extractComponentDescriptors';
import {unixifyPaths} from '@react-native-community/cli-tools';

export function findComponentDescriptors(packageRoot: string) {
const files = glob.sync('**/+(*.js|*.jsx|*.ts|*.tsx)', {
let jsSrcsDir = null;
try {
const packageJson = fs.readFileSync(
path.join(packageRoot, 'package.json'),
'utf8',
);
jsSrcsDir = JSON.parse(packageJson).codegenConfig.jsSrcsDir;
} catch (error) {
// no jsSrcsDir, continue with default glob pattern
}
const globPattern = jsSrcsDir
? `${jsSrcsDir}/**/+(*.js|*.jsx|*.ts|*.tsx)`
: '**/+(*.js|*.jsx|*.ts|*.tsx)';
const files = glob.sync(globPattern, {
cwd: unixifyPaths(packageRoot),
onlyFiles: true,
ignore: ['**/node_modules/**'],
Expand Down
3 changes: 1 addition & 2 deletions packages/cli-config-android/src/config/findManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ export default function findManifest(folder: string) {
let manifestPaths = glob.sync('**/AndroidManifest.xml', {
cwd: unixifyPaths(folder),
ignore: [
'node_modules/**',
'**/build/**',
'**/debug/**',
'Examples/**',
'examples/**',
'**/Pods/**',
'**/sdks/hermes/android/**',
'**/src/androidTest/**',
'**/src/test/**',
'**/.cxx/**',
],
});
if (manifestPaths.length > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export function getMainActivityFiles(

return glob.sync(`**/+(${patternArray.join('|')})`, {
cwd: unixifyPaths(folder),
onlyFiles: true,
ignore: ['**/.cxx/**'],
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import glob from 'fast-glob';
import {unixifyPaths} from '@react-native-community/cli-tools';

// These folders will be excluded from search to speed it up
const GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules|Carthage|vendor)/**'];
const GLOB_EXCLUDE_PATTERN = [
'**/@(Pods|node_modules|Carthage|vendor|android)/**',
];

export default function findAllPodfilePaths(cwd: string) {
return glob.sync('**/Podfile', {
Expand Down
7 changes: 4 additions & 3 deletions packages/cli-config/src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ function isValidRNDependency(config: DependencyConfig) {

function filterConfig(config: Config) {
const filtered = {...config};
const dependencies: Record<string, DependencyConfig> = {};
Object.keys(filtered.dependencies).forEach((item) => {
if (!isValidRNDependency(filtered.dependencies[item])) {
delete filtered.dependencies[item];
if (isValidRNDependency(filtered.dependencies[item])) {
dependencies[item] = filtered.dependencies[item];
}
});
return filtered;
return {...filtered, dependencies};
}

export default {
Expand Down
Loading