Skip to content

Commit d63b632

Browse files
committed
more robust directory scanning
1 parent f75a992 commit d63b632

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

server/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ async function loadFrameworkInfo(keyedDir, directoryName) {
6565
return result;
6666
}
6767

68+
function isFrameworkDir(keyedDir, directoryName) {
69+
const frameworkPath = path.resolve(frameworkDirectory, keyedDir, directoryName);
70+
const packageJSONPath = path.resolve(frameworkPath, "package.json");
71+
const packageLockJSONPath = path.resolve(frameworkPath, "package-lock.json");
72+
const exists = fs.existsSync(packageJSONPath) && fs.existsSync(packageLockJSONPath);
73+
return exists;
74+
}
75+
6876
async function loadFrameworkVersionInformation(filterForFramework) {
6977
// let matchesDirectoryArg = (directoryName) =>
7078
// frameworkArgument.length == 0 || frameworkArgument.some((arg: string) => arg == directoryName);
@@ -76,8 +84,10 @@ async function loadFrameworkVersionInformation(filterForFramework) {
7684
for (let directory of directories) {
7785
let pathInFrameworksDir = keyedType + "/" + directory;
7886
if (!filterForFramework || filterForFramework===pathInFrameworksDir) {
79-
let fi = loadFrameworkInfo(keyedType, directory);
80-
resultsProm.push(fi);
87+
if (isFrameworkDir(keyedType, directory)) {
88+
let fi = loadFrameworkInfo(keyedType, directory);
89+
resultsProm.push(fi);
90+
}
8191
}
8292
}
8393
}

0 commit comments

Comments
 (0)