grunt-sapui5-gitlab-deploy
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "grunt-sapui5-gitlab-deploy", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Deploy UI5 resources to ABAP system directly from Gitlab", | ||
@@ -22,4 +22,5 @@ "main": "index.js", | ||
"gitlab": "^4.2.1", | ||
"node-fetch": "^2.2.0" | ||
"node-fetch": "^2.2.0", | ||
"xml-js": "^1.6.8" | ||
} | ||
} |
// fetch polyfill | ||
const nodeFetch = require("node-fetch"); | ||
// cookie decorator | ||
// cookie decorator | ||
const fetch = require("fetch-cookie")(nodeFetch); | ||
@@ -8,8 +8,9 @@ // Gitlab API client | ||
const convert = require("xml-js"); | ||
module.exports = function(grunt) { | ||
"use strict"; | ||
// deploy from gitlab to ABAP | ||
grunt.registerTask("gitlab_deploy", async function() { | ||
// must be async | ||
@@ -19,3 +20,2 @@ let done = this.async(); | ||
try { | ||
// Instantiating the API | ||
@@ -45,3 +45,5 @@ const api = new Gitlab({ | ||
// deploy to ABAP ( sending artifact URL to a backend ) | ||
await deployToABAP(sUrl); | ||
let oResponse = await deployToABAP(sUrl); | ||
let sResponseXML = await oResponse.text(); | ||
printOdataResponse(sResponseXML); | ||
} catch (error) { | ||
@@ -54,2 +56,29 @@ grunt.log.error(error); | ||
function printOdataResponse(sResponseXML) { | ||
let oReply = Object.assign( | ||
{ | ||
error: { | ||
message: {}, | ||
innererror: { errordetails: { errordetail: [] } } | ||
} | ||
}, | ||
convert.xml2js(sResponseXML, { compact: true }) | ||
); | ||
oReply.error.innererror.errordetails.errordetail.forEach(oError => { | ||
let sMessage = oError.message._text; | ||
switch (oError.severity._text) { | ||
case "error": | ||
grunt.log.error(sMessage); | ||
break; | ||
default: | ||
grunt.log.writeln(sMessage); | ||
break; | ||
} | ||
}); | ||
if (oReply.error.message._text) { | ||
grunt.fail.fatal(oReply.error.message._text); | ||
} | ||
} | ||
async function deployToABAP(sUrl) { | ||
@@ -56,0 +85,0 @@ const base_auth = "Basic " + process.env.ABAP_BASIC_TOKEN; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3888
95
4
+ Addedxml-js@^1.6.8
+ Addedsax@1.4.1(transitive)
+ Addedxml-js@1.6.11(transitive)