From ba9da2e5325ef1bc73b0e14d26ba2f10eb6ff9f8 Mon Sep 17 00:00:00 2001 From: Merlin Beutlberger Date: Mon, 24 Jun 2019 14:34:03 +0200 Subject: [PATCH 1/3] [FIX] manifestCreator: Only consider component files called Component.js In the past files called *Component.js where also considered as Components during manifest creation. --- lib/processors/manifestCreator.js | 2 +- .../dest/resources/library/h/components/Component-preload.js | 5 +++++ .../dest/resources/library/h/components/TodoComponent.js | 4 ++++ .../library.h/main/src/library/h/components/TodoComponent.js | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/expected/build/library.h/dest/resources/library/h/components/TodoComponent.js create mode 100644 test/fixtures/library.h/main/src/library/h/components/TodoComponent.js diff --git a/lib/processors/manifestCreator.js b/lib/processors/manifestCreator.js index 94c0ac569..7862bc1c0 100644 --- a/lib/processors/manifestCreator.js +++ b/lib/processors/manifestCreator.js @@ -159,7 +159,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in function findComponentPaths() { const result = []; const prefix = libraryResource.getPath().slice(0, - ".library".length); - const components = libBundle.getResources(/(?:[^/]+\/)*Component\.js$/); + const components = libBundle.getResources(/^(?:[^/]*\/)*Component\.js$/); components.forEach((comp) => { const relativePath = comp.getPath().slice(prefix.length); if ( relativePath.lastIndexOf("/") >= 0 ) { diff --git a/test/expected/build/library.h/dest/resources/library/h/components/Component-preload.js b/test/expected/build/library.h/dest/resources/library/h/components/Component-preload.js index e9e309179..7b5db6460 100644 --- a/test/expected/build/library.h/dest/resources/library/h/components/Component-preload.js +++ b/test/expected/build/library.h/dest/resources/library/h/components/Component-preload.js @@ -1,4 +1,9 @@ sap.ui.require.preload({ "library/h/components/Component.js":function(){sap.ui.define(["sap/ui/core/UIComponent"],function(n){"use strict";return n.extend("application.g.Component",{})}); +}, + "library/h/components/TodoComponent.js":function(){/*! + * Some fancy copyright + */ +console.log(" File "); } }); diff --git a/test/expected/build/library.h/dest/resources/library/h/components/TodoComponent.js b/test/expected/build/library.h/dest/resources/library/h/components/TodoComponent.js new file mode 100644 index 000000000..bcf866e67 --- /dev/null +++ b/test/expected/build/library.h/dest/resources/library/h/components/TodoComponent.js @@ -0,0 +1,4 @@ +/*! + * Some fancy copyright + */ +console.log(" File "); \ No newline at end of file diff --git a/test/fixtures/library.h/main/src/library/h/components/TodoComponent.js b/test/fixtures/library.h/main/src/library/h/components/TodoComponent.js new file mode 100644 index 000000000..c38081004 --- /dev/null +++ b/test/fixtures/library.h/main/src/library/h/components/TodoComponent.js @@ -0,0 +1,4 @@ +/*! + * ${copyright} + */ +console.log(' File '); From 4a967761c212545c972905da54649c3650d87199 Mon Sep 17 00:00:00 2001 From: Frank Weigel Date: Fri, 20 Sep 2019 00:07:58 +0200 Subject: [PATCH 2/3] Improve RegExp: expect leading slash, do not accept empty path segments --- lib/processors/manifestCreator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/processors/manifestCreator.js b/lib/processors/manifestCreator.js index 7862bc1c0..d8041d4b9 100644 --- a/lib/processors/manifestCreator.js +++ b/lib/processors/manifestCreator.js @@ -159,7 +159,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in function findComponentPaths() { const result = []; const prefix = libraryResource.getPath().slice(0, - ".library".length); - const components = libBundle.getResources(/^(?:[^/]*\/)*Component\.js$/); + const components = libBundle.getResources(/^/(?:[^/]+\/)*Component\.js$/); components.forEach((comp) => { const relativePath = comp.getPath().slice(prefix.length); if ( relativePath.lastIndexOf("/") >= 0 ) { From 2e3149aa3d08d2e468d2ae9014115f1ac8aa95fe Mon Sep 17 00:00:00 2001 From: Frank Weigel Date: Fri, 20 Sep 2019 00:12:26 +0200 Subject: [PATCH 3/3] without words... --- lib/processors/manifestCreator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/processors/manifestCreator.js b/lib/processors/manifestCreator.js index d8041d4b9..4551af927 100644 --- a/lib/processors/manifestCreator.js +++ b/lib/processors/manifestCreator.js @@ -159,7 +159,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in function findComponentPaths() { const result = []; const prefix = libraryResource.getPath().slice(0, - ".library".length); - const components = libBundle.getResources(/^/(?:[^/]+\/)*Component\.js$/); + const components = libBundle.getResources(/^\/(?:[^/]+\/)*Component\.js$/); components.forEach((comp) => { const relativePath = comp.getPath().slice(prefix.length); if ( relativePath.lastIndexOf("/") >= 0 ) {