diff --git a/components/Header.tsx b/components/Header.tsx index c72beda..ff2060d 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,8 +1,8 @@ import { asset } from '$fresh/runtime.ts' -import SearchBox from '../islands/SearchBox.tsx' -import ThemePicker from '../islands/ThemePicker.tsx' -import MoreBox from '../islands/MoreBox.tsx' -import AiChatBox from '../islands/AiChatBox.tsx' +import AiChatBox from ':islands/AiChatBox.tsx' +import MoreBox from ':islands/MoreBox.tsx' +import SearchBox from ':islands/SearchBox.tsx' +import ThemePicker from ':islands/ThemePicker.tsx' export function Header() { return ( diff --git a/components/ProgressiveWebApp.tsx b/components/ProgressiveWebApp.tsx index 11acdae..c438f32 100644 --- a/components/ProgressiveWebApp.tsx +++ b/components/ProgressiveWebApp.tsx @@ -1,4 +1,4 @@ -import RegisterServiceWorker from '../islands/RegisterServiceWorker.tsx' +import RegisterServiceWorker from ':islands/RegisterServiceWorker.tsx' export function ProgressiveWebApp() { return diff --git a/deno.json b/deno.json index 291f430..94d5194 100644 --- a/deno.json +++ b/deno.json @@ -15,6 +15,9 @@ "lint": { "rules": { "tags": ["fresh", "recommended"] } }, "exclude": ["**/_fresh/*", "packages/"], "imports": { + ":components/": "./components/", + ":islands/": "./islands/", + ":src/": "./src/", "$fresh/": "https://deno.land/x/fresh@1.6.8/", "$std/": "https://deno.land/std@0.208.0/", "@cohabit/cohamail/": "./packages/@cohabit__cohamail@0.2.1/", diff --git a/islands/LoginForm.tsx b/islands/LoginForm.tsx index 7b8dcf6..4fa0837 100644 --- a/islands/LoginForm.tsx +++ b/islands/LoginForm.tsx @@ -1,3 +1,4 @@ +import { requestApi } from ':src/utils.ts' import { startAuthentication } from '@simplewebauthn/browser' import { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types' import { Button, Input } from 'univoq' @@ -5,7 +6,6 @@ import type { WebAuthnLoginFinishPayload, WebAuthnLoginStartPayload, } from '../routes/api/webauthn/login/[step].ts' -import { requestApi } from '../src/utils.ts' export default function LoginForm() { return ( diff --git a/islands/PassKeyRegister.tsx b/islands/PassKeyRegister.tsx index d1a1c7a..e6d0aa5 100644 --- a/islands/PassKeyRegister.tsx +++ b/islands/PassKeyRegister.tsx @@ -1,3 +1,4 @@ +import { requestApi } from ':src/utils.ts' import { startRegistration } from '@simplewebauthn/browser' import { PublicKeyCredentialCreationOptionsJSON } from '@simplewebauthn/types' import { Button, Input } from 'univoq' @@ -5,7 +6,6 @@ import type { WebAuthnRegisterFinishPayload, WebAuthnRegisterStartPayload, } from '../routes/api/webauthn/register/[step].ts' -import { requestApi } from '../src/utils.ts' function isWebAuthnSupported(): boolean { return 'credentials' in navigator diff --git a/islands/RegisterServiceWorker.tsx b/islands/RegisterServiceWorker.tsx index 9a50d7c..b9a6026 100644 --- a/islands/RegisterServiceWorker.tsx +++ b/islands/RegisterServiceWorker.tsx @@ -1,4 +1,4 @@ -import { requestApi } from '../src/utils.ts' +import { requestApi } from ':src/utils.ts' export default function RegisterServiceWorker() { if ('serviceWorker' in navigator) { diff --git a/islands/StartServiceWorker.tsx b/islands/StartServiceWorker.tsx index 1788cd1..ffcf7c2 100644 --- a/islands/StartServiceWorker.tsx +++ b/islands/StartServiceWorker.tsx @@ -1,4 +1,4 @@ -import { main } from '../src/serviceworker/mod.ts' +import { main } from ':src/serviceworker/mod.ts' const IS_SW = 'onpushsubscriptionchange' in self diff --git a/routes/_app.tsx b/routes/_app.tsx index 7218ed6..9c3c5b4 100644 --- a/routes/_app.tsx +++ b/routes/_app.tsx @@ -1,8 +1,8 @@ import { asset, Head, Partial } from '$fresh/runtime.ts' import { type PageProps } from '$fresh/server.ts' -import { Footer } from '../components/Footer.tsx' -import { Header } from '../components/Header.tsx' -import { ProgressiveWebApp } from '../components/ProgressiveWebApp.tsx' +import { Footer } from ':components/Footer.tsx' +import { Header } from ':components/Header.tsx' +import { ProgressiveWebApp } from ':components/ProgressiveWebApp.tsx' export default function App({ Component }: PageProps) { return ( diff --git a/routes/_middleware.ts b/routes/_middleware.ts index 903f5b7..58634eb 100644 --- a/routes/_middleware.ts +++ b/routes/_middleware.ts @@ -1,6 +1,6 @@ import { FreshContext } from '$fresh/server.ts' +import { SessionStore } from ':src/session/mod.ts' import { getCookies, setCookie } from '@std/http/cookie' -import { SessionStore } from '../src/session/mod.ts' export async function handler(request: Request, ctx: FreshContext) { // Update fresh context state with session diff --git a/routes/api/_middleware.ts b/routes/api/_middleware.ts index 862b746..2774698 100644 --- a/routes/api/_middleware.ts +++ b/routes/api/_middleware.ts @@ -1,6 +1,6 @@ import { FreshContext } from '$fresh/server.ts' -import { SessionStore } from '../../src/session/mod.ts' -import { respondApi } from '../../src/utils.ts' +import { SessionStore } from ':src/session/mod.ts' +import { respondApi } from ':src/utils.ts' export function handler(request: Request, ctx: FreshContext) { // Check CSRF token diff --git a/routes/api/magiclink/index.ts b/routes/api/magiclink/index.ts index 70390ac..b523ca7 100644 --- a/routes/api/magiclink/index.ts +++ b/routes/api/magiclink/index.ts @@ -2,13 +2,13 @@ import 'npm:iterator-polyfill' // Polyfill AsyncIterator import { FreshContext } from '$fresh/server.ts' +import { db } from ':src/db/mod.ts' +import { SessionHandlers, SessionStore } from ':src/session/mod.ts' +import { respondApi } from ':src/utils.ts' import { Contact, type Mail, send } from '@cohabit/cohamail/mod.ts' import { magicLinkTemplate } from '@cohabit/cohamail/templates/mod.ts' -import { SessionHandlers, SessionStore } from '../../../src/session/mod.ts' -import { respondApi } from '../../../src/utils.ts' -import { sleep } from '@jotsr/delayed' import { User } from '@cohabit/ressources_manager/src/models/mod.ts' -import { db } from '../../../src/db/mod.ts' +import { sleep } from '@jotsr/delayed' type MagicLinkInfos = { remoteId: string diff --git a/routes/api/webauthn/login/[step].ts b/routes/api/webauthn/login/[step].ts index 2c95765..60daf5c 100644 --- a/routes/api/webauthn/login/[step].ts +++ b/routes/api/webauthn/login/[step].ts @@ -1,17 +1,17 @@ +import { db } from ':src/db/mod.ts' +import type { SessionHandlers } from ':src/session/mod.ts' +import { respondApi } from ':src/utils.ts' +import { getRelyingParty } from ':src/webauthn/mod.ts' +import { Credential, Ref, User } from '@cohabit/ressources_manager/mod.ts' +import { Passkey } from '@cohabit/ressources_manager/src/models/src/credential.ts' import { generateAuthenticationOptions, verifyAuthenticationResponse, } from '@simplewebauthn/server' -import { getRelyingParty } from '../../../../src/webauthn/mod.ts' import { AuthenticationResponseJSON, PublicKeyCredentialRequestOptionsJSON, } from '@simplewebauthn/types' -import { respondApi } from '../../../../src/utils.ts' -import type { SessionHandlers } from '../../../../src/session/mod.ts' -import { db } from '../../../../src/db/mod.ts' -import { Credential, Ref, User } from '@cohabit/ressources_manager/mod.ts' -import { Passkey } from '@cohabit/ressources_manager/src/models/src/credential.ts' import { decodeBase64 } from '@std/encoding' type Params = { step: 'start' | 'finish' } diff --git a/routes/api/webauthn/register/[step].ts b/routes/api/webauthn/register/[step].ts index 7c996f1..b8ff3ee 100644 --- a/routes/api/webauthn/register/[step].ts +++ b/routes/api/webauthn/register/[step].ts @@ -1,3 +1,5 @@ +import { SessionHandlers } from ':src/session/mod.ts' +import { respondApi } from ':src/utils.ts' import { generateRegistrationOptions, verifyRegistrationResponse, @@ -6,15 +8,13 @@ import type { PublicKeyCredentialCreationOptionsJSON, RegistrationResponseJSON, } from '@simplewebauthn/types' -import { respondApi } from '../../../../src/utils.ts' -import { SessionHandlers } from '../../../../src/session/mod.ts' //TODO improve workspace imports -import { Passkey } from '@cohabit/ressources_manager/src/models/src/credential.ts' +import { db } from ':src/db/mod.ts' +import { getRelyingParty } from ':src/webauthn/mod.ts' import { Credential, Ref, User } from '@cohabit/ressources_manager/mod.ts' -import { getRelyingParty } from '../../../../src/webauthn/mod.ts' +import { Passkey } from '@cohabit/ressources_manager/src/models/src/credential.ts' import { encodeBase64 } from '@std/encoding' -import { db } from '../../../../src/db/mod.ts' type Params = { step: 'start' | 'finish' } diff --git a/routes/api/webpush/subscription.ts b/routes/api/webpush/subscription.ts index 8155e41..dc5a242 100644 --- a/routes/api/webpush/subscription.ts +++ b/routes/api/webpush/subscription.ts @@ -1,5 +1,5 @@ import { Handlers } from '$fresh/server.ts' -import { respondApi } from '../../../src/utils.ts' +import { respondApi } from ':src/utils.ts' export const handler: Handlers = { async POST(request: Request) { diff --git a/routes/api/webpush/vapid.ts b/routes/api/webpush/vapid.ts index 4abcfe5..62f8471 100644 --- a/routes/api/webpush/vapid.ts +++ b/routes/api/webpush/vapid.ts @@ -1,6 +1,6 @@ import { Handlers } from '$fresh/server.ts' -import { respondApi } from '../../../src/utils.ts' -import { publicKey } from '../../../src/webpush/mod.ts' +import { respondApi } from ':src/utils.ts' +import { publicKey } from ':src/webpush/mod.ts' export const handler: Handlers = { GET() { diff --git a/routes/blog/index.tsx b/routes/blog/index.tsx index 4566e1f..d7dbae8 100644 --- a/routes/blog/index.tsx +++ b/routes/blog/index.tsx @@ -1,5 +1,5 @@ -import { AutoGrid } from '../../components/AutoGrid.tsx' -import { BlogCard, blogMock } from '../../components/BlogCard.tsx' +import { AutoGrid } from ':components/AutoGrid.tsx' +import { BlogCard, blogMock } from ':components/BlogCard.tsx' export default function Blog() { return ( diff --git a/routes/index.tsx b/routes/index.tsx index f421618..b2afc02 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -1,12 +1,12 @@ import { Head } from '$fresh/runtime.ts' -import { AutoGrid } from '../components/AutoGrid.tsx' -import { BlogCard, blogMock } from '../components/BlogCard.tsx' -import { CohabitInfoTable } from '../components/CohabitInfoTable.tsx' -import { Heros } from '../components/Heros.tsx' -import { MachineCard, machineMock } from '../components/MachineCard.tsx' -import { MemberCard, memberMock } from '../components/MemberCard.tsx' -import { ProjectCard, projectMock } from '../components/ProjectCard.tsx' -import { SponsorCards } from '../components/SponsorCards.tsx' +import { AutoGrid } from ':components/AutoGrid.tsx' +import { BlogCard, blogMock } from ':components/BlogCard.tsx' +import { CohabitInfoTable } from ':components/CohabitInfoTable.tsx' +import { Heros } from ':components/Heros.tsx' +import { MachineCard, machineMock } from ':components/MachineCard.tsx' +import { MemberCard, memberMock } from ':components/MemberCard.tsx' +import { ProjectCard, projectMock } from ':components/ProjectCard.tsx' +import { SponsorCards } from ':components/SponsorCards.tsx' export default function Home() { return ( diff --git a/routes/machines/[id].tsx b/routes/machines/[id].tsx index 60d1191..c62b41d 100644 --- a/routes/machines/[id].tsx +++ b/routes/machines/[id].tsx @@ -1,5 +1,5 @@ import { PageProps } from '$fresh/server.ts' -import { MachineCard, machineMock } from '../../components/MachineCard.tsx' +import { MachineCard, machineMock } from ':components/MachineCard.tsx' export default function Machine({ params }: PageProps) { const machine = machineMock.at(Number(params.id)) diff --git a/routes/machines/index.tsx b/routes/machines/index.tsx index 5fc1c43..712c11f 100644 --- a/routes/machines/index.tsx +++ b/routes/machines/index.tsx @@ -1,5 +1,5 @@ -import { AutoGrid } from '../../components/AutoGrid.tsx' -import { MachineCard, machineMock } from '../../components/MachineCard.tsx' +import { AutoGrid } from ':components/AutoGrid.tsx' +import { MachineCard, machineMock } from ':components/MachineCard.tsx' export default function Machine() { return ( diff --git a/routes/membres/[id]/index.tsx b/routes/membres/[id]/index.tsx index 203ff92..b05273f 100644 --- a/routes/membres/[id]/index.tsx +++ b/routes/membres/[id]/index.tsx @@ -1,6 +1,6 @@ import { PageProps } from '$fresh/server.ts' -import { Markdown } from '../../../components/Markdown.tsx' -import { MemberCard, memberMock } from '../../../components/MemberCard.tsx' +import { Markdown } from ':components/Markdown.tsx' +import { MemberCard, memberMock } from ':components/MemberCard.tsx' const db = [ 'julien.oculi', diff --git a/routes/membres/index.tsx b/routes/membres/index.tsx index c076f95..6286da0 100644 --- a/routes/membres/index.tsx +++ b/routes/membres/index.tsx @@ -1,5 +1,5 @@ -import { AutoGrid } from '../../components/AutoGrid.tsx' -import { MemberCard, memberMock } from '../../components/MemberCard.tsx' +import { AutoGrid } from ':components/AutoGrid.tsx' +import { MemberCard, memberMock } from ':components/MemberCard.tsx' export default function Membres() { return ( diff --git a/routes/profil/index.tsx b/routes/profil/index.tsx index 1230b4a..dff9996 100644 --- a/routes/profil/index.tsx +++ b/routes/profil/index.tsx @@ -1,8 +1,8 @@ -import { Button } from 'univoq' -import LoginForm from '../../islands/LoginForm.tsx' -import PassKeyRegister from '../../islands/PassKeyRegister.tsx' -import type { SessionPageProps } from '../../src/session/mod.ts' +import LoginForm from ':islands/LoginForm.tsx' +import PassKeyRegister from ':islands/PassKeyRegister.tsx' +import type { SessionPageProps } from ':src/session/mod.ts' import type { User } from '@cohabit/ressources_manager/mod.ts' +import { Button } from 'univoq' export default function Profil({ state }: SessionPageProps) { const user = state.session?.get('user') diff --git a/routes/projets/[id].tsx b/routes/projets/[id].tsx index 62b12ae..a232cdd 100644 --- a/routes/projets/[id].tsx +++ b/routes/projets/[id].tsx @@ -1,5 +1,5 @@ import { PageProps } from '$fresh/server.ts' -import { ProjectCard, projectMock } from '../../components/ProjectCard.tsx' +import { ProjectCard, projectMock } from ':components/ProjectCard.tsx' export default function Projets({ params }: PageProps) { const Projets = projectMock.at(Number(params.id)) diff --git a/routes/projets/index.tsx b/routes/projets/index.tsx index 065e1a9..dd03b03 100644 --- a/routes/projets/index.tsx +++ b/routes/projets/index.tsx @@ -1,5 +1,5 @@ -import { AutoGrid } from '../../components/AutoGrid.tsx' -import { ProjectCard, projectMock } from '../../components/ProjectCard.tsx' +import { AutoGrid } from ':components/AutoGrid.tsx' +import { ProjectCard, projectMock } from ':components/ProjectCard.tsx' export default function Project() { return (