Skip to content

Commit 047195d

Browse files
committed
proxyConfiguration: Fix library rewrite path mapping
1 parent a541d67 commit 047195d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/proxyConfiguration.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function addConfiguration(name, proxyConfig) {
1919
proxyConfigurations[name] = proxyConfig;
2020
}
2121

22-
async function getConfigurationForProject(project) {
22+
async function getConfigurationForProject(tree) {
2323
const configNames = Object.keys(proxyConfigurations);
2424
if (configNames.length === 0) {
2525
throw new Error(`No proxy configurations have been added yet`);
@@ -29,7 +29,7 @@ async function getConfigurationForProject(project) {
2929
`This is not yet supported.`); // TODO
3030
}
3131

32-
log.verbose(`Applying proxy configuration ${configNames[0]} to project ${project.metadata.name}...`);
32+
log.verbose(`Applying proxy configuration ${configNames[0]} to project ${tree.metadata.name}...`);
3333
const config = JSON.parse(JSON.stringify(proxyConfigurations[configNames[0]]));
3434
config.rewriteRootPaths = {};
3535

@@ -40,32 +40,32 @@ async function getConfigurationForProject(project) {
4040
};
4141
}
4242

43-
mapProjectDependencies(project, (proj) => {
44-
if (proj.specVersion !== "1.1a") {
45-
log.warn(`Project ${project.metadata.name} defines specification version ${proj.specVersion}. ` +
43+
mapProjectDependencies(tree, (project) => {
44+
if (project.specVersion !== "1.1a") {
45+
log.warn(`Project ${project.metadata.name} defines specification version ${project.specVersion}. ` +
4646
`Some proxy configuration features require projects to define specification version 1.1a`);
4747
}
48-
log.verbose(`Using ABAP URI ${proj.metadata.abapUri} from metadata of project ${proj.metadata.name}`);
48+
log.verbose(`Using ABAP URI ${project.metadata.abapUri} from metadata of project ${project.metadata.name}`);
4949
let prefix = "";
50-
if (proj.type !== "application") {
51-
if (project.resources.pathMappings["/resources"]) {
50+
if (project.type !== "application") {
51+
if (project.resources.pathMappings["/resources/"]) {
5252
// If the project defines a /resources path mapping,
5353
// we expect this to match the ABAP URI deployment path
5454
prefix += "/resources/";
5555

5656
// If this is not an application and there is no /resources path mapping, somebody does something wild
5757
// and hopefully knows what he/she does
5858
}
59-
prefix += proj.metadata.namespace;
59+
prefix += project.metadata.namespace;
6060
}
61-
config.rewriteRootPaths[proj.metadata.abapUri] = {
61+
config.rewriteRootPaths[project.metadata.abapUri] = {
6262
rewriteTo: prefix
6363
};
6464
});
6565

6666
if (log.isLevelEnabled("verbose")) {
67-
log.verbose(`Configured ${config.rewriteRootPaths.length} root paths to rewrite for ` +
68-
`project ${project.metadata.name};`);
67+
log.verbose(`Configured ${Object.keys(config.rewriteRootPaths).length} root paths to rewrite for ` +
68+
`project ${tree.metadata.name};`);
6969
for (const abapUri in config.rewriteRootPaths) {
7070
if (config.rewriteRootPaths.hasOwnProperty(abapUri)) {
7171
if (config.rewriteRootPaths[abapUri].rewriteTo) {

0 commit comments

Comments
 (0)