Skip to content

Commit

Permalink
some more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
filip131311 committed Feb 27, 2025
1 parent accf953 commit 7351228
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
12 changes: 11 additions & 1 deletion packages/vscode-extension/src/utilities/expoCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ export function shouldUseExpoCLI(appRoot: string) {
} catch (e) {}

try {
const packageJson = require(path.join(appRoot, "package.json"));
const appJson = requireNoCache(path.join(appRoot, "app.json"));
hasExpoConfigInAppJson = Object.keys(appJson).includes("expo");
} catch (e) {}

try {
const appConfigJs = requireNoCache(path.join(appRoot, "app.config.js"));
hasExpoConfigInAppConfigJs = Object.keys(appConfigJs).includes("expo");
} catch (e) {}

try {
const packageJson = requireNoCache(path.join(appRoot, "package.json"));
hasExpoCommandsInScripts = Object.values<string>(packageJson.scripts).some((script: string) => {
return script.includes("expo ");
});
Expand Down
19 changes: 14 additions & 5 deletions packages/vscode-extension/src/utilities/extensionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,30 @@ export const getCurrentLaunchConfig = (): LaunchConfigurationOptions => {

export function findAppRootCandidates(maxSearchDepth: number = 3): string[] {
const candidates: string[] = [];
const searchedFileNames = ["metro.config.js", "app.json", "app.config.js"];
const searchedFileNames = [
"metro.config.js",
"metro.config.ts",
"app.json",
"app.config.js",
"app.config.ts",
];

// In order to optimize the search time we exclude directories,
// that shouldn't contain applications.
const excludedDirectoryPatterns: RegExp[] = [/^node_modules$/, /^ios$/, /^android$/, /^\..+/];

const workspacePath = workspace.workspaceFolders?.[0];
const searchQueue: [string, number][] | undefined = workspace.workspaceFolders?.map(
(workspaceFolder) => {
return [workspaceFolder.uri.path, 0];
}
);

if (workspacePath === undefined) {
if (searchQueue === undefined) {
Logger.warn("[FindFiles] Could not determine active workspace");
return [];
}

const searchQueue: [string, number][] = [];
let currentDir: [string, number] | undefined = [workspacePath.uri.path, 0];
let currentDir: [string, number] | undefined = searchQueue.shift();
while (currentDir !== undefined) {
if (currentDir[1] > maxSearchDepth) {
break;
Expand Down

0 comments on commit 7351228

Please sign in to comment.