Comparing version 2.0.3 to 2.0.4
@@ -140,12 +140,24 @@ var fs = require('fs'); | ||
} | ||
var headerRequest = { uri: repoComponents+comp.files[filesDownloaded], rejectUnauthorized: false } | ||
var headerRequest = { uri: repoComponents+comp.files[filesDownloaded], rejectUnauthorized: false, download: true } | ||
request(headerRequest, function (err, response, body) { | ||
fs.writeFileSync("."+folder+"/mobileui/"+comp.files[filesDownloaded], response.data); | ||
filesDownloaded++; | ||
if(totalFiles === filesDownloaded) { | ||
console.log("> Files dependencies downloaded".grey) | ||
callback(); | ||
} else { | ||
download(); | ||
} | ||
response.data.pipe(fs.createWriteStream("."+folder+"/mobileui/"+comp.files[filesDownloaded])) | ||
.on('close', function (err) { | ||
filesDownloaded++; | ||
if(totalFiles === filesDownloaded) { | ||
console.log("> Files dependencies downloaded".grey) | ||
callback(); | ||
} else { | ||
download(); | ||
} | ||
}) | ||
// fs.writeFileSync("."+folder+"/mobileui/"+comp.files[filesDownloaded], response.data); | ||
// filesDownloaded++; | ||
// if(totalFiles === filesDownloaded) { | ||
// console.log("> Files dependencies downloaded".grey) | ||
// callback(); | ||
// } else { | ||
// download(); | ||
// } | ||
}) | ||
@@ -152,0 +164,0 @@ |
@@ -95,2 +95,3 @@ var fs = require('fs'); | ||
}, | ||
download: true, | ||
encoding: null | ||
@@ -100,22 +101,28 @@ }; | ||
if (!error && response.statusCode == 200) { | ||
fs.writeFile(dirFileFont+"/"+newLink, body, function(err) { | ||
if(err) { | ||
return console.log(err); | ||
} | ||
console.log(" SUCCESS: ".bgGreen,"Font "+newLink+" installed success!") | ||
cssString = cssString.replace(link, "./fonts/"+newLink); | ||
if(cssString.indexOf('url(https') < 0){ | ||
fs.writeFile(nameCssFont, cssString, function(err) { | ||
if(err) { | ||
console.log(" ERROR: ".bgRed, "Could not install font.") | ||
return console.log(err); | ||
} | ||
var msg = "> Create css file: "+nameCssFont; | ||
console.log(msg.grey) | ||
self.posScript(); | ||
}); | ||
} else { | ||
self.checkAndDownloadFont(cssString, nameFont); | ||
} | ||
}); | ||
response.data.pipe(fs.createWriteStream(dirFileFont+"/"+newLink)) | ||
.on('close', function (err) { | ||
if(err) { | ||
return console.log(err); | ||
} | ||
console.log(" SUCCESS: ".bgGreen,"Font "+newLink+" installed success!") | ||
cssString = cssString.replace(link, "./fonts/"+newLink); | ||
if(cssString.indexOf('url(https') < 0){ | ||
fs.writeFile(nameCssFont, cssString, function(err) { | ||
if(err) { | ||
console.log(" ERROR: ".bgRed, "Could not install font.") | ||
return console.log(err); | ||
} | ||
var msg = "> Create css file: "+nameCssFont; | ||
console.log(msg.grey) | ||
self.posScript(); | ||
}); | ||
} else { | ||
self.checkAndDownloadFont(cssString, nameFont); | ||
} | ||
}) | ||
// fs.writeFile(dirFileFont+"/"+newLink, body, function(err) { | ||
// }); | ||
} else { | ||
@@ -122,0 +129,0 @@ if(response.statusCode == 404){ |
const axios = require('axios'); | ||
module.exports = function (options, callback) { | ||
var axiosGet = axios.get(options.uri || options.url) | ||
if(!options.download) { | ||
axios.get(options.uri || options.url).then(function(response) { | ||
response.statusCode = response.status | ||
callback(null, response, response.data) | ||
}) | ||
.catch(function (error) { | ||
callback(error) | ||
}) | ||
} else { | ||
axios({ | ||
method: 'get', | ||
url: options.uri || options.url, | ||
responseType: 'stream' | ||
}).then(function (response) { | ||
response.statusCode = response.status | ||
callback(null, response, response.data) | ||
}).catch(function (error) { | ||
callback(error) | ||
}) | ||
} | ||
// if(options.headers) { | ||
// var axiosGet = axios.get(options.uri, { | ||
// headers: options.headers | ||
// }) | ||
// } | ||
axiosGet.then(function(response) { | ||
response.statusCode = response.status | ||
callback(null, response, response.data) | ||
}) | ||
.catch(function (error) { | ||
callback(error) | ||
}) | ||
} |
{ | ||
"name": "mobileui", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "MobileUI is a simple and easy NPM package to install UI Components for web mobile apps using HTML, CSS and JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "./bin/mobileui", |
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
59965
877