This repository was archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
46 lines (42 loc) · 1.28 KB
/
main.ts
File metadata and controls
46 lines (42 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import '~/styles/main.css'
import 'virtual:windi.css'
import 'virtual:windi-devtools'
import 'virtual:pinecone-update'
import { addRoutes } from 'virtual:pinecone-routes'
import '@purge-icons/generated'
import { component, addTitles } from '@leanadmin/alpine-typescript'
import { router } from '~/core/router'
router()
window.addRoutes = addRoutes
// import modules
Object.values(import.meta.globEager('./modules/*.{js,ts}')).map(m =>
m.default(),
)
// register components
Object.entries(import.meta.globEager('./components/*.{js,ts}')).map(
([file, value]) => {
// @ts-ignore
const name = file.replace(/\.\/components\/(.*[/])?([^/].+[^/])\.(js|ts)/gmi, '$2')
component(name, value.default)
return true
},
);
// import dependencies
(async() => {
// import plugins before alpine
// @ts-ignore
await import('alpine-magic-helpers')
// @ts-ignore
await import('@ryangjchandler/alpine-clipboard')
// @ts-ignore
await import('@ryangjchandler/alpine-toggle')
// @ts-ignore
await import('@ryangjchandler/x-else')
addRoutes()
await import('pinecone-router-middleware-views')
await import('pinecone-router')
// import alpinejs
await import('alpinejs')
// this will add 'x-title' attributes to all components, must be imported after alpinejs.
addTitles()
})()