diff --git a/README.md b/README.md index 3d8813f3..e2fd8c9f 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,14 @@ npm login npm dist-tag add sveltekit-embed@0.0.13 latest ``` +## pnpm workspaces + +To add a package to the web workspace: + +```bash +pnpm add -D svead --filter web +``` + ## Contributors ✨ Thanks goes to these wonderful people diff --git a/apps/web/package.json b/apps/web/package.json index 6639d36c..a7bad504 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,5 +1,5 @@ { - "name": "@svead/web", + "name": "web", "version": "0.0.0", "private": true, "scripts": { @@ -37,7 +37,8 @@ "prettier": "^3.1.1", "prettier-plugin-svelte": "^3.1.2", "prettier-plugin-tailwindcss": "^0.5.9", - "svelte": "^5.0.0-next.1", + "svead": "workspace:^", + "svelte": "5.0.0-next.29", "svelte-check": "^3.6.0", "tailwindcss": "^3.3.6", "tslib": "^2.4.1", diff --git a/apps/web/src/lib/components/head.svelte b/apps/web/src/lib/components/head.svelte deleted file mode 100644 index 8ca157dc..00000000 --- a/apps/web/src/lib/components/head.svelte +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - {title} - - - {#if authorName} - - {/if} - - - {#if image} - - - - {/if} - - - {#if image} - - - - - - {/if} - - - {#if image} - - {#if website} - - {/if} - - - - - {/if} - - - {#if paymentPointer} - - {/if} - - - diff --git a/apps/web/src/lib/components/head.test.ts b/apps/web/src/lib/components/head.test.ts deleted file mode 100644 index 6ca2f8bd..00000000 --- a/apps/web/src/lib/components/head.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { render } from '@testing-library/svelte'; -import { afterEach, describe, expect, it } from 'vitest'; -import Head from './head.svelte'; - -describe('Head', () => { - afterEach(() => { - document.head.innerHTML = ''; - }); - - it.skip('renders the correct title, description, and author', async () => { - render(Head, { - url: 'https://example.com', - title: 'Test Title', - description: 'Test Description', - authorName: 'Test Author', - }); - - const titleElement = document.head.querySelector( - 'meta[name="title"]', - ); - const descriptionElement = document.head.querySelector( - 'meta[name="description"]', - ); - const authorElement = document.head.querySelector( - 'meta[name="author"]', - ); - - expect(titleElement?.getAttribute('content')).toBe('Test Title'); - expect(descriptionElement?.getAttribute('content')).toBe( - 'Test Description', - ); - expect(authorElement?.getAttribute('content')).toBe( - 'Test Author', - ); - }); - - it.skip('renders the correct Open Graph and Twitter tags when an image is provided', async () => { - render(Head, { - url: 'https://example.com', - title: 'Test Title', - description: 'Test Description', - image: 'https://example.com/test-image.jpg', - }); - - const ogImageElement = document.head.querySelector( - 'meta[property="og:image"]', - ); - const twitterImageElement = document.head.querySelector( - 'meta[name="twitter:image"]', - ); - - expect(ogImageElement?.getAttribute('content')).toBe( - 'https://example.com/test-image.jpg', - ); - expect(twitterImageElement?.getAttribute('content')).toBe( - 'https://example.com/test-image.jpg', - ); - }); - - it.skip('renders the monetization tag when a payment pointer is provided', async () => { - render(Head, { - url: 'https://example.com', - title: 'Test Title', - description: 'Test Description', - paymentPointer: '$example.wallet/test', - }); - - const monetizationElement = document.head.querySelector( - 'meta[name="monetization"]', - ); - - expect(monetizationElement?.getAttribute('content')).toBe( - '$example.wallet/test', - ); - }); -}); diff --git a/apps/web/src/lib/components/schema-org-props.ts b/apps/web/src/lib/components/schema-org-props.ts deleted file mode 100644 index 8bc1580b..00000000 --- a/apps/web/src/lib/components/schema-org-props.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { AuthorType, MainEntity } from '$lib/types'; - -export interface BreadcrumbItem { - name: string; - url: string; -} - -export interface SchemaOrgProps { - url: string; - title: string; - description: string; - website?: string; - authorName?: string; - authorType?: AuthorType; - authorUrl?: string; - image?: string; - datePublished?: string; - dateModified?: string; - language?: string; - mainEntity: MainEntity; - breadcrumbs?: BreadcrumbItem[]; -} diff --git a/apps/web/src/lib/components/schema-org.svelte b/apps/web/src/lib/components/schema-org.svelte deleted file mode 100644 index 58694a56..00000000 --- a/apps/web/src/lib/components/schema-org.svelte +++ /dev/null @@ -1,39 +0,0 @@ - - - - {@html jsonLdScript} - diff --git a/apps/web/src/lib/components/schema-org.test.ts b/apps/web/src/lib/components/schema-org.test.ts deleted file mode 100644 index 29373c24..00000000 --- a/apps/web/src/lib/components/schema-org.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { render } from '@testing-library/svelte'; -import { afterEach, describe, expect, it } from 'vitest'; -import SchemaOrg from './schema-org.svelte'; - -describe('SchemaOrg', () => { - afterEach(() => { - document.head.innerHTML = ''; - }); - - it.skip('renders the correct JSON-LD script with the provided properties', async () => { - render(SchemaOrg, { - schemaOrgProps: { - url: 'https://example.com', - title: 'Test Title', - description: 'Test Description', - authorName: 'Test Author', - authorType: 'Person', - authorUrl: 'https://example.com/authors/test-author', - image: 'https://example.com/test-image.jpg', - datePublished: '2023-04-05T10:00:00Z', - dateModified: '2023-04-05T12:00:00Z', - language: 'en', - mainEntity: { - type: 'Article', - name: 'Test Title', - url: 'https://example.com', - headline: 'Test Title', - description: 'Test Description', - image: 'https://example.com/test-image.jpg', - datePublished: '2023-04-05T10:00:00Z', - dateModified: '2023-04-05T12:00:00Z', - author: { - type: 'Person', - name: 'Test Author', - url: 'https://example.com/authors/test-author', - }, - publisher: { - type: 'Organization', - name: 'https://example.com', - logo: '', - }, - }, - breadcrumbs: [], - }, - }); - - const jsonLdScriptElement = document.head.querySelector( - 'script[type="application/ld+json"]', - ); - - if (!jsonLdScriptElement) { - throw new Error('JSON-LD script element not found'); - } - - const jsonLdContent = JSON.parse(jsonLdScriptElement.innerHTML); - - expect(jsonLdContent['@type']).toBe('Article'); - expect(jsonLdContent.name).toBe('Test Title'); - expect(jsonLdContent.url).toBe('https://example.com'); - expect(jsonLdContent.headline).toBe('Test Title'); - expect(jsonLdContent.description).toBe('Test Description'); - expect(jsonLdContent.image).toBe( - 'https://example.com/test-image.jpg', - ); - expect(jsonLdContent.datePublished).toBe('2023-04-05T10:00:00Z'); - expect(jsonLdContent.dateModified).toBe('2023-04-05T12:00:00Z'); - expect(jsonLdContent.author['@type']).toBe('Person'); - expect(jsonLdContent.author.name).toBe('Test Author'); - expect(jsonLdContent.author.url).toBe( - 'https://example.com/authors/test-author', - ); - expect(jsonLdContent.publisher['@type']).toBe('Organization'); - expect(jsonLdContent.publisher.name).toBe('https://example.com'); - expect(jsonLdContent.publisher.logo).toBe(''); - }); -}); diff --git a/apps/web/src/lib/icons/git-hub.svelte b/apps/web/src/lib/icons/git-hub.svelte index c9fded2b..fa0e51ad 100644 --- a/apps/web/src/lib/icons/git-hub.svelte +++ b/apps/web/src/lib/icons/git-hub.svelte @@ -1,7 +1,13 @@ diff --git a/apps/web/src/lib/icons/twitter.svelte b/apps/web/src/lib/icons/twitter.svelte index 529bac8a..73780b30 100644 --- a/apps/web/src/lib/icons/twitter.svelte +++ b/apps/web/src/lib/icons/twitter.svelte @@ -4,7 +4,7 @@ viewBox="0 0 24 24" height="25" width="25" - class="fill-current text-primary-content transition hover:text-secondary-focus" + class="hover:text-secondary-focus fill-current text-primary-content transition" >