Skip to content

Commit bc8728f

Browse files
authored
fix: improve app detection
2 parents e36a515 + 3ad629a commit bc8728f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/project-roots.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as path from 'path';
44
import { logError, logInfo } from './utils/logger';
55
import { URI } from 'vscode-uri';
6-
import { isGlimmerXProject, isELSAddonRoot, isRootStartingWithFilePath, safeWalkAsync, asyncGetPackageJSON } from './utils/layout-helpers';
6+
import { isEmberLikeProject, isELSAddonRoot, isRootStartingWithFilePath, safeWalkAsync, asyncGetPackageJSON } from './utils/layout-helpers';
77

88
import Server from './server';
99

@@ -83,7 +83,7 @@ export default class ProjectRoots {
8383
async findProjectsInsideRoot(workspaceRoot: string) {
8484
const roots = await safeWalkAsync(workspaceRoot, {
8585
directories: false,
86-
globs: ['**/ember-cli-build.js', '**/package.json'],
86+
globs: ['**/ember-cli-build.js', '**/ember-cli-build.cjs', '**/package.json'],
8787
ignore: ['**/.git/**', '**/bower_components/**', '**/dist/**', '**/node_modules/**', '**/tmp/**'],
8888
});
8989

@@ -97,7 +97,7 @@ export default class ProjectRoots {
9797

9898
if (filePath.endsWith('package.json')) {
9999
try {
100-
if (await isGlimmerXProject(fullPath)) {
100+
if (await isEmberLikeProject(fullPath)) {
101101
await this.onProjectAdd(fullPath);
102102
}
103103
} catch (e) {

src/utils/layout-helpers.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,14 @@ export function getDepIfExists(pack: PackageInfo, depName: string): string | nul
300300
return version;
301301
}
302302

303-
export async function isGlimmerXProject(root: string) {
303+
export async function isEmberLikeProject(root: string) {
304304
const pack = await asyncGetPackageJSON(root);
305305

306-
return hasDep(pack, '@glimmerx/core') || hasDep(pack, 'glimmer-lite-core');
306+
const isGlimmerXProject = hasDep(pack, '@glimmerx/core') || hasDep(pack, 'glimmer-lite-core');
307+
const isEmberAddon = 'ember-addon' in pack;
308+
const isEmberApp = 'ember' in pack;
309+
310+
return isGlimmerXProject || isEmberAddon || isEmberApp;
307311
}
308312

309313
export async function getProjectAddonsRoots(

0 commit comments

Comments
 (0)