Avoid unnecessary api calls in balena build and balena deploy

Change-type: patch
This commit is contained in:
Pagan Gazzard
2020-05-01 15:58:44 +01:00
parent 597b894917
commit 2f24e591ef
3 changed files with 11 additions and 36 deletions

View File

@ -143,9 +143,9 @@ export async function osProgressHandler(step: InitializeEmitter) {
});
}
export function getArchAndDeviceType(
export function getAppWithArch(
applicationName: string,
): Bluebird<{ arch: string; device_type: string }> {
): Bluebird<BalenaSdk.Application & { arch: string }> {
return Bluebird.join(
getApplication(applicationName),
getBalenaSdk().models.config.getDeviceTypes(),
@ -158,12 +158,12 @@ export function getArchAndDeviceType(
throw new Error('Could not read application information!');
}
return { device_type: app.device_type, arch: config.arch };
return { ...app, arch: config.arch };
},
);
}
export function getApplication(applicationName: string) {
function getApplication(applicationName: string) {
// Check for an app of the form `user/application`, and send
// that off to a special handler (before importing any modules)
const match = applicationName.split('/');