Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INTERNAL] LibraryFormatter namespace detection: Add exception for SAP theme libraries #437

Merged
merged 1 commit into from
Mar 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/types/library/LibraryFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const glob = require("globby");
const slash = require("slash");
const AbstractUi5Formatter = require("../AbstractUi5Formatter");

const SAP_THEMES_NS_WHITELIST = ["themelib_sap_fiori_3", "themelib_sap_bluecrystal", "themelib_sap_belize"];

class LibraryFormatter extends AbstractUi5Formatter {
/**
Expand All @@ -31,7 +32,20 @@ class LibraryFormatter extends AbstractUi5Formatter {
"Either no setting was provided or the path not found.");
}

project.metadata.namespace = await this.getNamespace();
try {
project.metadata.namespace = await this.getNamespace();
} catch (err) {
if (SAP_THEMES_NS_WHITELIST.includes(this._project.metadata.name)) {
// Exceptional handling for SAP theme libraries which used to be of type "library"
// (today they use "theme-library").
// To allow use of OpenUI5 theme libraries in versions lower than 1.75 we must ignore
// namespace detection errors.
log.verbose(`Ignoring failed namespace detection for whitelisted SAP theme library ` +
`${this._project.metadata.name}: ${err.message}`);
} else {
throw err;
}
}

try {
project.metadata.copyright = await this.getCopyright();
Expand Down