Skip to content
Open
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
1 change: 0 additions & 1 deletion extensions/ql-vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,6 @@
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-storybook": "^10.6.1",
"glob": "^13.0.6",
"gulp": "^5.0.1",
"gulp-esbuild": "^0.14.1",
"gulp-typescript": "^5.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
DatabaseContentsWithDbScheme,
} from "./database-contents";
import { DatabaseKind } from "./database-contents";
import { glob } from "glob";
import { glob } from "fs/promises";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure who decides which minimum version of VS Code we support. It might be possible to bump the minimum supported version, but if it isn't we should probably keep the glob dependency for now.

import { encodeArchiveBasePath } from "../../common/vscode/archive-filesystem-provider";
import {
showAndLogInformationMessage,
Expand Down Expand Up @@ -87,17 +87,22 @@ async function findDataset(parentDirectory: string): Promise<Uri> {
/*
* Look directly in the root
*/
let dbRelativePaths = await glob("db-*/", {
const dbRelativePaths: string[] = [];
for await (const path of glob("db-*/", {
cwd: parentDirectory,
});
})) {
dbRelativePaths.push(path);
}

if (dbRelativePaths.length === 0) {
/*
* Check If they are in the old location
*/
dbRelativePaths = await glob("working/db-*/", {
for await (const path of glob("working/db-*/", {
cwd: parentDirectory,
});
})) {
dbRelativePaths.push(path);
}
}
if (dbRelativePaths.length === 0) {
throw new InvalidDatabaseError(
Expand All @@ -118,7 +123,11 @@ async function findDataset(parentDirectory: string): Promise<Uri> {

/** Gets the relative paths of all `.dbscheme` files in the given directory. */
async function getDbSchemeFiles(dbDirectory: string): Promise<string[]> {
return await glob("*.dbscheme", { cwd: dbDirectory });
const dbSchemeFiles: string[] = [];
for await (const file of glob("*.dbscheme", { cwd: dbDirectory })) {
dbSchemeFiles.push(file);
}
return dbSchemeFiles;
}

// exported for testing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pathExists } from "fs-extra";
import { basename, join } from "path";
import { glob } from "glob";
import { glob } from "fs/promises";

/**
* The following functions al heuristically determine metadata about databases.
Expand All @@ -19,10 +19,10 @@ export async function isLikelyDatabaseRoot(maybeRoot: string) {
pathExists(join(maybeRoot, "codeql-database.yml")),

// they *must* have a db-{language} folder
glob("db-*/", { cwd: maybeRoot }),
glob("db-*/", { cwd: maybeRoot }).next(),
]);

return (a || b) && c.length > 0;
return (a || b) && !c.done;
}

/**
Expand Down
9 changes: 6 additions & 3 deletions extensions/ql-vscode/src/databases/qlpack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { window } from "vscode";
import { glob } from "glob";
import { glob } from "fs/promises";
import { basename } from "path";
import { load } from "js-yaml";
import { readFile } from "fs-extra";
Expand Down Expand Up @@ -108,9 +108,12 @@ export async function getQlPackForDbscheme(
export async function getPrimaryDbscheme(
datasetFolder: string,
): Promise<string> {
const dbschemes = await glob("*.dbscheme", {
const dbschemes: string[] = [];
for await (const file of glob("*.dbscheme", {
cwd: datasetFolder,
});
})) {
dbschemes.push(file);
}

if (dbschemes.length < 1) {
throw new Error(
Expand Down
Loading