From 0998e1e9e4a0ed1f18827a864d24d9ca4ab4ed69 Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Thu, 10 Mar 2022 12:25:24 +0100 Subject: [PATCH] [INTERNAL] replaceVersion: Also process css files Follow-up of https://github.com/SAP/ui5-builder/pull/693 There are use cases for a version placeholder in *.css files. This also adds some basic tests for placeholder replacements during a library build. --- lib/types/library/LibraryBuilder.js | 2 +- .../build/library.e/dest/resources/library/e/library-dbg.js | 2 ++ .../build/library.e/dest/test-resources/library/e/Test.css | 6 ++++++ .../build/library.e/dest/test-resources/library/e/Test.html | 6 ++++++ .../build/library.e/dest/test-resources/library/e/Test.js | 6 ++++++ test/fixtures/library.e/src/library/e/library.js | 2 ++ test/fixtures/library.e/src/library/e/manifest.json | 2 +- test/fixtures/library.e/test/library/e/Test.css | 4 ++++ test/fixtures/library.e/test/library/e/Test.html | 4 ++++ test/fixtures/library.e/test/library/e/Test.js | 4 ++++ 10 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 test/expected/build/library.e/dest/test-resources/library/e/Test.css create mode 100644 test/expected/build/library.e/dest/test-resources/library/e/Test.js create mode 100644 test/fixtures/library.e/test/library/e/Test.css create mode 100644 test/fixtures/library.e/test/library/e/Test.js diff --git a/lib/types/library/LibraryBuilder.js b/lib/types/library/LibraryBuilder.js index 031bad706..13e322217 100644 --- a/lib/types/library/LibraryBuilder.js +++ b/lib/types/library/LibraryBuilder.js @@ -38,7 +38,7 @@ class LibraryBuilder extends AbstractBuilder { workspace: resourceCollections.workspace, options: { version: project.version, - pattern: "/**/*.{js,json,library,less,theme,html}" + pattern: "/**/*.{js,json,library,css,less,theme,html}" } }); }); diff --git a/test/expected/build/library.e/dest/resources/library/e/library-dbg.js b/test/expected/build/library.e/dest/resources/library/e/library-dbg.js index 653942f85..e45381daf 100644 --- a/test/expected/build/library.e/dest/resources/library/e/library-dbg.js +++ b/test/expected/build/library.e/dest/resources/library/e/library-dbg.js @@ -4,3 +4,5 @@ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ console.log('HelloWorld'); + +// 1.0.0 diff --git a/test/expected/build/library.e/dest/test-resources/library/e/Test.css b/test/expected/build/library.e/dest/test-resources/library/e/Test.css new file mode 100644 index 000000000..0c074af62 --- /dev/null +++ b/test/expected/build/library.e/dest/test-resources/library/e/Test.css @@ -0,0 +1,6 @@ +/* +UI development toolkit for HTML5 (OpenUI5) + * (c) Copyright 2009-xxx SAP SE or an SAP affiliate company. + * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. +1.0.0 +*/ diff --git a/test/expected/build/library.e/dest/test-resources/library/e/Test.html b/test/expected/build/library.e/dest/test-resources/library/e/Test.html index e69de29bb..5a1a4014b 100644 --- a/test/expected/build/library.e/dest/test-resources/library/e/Test.html +++ b/test/expected/build/library.e/dest/test-resources/library/e/Test.html @@ -0,0 +1,6 @@ + diff --git a/test/expected/build/library.e/dest/test-resources/library/e/Test.js b/test/expected/build/library.e/dest/test-resources/library/e/Test.js new file mode 100644 index 000000000..0c074af62 --- /dev/null +++ b/test/expected/build/library.e/dest/test-resources/library/e/Test.js @@ -0,0 +1,6 @@ +/* +UI development toolkit for HTML5 (OpenUI5) + * (c) Copyright 2009-xxx SAP SE or an SAP affiliate company. + * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. +1.0.0 +*/ diff --git a/test/fixtures/library.e/src/library/e/library.js b/test/fixtures/library.e/src/library/e/library.js index 719155d1e..e6676c815 100644 --- a/test/fixtures/library.e/src/library/e/library.js +++ b/test/fixtures/library.e/src/library/e/library.js @@ -2,3 +2,5 @@ * ${copyright} */ console.log('HelloWorld'); + +// ${version} diff --git a/test/fixtures/library.e/src/library/e/manifest.json b/test/fixtures/library.e/src/library/e/manifest.json index 6ff551fd1..01221dedc 100644 --- a/test/fixtures/library.e/src/library/e/manifest.json +++ b/test/fixtures/library.e/src/library/e/manifest.json @@ -5,7 +5,7 @@ "type": "library", "embeds": [], "applicationVersion": { - "version": "1.0.0" + "version": "${version}" }, "title": "Library E", "description": "Library E", diff --git a/test/fixtures/library.e/test/library/e/Test.css b/test/fixtures/library.e/test/library/e/Test.css new file mode 100644 index 000000000..3f46b4c60 --- /dev/null +++ b/test/fixtures/library.e/test/library/e/Test.css @@ -0,0 +1,4 @@ +/* +${copyright} +${version} +*/ diff --git a/test/fixtures/library.e/test/library/e/Test.html b/test/fixtures/library.e/test/library/e/Test.html index e69de29bb..be546dc05 100644 --- a/test/fixtures/library.e/test/library/e/Test.html +++ b/test/fixtures/library.e/test/library/e/Test.html @@ -0,0 +1,4 @@ + diff --git a/test/fixtures/library.e/test/library/e/Test.js b/test/fixtures/library.e/test/library/e/Test.js new file mode 100644 index 000000000..3f46b4c60 --- /dev/null +++ b/test/fixtures/library.e/test/library/e/Test.js @@ -0,0 +1,4 @@ +/* +${copyright} +${version} +*/