apploader.js now installs dependencies

pull/2494/head
Gordon Williams 2023-01-12 11:49:52 +00:00
parent 4a628dddbf
commit 8bfbffffe5
1 changed files with 21 additions and 2 deletions

View File

@ -22,6 +22,7 @@ global.Const = {
};
var apps = [];
var device = { id : DEVICEID, appsInstalled : [] };
// call with {DEVICEID:"BANGLEJS/BANGLEJS2"}
exports.init = function(options) {
@ -67,10 +68,28 @@ function fileGetter(url) {
}
exports.getAppFiles = function(app) {
return AppInfo.getFiles(app, {
var allFiles = [];
var uploadOptions = {
apps : apps,
needsApp : app => {
if (app.provides_modules) {
if (!app.files) app.files="";
app.files = app.files.split(",").concat(app.provides_modules).join(",");
}
return AppInfo.getFiles(app, {
fileGetter:fileGetter,
settings : SETTINGS,
device : { id : DEVICEID }
}).then(files => { allFiles = allFiles.concat(files); return app; });
}
};
return AppInfo.checkDependencies(app, device, uploadOptions).then(() => AppInfo.getFiles(app, {
fileGetter:fileGetter,
settings : SETTINGS,
device : { id : DEVICEID }
device : device
})).then(files => {
allFiles = allFiles.concat(files);
return allFiles;
});
};