diff --git a/.nvmrc b/.nvmrc index 5bcf9c6e6..54c65116f 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v24.18.0 +v24 diff --git a/lib/interface/cli/helpers/cli-config.js b/lib/interface/cli/helpers/cli-config.js index 8be5725ae..7ce70b92f 100644 --- a/lib/interface/cli/helpers/cli-config.js +++ b/lib/interface/cli/helpers/cli-config.js @@ -3,7 +3,9 @@ const flatten = require('flat'); const columnify = require('columnify'); const yaml = require('js-yaml'); const Style = require('../../../output/Style'); -const { NoPropertyError, MultiplePropertiesError, NotFullPropertyError, SchemaValidationError } = require('../../../logic/cli-config/errors'); +const { + NoPropertyError, MultiplePropertiesError, NotFullPropertyError, SchemaValidationError, +} = require('../../../logic/cli-config/errors'); const _jsonFormatter = data => JSON.stringify(data, null, 4); const COLUMNIFY_OPTS = { columnSplitter: ' ', headingTransform: Style.bold.uppercase }; @@ -38,7 +40,7 @@ function _defaultOutput(data) { function _formatter(format) { switch (format) { case 'yaml': - return yaml.safeDump; + return yaml.dump; case 'json': return _jsonFormatter; default: diff --git a/lib/interface/cli/helpers/general.js b/lib/interface/cli/helpers/general.js index 7a187718e..fd4a34235 100644 --- a/lib/interface/cli/helpers/general.js +++ b/lib/interface/cli/helpers/general.js @@ -129,7 +129,7 @@ const crudFilenameOption = (yargs, options = {}) => { return options.raw ? rawFile : JSON.parse(rawFile); } if (arg.endsWith('.yml') || arg.endsWith('yaml')) { - return options.raw ? rawFile : yaml.safeLoad(rawFile); + return options.raw ? rawFile : yaml.load(rawFile); } throw new CFError('File extension is not recognized'); } catch (err) { diff --git a/lib/interface/cli/helpers/validation.js b/lib/interface/cli/helpers/validation.js index 4ce318f06..c3e237370 100644 --- a/lib/interface/cli/helpers/validation.js +++ b/lib/interface/cli/helpers/validation.js @@ -40,7 +40,7 @@ async function validatePipelineSpec(data) { if (specTemplate) { // CR-6414 Using specTemplate - skip check spec/stages - they are not used return { valid: true, message: 'Using specTemplate' }; } - const validatedYaml = yaml.safeDump(yamlObj); + const validatedYaml = yaml.dump(yamlObj); const result = await sdk.pipelines.validateYaml({ yaml: validatedYaml, outputFormat: 'lint' }); let message; if (result.summarize) { diff --git a/lib/logic/cli-config/Manager.js b/lib/logic/cli-config/Manager.js index b834d5b71..9fee0bf1d 100644 --- a/lib/logic/cli-config/Manager.js +++ b/lib/logic/cli-config/Manager.js @@ -47,11 +47,11 @@ function _loadFullConfig() { }, }; const file = fs.openSync(filePath, 'w'); - fs.writeSync(file, yaml.safeDump(fullConfig)); + fs.writeSync(file, yaml.dump(fullConfig)); fs.closeSync(file); return fullConfig; } - return yaml.safeLoad(fs.readFileSync(filePath)); + return yaml.load(fs.readFileSync(filePath)); } function _validate(properties, propertyName) { @@ -127,7 +127,7 @@ class CliConfigManager { static persistConfig() { this._preloadConfig(); const file = fs.openSync(filePath, 'w'); - fs.writeSync(file, yaml.safeDump(FULL_CONFIG)); + fs.writeSync(file, yaml.dump(FULL_CONFIG)); fs.closeSync(file); } diff --git a/lib/logic/cli-config/manager.spec.js b/lib/logic/cli-config/manager.spec.js index 419deb44f..062e463d7 100644 --- a/lib/logic/cli-config/manager.spec.js +++ b/lib/logic/cli-config/manager.spec.js @@ -46,11 +46,11 @@ jest.mock('fs', () => { // eslint-disable-line }); jest.mock('js-yaml', () => { - const safeLoad = (d) => d; - const safeDump = (d) => d; + const load = (d) => d; + const dump = (d) => d; return { - safeLoad, - safeDump, + load, + dump, }; }); diff --git a/lib/logic/entities/Entity.js b/lib/logic/entities/Entity.js index 32ab5d248..a851bfb33 100644 --- a/lib/logic/entities/Entity.js +++ b/lib/logic/entities/Entity.js @@ -22,7 +22,7 @@ class Entity { } toYaml() { - return yaml.safeDump(this.info); + return yaml.dump(this.info); } toName() { diff --git a/lib/output/types/yaml.output.js b/lib/output/types/yaml.output.js index 552437309..f1067e290 100644 --- a/lib/output/types/yaml.output.js +++ b/lib/output/types/yaml.output.js @@ -22,9 +22,9 @@ function output(data) { }); if (yamlArray.items.length === 1) { - return yaml.safeDump(yamlArray.items[0]); + return yaml.dump(yamlArray.items[0]); } - return yaml.safeDump(yamlArray); + return yaml.dump(yamlArray); } module.exports = output; diff --git a/package.json b/package.json index 713288409..546ceed5e 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "codefresh", - "version": "1.2.3", + "version": "1.2.4", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true, "scripts": { "generate-completion": "node ./lib/interface/cli/completion/generate", - "test": "jest .spec.js --coverage", + "test": "rm -rf ./temp && jest .spec.js --runInBand --ci --color --coverage --silent", "e2e": "bash e2e/e2e.spec.sh", "eslint": "eslint --fix lib/logic/**", "pkg": "npx pkg . -t node20-alpine-x64,node20-alpine-arm64,node20-macos-x64,node20-linux-x64,node20-win-x64,node20-linux-arm64 --out-path ./dist", @@ -68,7 +68,7 @@ "firebase": "git+https://github.com/codefresh-io/firebase.git#80b2ed883ff281cd67b53bd0f6a0bbd6f330fed5", "flat": "^5.0.2", "inquirer": "^12.11.1", - "js-yaml": "^3.10.0", + "js-yaml": "^4.3.0", "kefir": "^3.8.1", "kubernetes-client": "^9.0.0", "lodash": "^4.17.23", diff --git a/yarn.lock b/yarn.lock index 3df14310a..1fc9ea0f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2491,9 +2491,9 @@ bowser@^2.11.0: integrity sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg== brace-expansion@^1.1.7: - version "1.1.14" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.14.tgz#d9de602370d91347cd9ddad1224d4fd701eb348b" - integrity sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g== + version "1.1.16" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.16.tgz#723d3a30c0558c225abc9fc479a73e14e26c3c2f" + integrity sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" @@ -3796,9 +3796,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fast-uri@^3.0.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.2.tgz#8af3d4fc9d3e71b11572cc2673b514a7d1a8c8ec" - integrity sha512-rVjf7ArG3LTk+FS6Yw81V1DLuZl1bRbNrev6Tmd/9RaroeeRRJhAt7jg/6YFxbvAQXUCavSoZhPPj6oOx+5KjQ== + version "3.1.4" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.4.tgz#3b3daf9ce68f41f956df0b505132c0cfce9ec7af" + integrity sha512-8JnbkQ4juDyvYs4mgFGQqg4yCYtFDtUtmp2QIQq11ZZe5CFQ5wcqm1rqDgAh/QdMySuBnPzMUiJUNZG5N/AiQw== fast-xml-builder@^1.1.5: version "1.1.8" @@ -5117,7 +5117,7 @@ js-tokens@^4.0.0: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@^3.10.0, js-yaml@^3.13.1, js-yaml@^3.14.0: +js-yaml@^3.13.1, js-yaml@^3.14.0: version "3.15.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.15.0.tgz#586e5214eafe3e893756a41e979b50d89d3e4a67" integrity sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog== @@ -5125,10 +5125,10 @@ js-yaml@^3.10.0, js-yaml@^3.13.1, js-yaml@^3.14.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.2.0.tgz#2bd9e85682dd91bd469afb809d816043b3d49524" - integrity sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw== +js-yaml@^4.1.0, js-yaml@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.3.0.tgz#d1900572a7f7cf0b5f540c83673e60bad3436592" + integrity sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q== dependencies: argparse "^2.0.1" @@ -6903,9 +6903,9 @@ tar-stream@^3.1.5: streamx "^2.15.0" tar@^7.0.0, tar@^7.5.7: - version "7.5.17" - resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.17.tgz#5eace4af68b088bb1d737ba9fffdacbbb70ba6e0" - integrity sha512-wPEBwzapC+2PaTYPH6e2L+cNOEE227S47wUYFqlegcs8zlLLmeb9Fcff1HVZY4Fwku/1Eyv38n7GYwB2aaS71g== + version "7.5.21" + resolved "https://registry.yarnpkg.com/tar/-/tar-7.5.21.tgz#b3405af2eb493523ce4379f531e9ebda0601bc59" + integrity sha512-XdhtCvlMywwxpCW8YEq3lOXBJpUPTR2OHHcwLPO3HwsJqOHa2Ok/oJ7ruGzp+JrKoRPVCzJwAdEjqLW/vNRPHA== dependencies: "@isaacs/fs-minipass" "^4.0.0" chownr "^3.0.0"