New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ui5/builder

Package Overview
Dependencies
Maintainers
4
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ui5/builder - npm Package Compare versions

Comparing version 2.4.5 to 2.5.0

12

CHANGELOG.md

@@ -5,4 +5,13 @@ # Changelog

A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.4.5...HEAD).
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v2.5.0...HEAD).
<a name="v2.5.0"></a>
## [v2.5.0] - 2020-12-14
### Bug Fixes
- **manifestCreator:** Add component path to error logs [`049b9ee`](https://github.com/SAP/ui5-builder/commit/049b9ee22f8bf6c1bb41f9ba32be65a8fce38f23)
### Features
- **ApplicationFormatter:** Implement manifest.appdescr_variant fallback ([#545](https://github.com/SAP/ui5-builder/issues/545)) [`6d44481`](https://github.com/SAP/ui5-builder/commit/6d44481ad3668758d4c008d28b11cb47ca6bbee1)
<a name="v2.4.5"></a>

@@ -477,2 +486,3 @@ ## [v2.4.5] - 2020-11-30

[v2.5.0]: https://github.com/SAP/ui5-builder/compare/v2.4.5...v2.5.0
[v2.4.5]: https://github.com/SAP/ui5-builder/compare/v2.4.4...v2.4.5

@@ -479,0 +489,0 @@ [v2.4.4]: https://github.com/SAP/ui5-builder/compare/v2.4.3...v2.4.4

@@ -40,2 +40,5 @@ const log = require("@ui5/logger").getLogger("builder:processors:bundlers:flexChangesBundler");

changesContent.forEach(function(content) {
if (content.layer === "VENDOR") {
content.support.user = "SAP";
}
switch (content.fileType) {

@@ -42,0 +45,0 @@ case "change":

8

lib/processors/manifestCreator.js

@@ -188,4 +188,4 @@ "use strict";

log.error(
" component's property 'sap.app/embeddedBy' is of type '%s' (expected 'string'), " +
"it won't be listed as 'embedded'", typeof embeddedBy
" component '%s': property 'sap.app/embeddedBy' is of type '%s' (expected 'string'), " +
"it won't be listed as 'embedded'", componentPath, typeof embeddedBy
);

@@ -196,4 +196,4 @@ return false;

log.error(
" component's property 'sap.app/embeddedBy' has an empty string value (which is invalid), " +
"it won't be listed as 'embedded'"
" component '%s': property 'sap.app/embeddedBy' has an empty string value (which is invalid), " +
"it won't be listed as 'embedded'", componentPath
);

@@ -200,0 +200,0 @@ return false;

@@ -11,2 +11,12 @@ const log = require("@ui5/logger").getLogger("types:application:ApplicationFormatter");

/**
* Constructor
*
* @param {object} parameters
* @param {object} parameters.project Project
*/
constructor(parameters) {
super(parameters);
this._pManifests = {};
}
/**
* Formats and validates the project

@@ -45,2 +55,35 @@ *

/**
* Determine application namespace either based on a project`s
* manifest.json or manifest.appdescr_variant (fallback if present)
*
* @returns {string} Namespace of the project
* @throws {Error} if namespace can not be determined
*/
async getNamespace() {
try {
return await this.getNamespaceFromManifestJson();
} catch (manifestJsonError) {
if (manifestJsonError.code !== "ENOENT") {
throw manifestJsonError;
}
// No manifest.json present
// => attempt fallback to manifest.appdescr_variant (typical for App Variants)
try {
return await this.getNamespaceFromManifestAppDescVariant();
} catch (appDescVarError) {
if (appDescVarError.code === "ENOENT") {
// Fallback not possible: No manifest.appdescr_variant present
// => Throw error indicating missing manifest.json
// (do not mention manifest.appdescr_variant since it is only
// relevant for the rather "uncommon" App Variants)
throw new Error(
`Could not find required manifest.json for project ` +
`${this._project.metadata.name}: ${manifestJsonError.message}`);
}
throw appDescVarError;
}
}
}
/**
* Determine application namespace by checking manifest.json.

@@ -52,4 +95,4 @@ * Any maven placeholders are resolved from the projects pom.xml

*/
async getNamespace() {
const {content: manifest} = await this.getManifest();
async getNamespaceFromManifestJson() {
const {content: manifest} = await this.getJson("manifest.json");
let appId;

@@ -73,3 +116,4 @@ // check for a proper sap.app/id in manifest.json to determine namespace

const namespace = appId.replace(/\./g, "/");
log.verbose(`Namespace of project ${this._project.metadata.name} is ${namespace}`);
log.verbose(
`Namespace of project ${this._project.metadata.name} is ${namespace} (from manifest.appdescr_variant)`);
return namespace;

@@ -79,13 +123,37 @@ }

/**
* Reads the projects manifest.json
* Determine application namespace by checking manifest.appdescr_variant.
*
* @returns {string} Namespace of the project
* @throws {Error} if namespace can not be determined
*/
async getNamespaceFromManifestAppDescVariant() {
const {content: manifest} = await this.getJson("manifest.appdescr_variant");
let appId;
// check for the id property in manifest.appdescr_variant to determine namespace
if (manifest && manifest.id) {
appId = manifest.id;
} else {
throw new Error(
`No "id" property found in manifest.appdescr_variant of project ${this._project.metadata.name}`);
}
const namespace = appId.replace(/\./g, "/");
log.verbose(
`Namespace of project ${this._project.metadata.name} is ${namespace} (from manifest.appdescr_variant)`);
return namespace;
}
/**
* Reads and parses a JSON file with the provided name from the projects source directory
*
* @param {string} fileName Name of the JSON file to read. Typically "manifest.json" or "manifest.appdescr_variant"
* @returns {Promise<object>} resolves with an object containing the <code>content</code> (as JSON) and
* <code>fsPath</code> (as string) of the manifest.json file
* <code>fsPath</code> (as string) of the requested file
*/
async getManifest() {
if (this._pManifest) {
return this._pManifest;
async getJson(fileName) {
if (this._pManifests[fileName]) {
return this._pManifests[fileName];
}
const fsPath = path.join(this.getSourceBasePath(), "manifest.json");
return this._pManifest = readFile(fsPath)
const fsPath = path.join(this.getSourceBasePath(), fileName);
return this._pManifests[fileName] = readFile(fsPath)
.then((content) => {

@@ -98,4 +166,8 @@ return {

.catch((err) => {
if (err.code === "ENOENT") {
throw err;
}
throw new Error(
`Failed to read manifest.json for project ${this._project.metadata.name}: ${err.message}`);
`Failed to read ${fileName} for project ` +
`${this._project.metadata.name}: ${err.message}`);
});

@@ -102,0 +174,0 @@ }

{
"name": "@ui5/builder",
"version": "2.4.5",
"version": "2.5.0",
"description": "UI5 Tooling - Builder",

@@ -124,3 +124,3 @@ "author": {

"rimraf": "^3.0.2",
"semver": "^7.3.2",
"semver": "^7.3.4",
"slash": "^3.0.0",

@@ -132,10 +132,10 @@ "terser": "^5.5.1",

"devDependencies": {
"ava": "^3.13.0",
"ava": "^3.14.0",
"chai": "^4.1.2",
"chai-fs": "^2.0.0",
"chokidar-cli": "^2.1.0",
"cross-env": "^7.0.2",
"cross-env": "^7.0.3",
"depcheck": "^1.3.1",
"docdash": "^1.2.0",
"eslint": "^7.14.0",
"eslint": "^7.15.0",
"eslint-config-google": "^0.14.0",

@@ -148,3 +148,3 @@ "eslint-plugin-jsdoc": "^30.7.8",

"recursive-readdir": "^2.1.1",
"sinon": "^9.2.1",
"sinon": "^9.2.2",
"tap-nyan": "^1.1.0",

@@ -151,0 +151,0 @@ "tap-xunit": "^2.4.1"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc