text: const bel = require('bel')
  const csjs = require('csjs-inject')
  // widgets
  const Graphic = require('Graphic')
  
  function updateApp(packages, app) {
      let css = style
      let appName = app.title.split(' ').join('').toLowerCase()
      let dashName = app.title.split(' ').join('-').toLowerCase()
      // elements
      let el = document.querySelector(`.${appName}`)
      let appicon = el.querySelector('[class^="icon"]')
      let name = el.querySelector('[class^="app-name"]')
  
      packages.map( package => {
          if ( package.path.includes(appName) ||  package.path.includes(dashName) ) {
              package.status = app.status
              // set package url
              let url = `${app.link}/dist/${app.status.app.version}`
              // set new icon
              let icon = package.status.app.data.icon
              
              if ( icon.includes('svg') ) {
                  var newicon = Graphic(`${url}/${icon}`, css.icon)
              } else {
                  var newicon = bel`<div class=${css.icon}><img src="${url}/${icon}"></div>`
              }
              // remove install icon
              appicon.remove()
              // update app icon
              el.insertBefore(newicon, el.firstChild)
               // update app name
              name.innerHTML = app.title
          }
  
          return package
      })
  
     
  
  }
  
  let style = csjs`
  .icon {
      width: 60px;
  }
  `
  
  module.exports = updateApp