refactor cli

This commit is contained in:
Michael Hohn
2025-03-15 17:36:35 -07:00
parent e44024763d
commit a8d61a605a
2 changed files with 37 additions and 11 deletions

View File

@@ -48,7 +48,7 @@ const baseConfig = {
"@typescript-eslint/no-throw-literal": "error",
"@typescript-eslint/consistent-type-imports": "error",
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
curly: ["error", "all"],
// curly: ["error", "all"],
"escompat/no-regexp-lookbehind": "off",
"etc/no-implicit-any-catch": "error",
"filenames/match-regex": "off",

View File

@@ -1463,38 +1463,64 @@ export class CodeQLCliServer implements Disposable {
);
}
/**
* Gets information necessary for upgrading a database.
* @param dbScheme the path to the dbscheme of the database to be upgraded.
* @param searchPath A list of directories to search for upgrade scripts.
* @param allowDowngradesIfPossible Whether we should try and include downgrades of we can.
* @param targetDbScheme The dbscheme to try to upgrade to.
* @returns A list of database upgrade script directories
*/
async resolveUpgrades(
dbScheme: string,
searchPath: string[],
allowDowngradesIfPossible: boolean,
targetDbScheme?: string,
): Promise<UpgradesInfo> {
) {
const args = [
...this.getAdditionalPacksArg(searchPath),
"--dbscheme",
dbScheme,
];
if (targetDbScheme) {
args.push("--target-dbscheme", targetDbScheme);
if (allowDowngradesIfPossible) {
args.push("--allow-downgrades");
}
}
return await this.runJsonCodeQlCliCommand<UpgradesInfo>(
return this.runJsonCodeQlCliCommand(
["resolve", "upgrades"],
args,
"Resolving database upgrade scripts",
);
}
// /**
// * Gets information necessary for upgrading a database.
// * @param dbScheme the path to the dbscheme of the database to be upgraded.
// * @param searchPath A list of directories to search for upgrade scripts.
// * @param allowDowngradesIfPossible Whether we should try and include downgrades of we can.
// * @param targetDbScheme The dbscheme to try to upgrade to.
// * @returns A list of database upgrade script directories
// */
// async resolveUpgrades(
// dbScheme: string,
// searchPath: string[],
// allowDowngradesIfPossible: boolean,
// targetDbScheme?: string,
// ): Promise<UpgradesInfo> {
// const args = [
// ...this.getAdditionalPacksArg(searchPath),
// "--dbscheme",
// dbScheme,
// ];
// if (targetDbScheme) {
// args.push("--target-dbscheme", targetDbScheme);
// if (allowDowngradesIfPossible) {
// args.push("--allow-downgrades");
// }
// }
// return await this.runJsonCodeQlCliCommand<UpgradesInfo>(
// ["resolve", "upgrades"],
// args,
// "Resolving database upgrade scripts",
// );
// }
/**
* Gets information about available qlpacks
* @param additionalPacks A list of directories to search for qlpacks.