Skip to content
Snippets Groups Projects
orbit-dependencies.pug 4.16 KiB
Newer Older
  if(!npm) {
    var npm = [];
  }
  const componentSet = new Set(components.map(c=>c.type));
  components.map(c => {
    if(c.extensions) {
      c.extensions.forEach(e => componentSet.add(e.type));
    }
  });
  //- Managing default versions
  if(componentSet.has("autoLogin") || componentSet.has("registering"))
    if(!npm.find(e => e.package == "@startinblox/oidc"))
      npm.unshift({
        "package": "@startinblox/oidc",
        "version": "0.16"
      })

  if(!npm.find(e => e.package == "@startinblox/router"))
      "package": "@startinblox/router",
      "version": "0.11"
    })
  if(!npm.find(e => e.package == "@startinblox/core"))
    npm.unshift({
      "package": "@startinblox/core",
      "version": "0.17"
    })
  if(componentSet.has("chat") || componentSet.has("circles") || componentSet.has("projects") || componentSet.has("spaces"))
    if(!npm.find(e => e.package == "@startinblox/component-chat"))
      npm.push({
        "package": "@startinblox/component-chat",
        "version": "6.4"
  if(componentSet.has("communities"))
    if(!npm.find(e => e.package == "@startinblox/component-communities"))
        "package": "@startinblox/component-communities",
        "version": "1.1"
  if(componentSet.has("dashboard"))
    if(!npm.find(e => e.package == "@startinblox/component-dashboard"))
      npm.push({
        "package": "@startinblox/component-dashboard",
  if(componentSet.has("directory"))
    if(!npm.find(e => e.package == "@startinblox/component-directory"))
      npm.push({
        "package": "@startinblox/component-directory",
        "version": "7.0"
  if(componentSet.has("events"))
    if(!npm.find(e => e.package == "@startinblox/component-event"))
      npm.push({
        "package": "@startinblox/component-event",
        "version": "4.1"
      })
  if(componentSet.has("events") || componentSet.has("polls") || componentSet.has("resources"))
    if(!npm.find(e => e.package == "@startinblox/component-conversation"))
      npm.push({
        "package": "@startinblox/component-conversation",
        "version": "0.11"
      })
  if(componentSet.has('invoices'))
    if(!npm.find(e => e.package == "@startinblox/component-invoicing"))
      npm.push({
        "package": "@startinblox/component-invoicing",
        "version": "1.4"
      })
  if(componentSet.has("job-board"))
    if(!npm.find(e => e.package == "@startinblox/component-job-board"))
      npm.push({
        "package": "@startinblox/component-job-board",
        "version": "6.4"
  if(componentSet.has("notification"))
    if(!npm.find(e => e.package == "@startinblox/component-notifications"))
      npm.push({
        "package": "@startinblox/component-notifications",
        "version": "0.14"
  if(componentSet.has("polls"))
    if(!npm.find(e => e.package == "@startinblox/component-poll"))
      npm.push({
        "package": "@startinblox/component-poll",
        "version": "^4.0.0-beta"
  if(componentSet.has("spaces")) {
    if(!npm.find(e => e.package == "@startinblox/component-spaces"))
      npm.push({
        "package": "@startinblox/component-spaces",
        "version": "1.0"
    if(!npm.find(e => e.package == "@startinblox/component-sales"))
      npm.push({
        "package": "@startinblox/component-sales",
        "version": "1.0"
      })
  }
  if(componentSet.has("resources"))
    if(!npm.find(e => e.package == "@startinblox/component-resource"))
      npm.push({
        "package": "@startinblox/component-resource",
        "version": "4.0"
      })

for dependency of npm
  if dependency.path
    script(type="module" src=dependency.path defer)&attributes(dependency.attributes || {})
  else
    script(type="module" src=`https://cdn.skypack.dev/${dependency.package}@${dependency.version}` defer)&attributes(dependency.attributes || {})
if componentSet.has("themeChecker")
  script(src="https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/pickr.min.js" defer)
  link(rel='stylesheet', href='https://cdn.jsdelivr.net/npm/@simonwep/pickr/dist/themes/nano.min.css')

- const orbitVersions = `window.orbit.npm = ${JSON.stringify(npm)};`;
script!=orbitVersions