Introduce wrapper for codeql pack add CLI command
Similar to what we do with `codeql pack install`. Tnis will simulate us running `codeql pack add codeql/<language>-all`. We're going to need in order to: - generate a lock file (codeql-pack.lock.yaml) - install the correct packages for our skeleton QL pack based on the lock file.
This commit is contained in:
@@ -28,6 +28,7 @@ import { CompilationMessage } from "./pure/legacy-messages";
|
||||
import { sarifParser } from "./sarif-parser";
|
||||
import { dbSchemeToLanguage, walkDirectory } from "./helpers";
|
||||
import { App } from "./common/app";
|
||||
import { QueryLanguage } from "./qlpack-generator";
|
||||
|
||||
/**
|
||||
* The version of the SARIF format that we are using.
|
||||
@@ -1216,6 +1217,23 @@ export class CodeQLCliServer implements Disposable {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a list of QL library packs with optional version ranges as dependencies of
|
||||
* the current package, and then installs them. This command modifies the qlpack.yml
|
||||
* file of the current package. Formatting and comments will be removed.
|
||||
* @param dir The directory where QL pack exists.
|
||||
* @param language The language of the QL pack.
|
||||
*/
|
||||
async packAdd(dir: string, queryLanguage: QueryLanguage) {
|
||||
const args = ["--dir", dir];
|
||||
args.push(`codeql/${queryLanguage}-all`);
|
||||
return this.runJsonCodeQlCliCommandWithAuthentication(
|
||||
["pack", "add"],
|
||||
args,
|
||||
"Adding pack dependencies and installing them",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads a specified pack.
|
||||
* @param packs The `<package-scope/name[@version]>` of the packs to download.
|
||||
|
||||
Reference in New Issue
Block a user