diff --git a/lib/proxyConfiguration.js b/lib/proxyConfiguration.js index caaf0bae..dbf578a2 100644 --- a/lib/proxyConfiguration.js +++ b/lib/proxyConfiguration.js @@ -19,7 +19,7 @@ function addConfiguration(name, proxyConfig) { proxyConfigurations[name] = proxyConfig; } -async function getConfigurationForProject(project) { +async function getConfigurationForProject(tree) { const configNames = Object.keys(proxyConfigurations); if (configNames.length === 0) { throw new Error(`No proxy configurations have been added yet`); @@ -29,7 +29,7 @@ async function getConfigurationForProject(project) { `This is not yet supported.`); // TODO } - log.verbose(`Applying proxy configuration ${configNames[0]} to project ${project.metadata.name}...`); + log.verbose(`Applying proxy configuration ${configNames[0]} to project ${tree.metadata.name}...`); const config = JSON.parse(JSON.stringify(proxyConfigurations[configNames[0]])); config.rewriteRootPaths = {}; @@ -40,15 +40,15 @@ async function getConfigurationForProject(project) { }; } - mapProjectDependencies(project, (proj) => { - if (proj.specVersion !== "1.1a") { - log.warn(`Project ${project.metadata.name} defines specification version ${proj.specVersion}. ` + + mapProjectDependencies(tree, (project) => { + if (project.specVersion !== "1.1a") { + log.warn(`Project ${project.metadata.name} defines specification version ${project.specVersion}. ` + `Some proxy configuration features require projects to define specification version 1.1a`); } - log.verbose(`Using ABAP URI ${proj.metadata.abapUri} from metadata of project ${proj.metadata.name}`); + log.verbose(`Using ABAP URI ${project.metadata.abapUri} from metadata of project ${project.metadata.name}`); let prefix = ""; - if (proj.type !== "application") { - if (project.resources.pathMappings["/resources"]) { + if (project.type !== "application") { + if (project.resources.pathMappings["/resources/"]) { // If the project defines a /resources path mapping, // we expect this to match the ABAP URI deployment path prefix += "/resources/"; @@ -56,16 +56,16 @@ async function getConfigurationForProject(project) { // If this is not an application and there is no /resources path mapping, somebody does something wild // and hopefully knows what he/she does } - prefix += proj.metadata.namespace; + prefix += project.metadata.namespace; } - config.rewriteRootPaths[proj.metadata.abapUri] = { + config.rewriteRootPaths[project.metadata.abapUri] = { rewriteTo: prefix }; }); if (log.isLevelEnabled("verbose")) { - log.verbose(`Configured ${config.rewriteRootPaths.length} root paths to rewrite for ` + - `project ${project.metadata.name};`); + log.verbose(`Configured ${Object.keys(config.rewriteRootPaths).length} root paths to rewrite for ` + + `project ${tree.metadata.name};`); for (const abapUri in config.rewriteRootPaths) { if (config.rewriteRootPaths.hasOwnProperty(abapUri)) { if (config.rewriteRootPaths[abapUri].rewriteTo) { diff --git a/package-lock.json b/package-lock.json index 1ce7d7d6..e9f76678 100644 --- a/package-lock.json +++ b/package-lock.json @@ -525,26 +525,26 @@ "from": "github:SAP/ui5-builder#feature-proxy", "requires": { "@ui5/fs": "^1.1.2", - "@ui5/logger": "^1.0.1", + "@ui5/logger": "^1.0.2", "cheerio": "^0.22.0", "escape-unicode": "^0.2.0", - "escodegen": "^1.11.1", + "escodegen": "^1.12.0", "escope": "^3.6.0", "esprima": "^4.0.1", - "estraverse": "^4.2.0", + "estraverse": "^4.3.0", "globby": "^10.0.1", - "graceful-fs": "^4.2.0", - "jsdoc": "3.5.5", - "less-openui5": "^0.6.0", + "graceful-fs": "^4.2.3", + "jsdoc": "~3.6.3", + "less-openui5": "^0.8.1", "make-dir": "^3.0.0", "pretty-data": "^0.40.0", "pretty-hrtime": "^1.0.3", "replacestream": "^4.0.3", - "rimraf": "^2.6.3", + "rimraf": "^3.0.0", "semver": "^6.3.0", "slash": "^3.0.0", - "terser": "^4.1.3", - "xml2js": "^0.4.17", + "terser": "^4.4.2", + "xml2js": "^0.4.22", "yazl": "^2.5.1" }, "dependencies": {