Move cloneObject into utilities and export it.

This commit is contained in:
Remco Vermeulen 2024-07-31 17:56:06 -07:00
parent 19a1da54d1
commit 7be3a64c02
6 changed files with 12 additions and 11 deletions

5
lib/codeql.js generated
View file

@ -813,7 +813,7 @@ async function runTool(cmd, args = [], opts = {}) {
async function generateCodeScanningConfig(config, logger) {
const codeScanningConfigFile = getGeneratedCodeScanningConfigPath(config);
// make a copy so we can modify it
const augmentedConfig = cloneObject(config.originalUserInput);
const augmentedConfig = (0, util_1.cloneObject)(config.originalUserInput);
// Inject the queries from the input
if (config.augmentationProperties.queriesInput) {
if (config.augmentationProperties.queriesInputCombines) {
@ -857,9 +857,6 @@ async function generateCodeScanningConfig(config, logger) {
fs.writeFileSync(codeScanningConfigFile, yaml.dump(augmentedConfig));
return codeScanningConfigFile;
}
function cloneObject(obj) {
return JSON.parse(JSON.stringify(obj));
}
// This constant sets the size of each TRAP cache in megabytes.
const TRAP_CACHE_SIZE_MB = 1024;
async function getTrapCachingExtractorConfigArgs(config) {

File diff suppressed because one or more lines are too long

4
lib/util.js generated
View file

@ -66,6 +66,7 @@ exports.getErrorMessage = getErrorMessage;
exports.prettyPrintPack = prettyPrintPack;
exports.checkDiskUsage = checkDiskUsage;
exports.checkActionVersion = checkActionVersion;
exports.cloneObject = cloneObject;
const fs = __importStar(require("fs"));
const os = __importStar(require("os"));
const path = __importStar(require("path"));
@ -858,4 +859,7 @@ var BuildMode;
/** The database will be created by building the source root using manually specified build steps. */
BuildMode["Manual"] = "manual";
})(BuildMode || (exports.BuildMode = BuildMode = {}));
function cloneObject(obj) {
return JSON.parse(JSON.stringify(obj));
}
//# sourceMappingURL=util.js.map

File diff suppressed because one or more lines are too long