index.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { HOPP_MODULES } from "@modules/."
  2. import { createApp } from "vue"
  3. import { initializeApp } from "./helpers/app"
  4. import { initBackendGQLClient } from "./helpers/backend/GQLClient"
  5. import { performMigrations } from "./helpers/migrations"
  6. import { PlatformDef, setPlatformDef } from "./platform"
  7. import "../assets/scss/tailwind.scss"
  8. import "../assets/themes/themes.scss"
  9. import "../assets/scss/styles.scss"
  10. import "nprogress/nprogress.css"
  11. import "unfonts.css"
  12. import App from "./App.vue"
  13. import { getService } from "./modules/dioc"
  14. import { PersistenceService } from "./services/persistence"
  15. export function createHoppApp(el: string | Element, platformDef: PlatformDef) {
  16. setPlatformDef(platformDef)
  17. const app = createApp(App)
  18. // Some basic work that needs to be done before module inits even
  19. initBackendGQLClient()
  20. initializeApp()
  21. HOPP_MODULES.forEach((mod) => mod.onVueAppInit?.(app))
  22. platformDef.addedHoppModules?.forEach((mod) => mod.onVueAppInit?.(app))
  23. // TODO: Explore possibilities of moving this invocation to the service constructor
  24. // `toast` was coming up as `null` in the previous attempts
  25. getService(PersistenceService).setupLocalPersistence()
  26. performMigrations()
  27. app.mount(el)
  28. console.info(
  29. "%cWE ♥️ OPEN SOURCE",
  30. "margin:8px 0;font-family:sans-serif;font-weight:600;font-size:60px;color:violet;"
  31. )
  32. console.info(
  33. "%cContribute: https://github.com/hoppscotch/hoppscotch",
  34. "margin:8px 0;font-family:sans-serif;font-weight:500;font-size:24px;color:violet;"
  35. )
  36. }