From 9f945f6a2a61acb5a97dcb0902dda9ed831840df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Oct 2026 05:38:38 +0000 Subject: [PATCH 1/2] [DEPENDENCY] Bump js-yaml from 4.3.2 to 5.4.3 Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.3.2 to 5.4.3. - [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/js-yaml/compare/4.3.2...5.4.3) --- updated-dependencies: - dependency-name: js-yaml dependency-version: 5.4.3 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 55 ++++++++++++++++++++++++++++++++++++++++++----- package.json | 2 +- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 742ef8b8..1a1e2e49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "chalk": "^5.6.2", "data-with-position": "^0.5.0", "import-local": "^3.2.0", - "js-yaml": "^4.3.2", + "js-yaml": "^5.4.3", "open": "^11.0.4", "pretty-hrtime": "^1.0.3", "semver": "^7.8.5", @@ -809,6 +809,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -4015,6 +4038,28 @@ "node": ">= 4" } }, + "node_modules/@ui5/project/node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@ui5/project/node_modules/unicorn-magic": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", @@ -8865,9 +8910,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", - "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.4.3.tgz", + "integrity": "sha512-yzzNtgczwgoVHNigCyKTXcQJU4Y8t/ikU4UxXW0BvrLfHTGWZhsNcOT2s/a7vn81/4KqVnNmHjaUEPlvWnNwVw==", "funding": [ { "type": "github", @@ -8883,7 +8928,7 @@ "argparse": "^2.0.1" }, "bin": { - "js-yaml": "bin/js-yaml.js" + "js-yaml": "bin/js-yaml.mjs" } }, "node_modules/js2xmlparser": { diff --git a/package.json b/package.json index 7eb3fe41..44d83f6c 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "chalk": "^5.6.2", "data-with-position": "^0.5.0", "import-local": "^3.2.0", - "js-yaml": "^4.3.2", + "js-yaml": "^5.4.3", "open": "^11.0.4", "pretty-hrtime": "^1.0.3", "semver": "^7.8.5", From dc523c4de78a046322e3f3308a0c5a1b4580c601 Mon Sep 17 00:00:00 2001 From: Merlin Beutlberger Date: Fri, 9 Oct 2026 15:45:30 +0200 Subject: [PATCH 2/2] [FIX] Adapt YAML handling for js-yaml v5 js-yaml v5 replaces the quotingType dump option with quoteStyle and changes the default load schema to CORE_SCHEMA. The schema change prevents framework commands from finding project metadata provided through YAML merge keys. Use the new dump option for ui5 init. Extend CORE_SCHEMA with merge and timestamp tags when framework commands load and validate ui5.yaml files. The same incompatibilities were addressed for UI5 CLI v5 in: https://github.com/UI5/cli/pull/1558 --- lib/cli/commands/init.js | 4 ++-- lib/framework/ui5YamlSchema.js | 4 ++++ lib/framework/updateYaml.js | 6 +++-- test/lib/cli/commands/init.js | 5 ++++- test/lib/framework/updateYaml.js | 38 ++++++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 lib/framework/ui5YamlSchema.js diff --git a/lib/cli/commands/init.js b/lib/cli/commands/init.js index 5985c4f0..f6b33196 100644 --- a/lib/cli/commands/init.js +++ b/lib/cli/commands/init.js @@ -12,7 +12,7 @@ initCommand.handler = async function() { const {default: init} = await import("../../init/init.js"); const {default: path} = await import("node:path"); const {writeFile} = await import("node:fs/promises"); - const {default: jsYaml} = await import("js-yaml"); + const {dump} = await import("js-yaml"); const yamlPath = path.resolve("./ui5.yaml"); if (await exists(yamlPath)) { @@ -20,7 +20,7 @@ initCommand.handler = async function() { } const projectConfig = await init(); - const yaml = jsYaml.dump(projectConfig, {quotingType: `"`}); + const yaml = dump(projectConfig, {quoteStyle: "double"}); await writeFile(yamlPath, yaml); process.stdout.write(`Wrote ui5.yaml to ${yamlPath}:`); diff --git a/lib/framework/ui5YamlSchema.js b/lib/framework/ui5YamlSchema.js new file mode 100644 index 00000000..1c87d8b3 --- /dev/null +++ b/lib/framework/ui5YamlSchema.js @@ -0,0 +1,4 @@ +import {CORE_SCHEMA, mergeTag, timestampTag} from "js-yaml"; + +// Preserve merge keys and implicit timestamps from the js-yaml v4 default schema. +export default CORE_SCHEMA.withTags([mergeTag, timestampTag]); diff --git a/lib/framework/updateYaml.js b/lib/framework/updateYaml.js index 12063245..b70e1368 100644 --- a/lib/framework/updateYaml.js +++ b/lib/framework/updateYaml.js @@ -1,6 +1,7 @@ import path from "node:path"; import {readFile, writeFile} from "node:fs/promises"; import {loadAll, dump} from "js-yaml"; +import ui5YamlSchema from "./ui5YamlSchema.js"; import {fromYaml, getPosition, getValue, getKind} from "data-with-position"; import {getLogger} from "@ui5/logger"; @@ -8,7 +9,8 @@ const log = getLogger("cli:framework:updateYaml"); function getProjectYamlDocument({project, configFile, configPath}) { const configs = loadAll(configFile, undefined, { - filename: configPath + filename: configPath, + schema: ui5YamlSchema }); const projectDocumentIndex = configs.findIndex((config) => { @@ -277,7 +279,7 @@ export default async function({project, configPathOverride, data}) { // Validate content before writing try { - loadAll(adoptedYaml); + loadAll(adoptedYaml, undefined, {schema: ui5YamlSchema}); } catch (err) { const error = new Error("Failed to update YAML file: " + err.message); error.name = "FrameworkUpdateYamlFailed"; diff --git a/test/lib/cli/commands/init.js b/test/lib/cli/commands/init.js index 33785f14..a623e5e9 100644 --- a/test/lib/cli/commands/init.js +++ b/test/lib/cli/commands/init.js @@ -38,7 +38,10 @@ test.serial("Writes ui5.yaml to fs", async (t) => { t.is(fsWriteFileStub.getCall(0).args[0], ui5YamlPath, "Passes yaml path to write the yaml file to"); t.is(fsWriteFileStub.getCall(0).args[1], ui5Yaml, "Passes yaml content to write to fs"); - t.deepEqual(jsyamlDumpStub.getCall(0).args[1], {quotingType: `"`}, "Enforce usage of double quotes in yaml files"); + t.deepEqual( + jsyamlDumpStub.getCall(0).args[1], {quoteStyle: "double"}, + "Enforce usage of double quotes in yaml files" + ); }); test.serial("Error: throws if ui5.yaml already exists", async (t) => { diff --git a/test/lib/framework/updateYaml.js b/test/lib/framework/updateYaml.js index 16a6f457..ac104fff 100644 --- a/test/lib/framework/updateYaml.js +++ b/test/lib/framework/updateYaml.js @@ -56,6 +56,44 @@ framework: `, "writeFile should be called with expected content"); }); +test.serial("Should update document with merged metadata", async (t) => { + t.context.fsReadFileStub.resolves(` +--- +projectDefaults: &projectDefaults + metadata: + name: my-project +<<: *projectDefaults +framework: + name: SAPUI5 + version: 1.0.0 +`); + + await updateYaml({ + project: { + getRootPath: () => "my-project", + getName: () => "my-project" + }, + data: { + framework: { + name: "OpenUI5", + version: "1.76.0" + } + } + }); + + t.is(t.context.fsWriteFileStub.callCount, 1, "fs.writeFile should be called once"); + t.is(t.context.fsWriteFileStub.getCall(0).args[1], ` +--- +projectDefaults: &projectDefaults + metadata: + name: my-project +<<: *projectDefaults +framework: + name: OpenUI5 + version: "1.76.0" +`, "writeFile should be called with expected content"); +}); + test.serial("Should update first document", async (t) => { t.context.fsReadFileStub.resolves(` specVersion: "2.0"