Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6c717f3
chore: :building_construction: Fixed types ordering in package.json a…
TechAkayy Jan 27, 2025
e6949e7
docs: :memo: Minor link fixes
TechAkayy Jan 25, 2025
2146c7f
chore: :rotating_light: Disable prettier in vs settings to avoid loca…
TechAkayy Jan 25, 2025
2e5053b
docs: 📝 Updated docs iles settings to open external link in a new tab
TechAkayy Jan 25, 2025
03412cd
ci: :green_heart: Fixed tests, used cypress13.13.2 and IPv6 [::1] to …
TechAkayy Jan 25, 2025
da24ee9
chore: :zap: Upgraded to vite v6.0.11 along with other required packa…
TechAkayy Jan 25, 2025
5c92442
fix: :bug: Fixed twitter to use "name" as key in meta tags
TechAkayy Jan 25, 2025
a4b263e
test: :test_tube: Updated previous snapshot for twitter property-to-n…
TechAkayy Jan 26, 2025
fd12407
fix: :bug: Ensure default layout is optional when user didn't create one
TechAkayy Jan 25, 2025
9d5dc0a
fix: :bug: Error out on duplicate Vite Vue plugins with error message
TechAkayy Jan 25, 2025
c075132
fix: :bug: Use default title and description to avoid undefined when …
TechAkayy Jan 25, 2025
40ec5ac
feat: ✨ Support useSeoMeta from @unhead/vue, docs updated
TechAkayy Jan 27, 2025
5565b35
docs: :memo: Added a new static-assets page on importing external ass…
TechAkayy Jan 25, 2025
8d5593d
feat: :sparkles: Make app.ts and site.ts optional
TechAkayy Jan 25, 2025
95bd877
test: 🧪 Updated previous snapshot for related asset naming change fro…
TechAkayy Jan 27, 2025
1f30e29
docs: 📝 Moved app.ts docs section from config to development, config …
TechAkayy Jan 25, 2025
98e3542
feat: :sparkles: Support user provider index.html, used parse5, docs …
TechAkayy Jan 27, 2025
9db6e34
docs: :memo: Added new section to getting started - Add iles to exist…
TechAkayy Jan 25, 2025
5ee8e04
docs: :memo: Added new Recipes set of pages, with the first recipe post
TechAkayy Jan 27, 2025
31fff58
docs: :memo: Override site wide MetaTags like ogImage etc for individ…
TechAkayy Jan 25, 2025
5a1bdc2
feat: :sparkles: enhanceIslands API for Vue Islands only
TechAkayy Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ contact_links:
url: https://iles-docs.netlify.app/faqs/troubleshooting
about: 'Please check the most common configuration problems before opening an issue.'
- name: Discord Chat
url: https://discord.com/channels/804011606160703521/900707742203920394
about: 'Discuss with other users in the #iles channel of the Vite.js Discord server.'
url: https://discord.gg/p7rXjFcwXa
about: 'Discuss with other users in the #iles channel of the îles Discord server.'
- name: Questions & Discussions
url: https://github.com/ElMassimo/iles/discussions
about: Use GitHub discussions for questions and discussions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Build
run: pnpm build:all

- name: Build Blog Site
run: pnpm blog:build

- name: Tests
run: pnpm test

Expand All @@ -54,7 +57,7 @@ jobs:
CI: true

runs-on: ubuntu-latest
container: cypress/included:9.2.0
container: cypress/included:13.13.2
steps:
- uses: actions/checkout@v2

Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"prettier.enable": false,
"files.exclude": {
"**/dist": true
},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ Visit the [documentation website][docs] to check out the [guides][guide] and sea
[VitePress]: https://vitepress.vuejs.org/
[vite-ssg]: https://github.com/antfu/vite-ssg
[vue-router]: https://next.router.vuejs.org/
[@unhead/vue]: https://github.com/unjs/unhead
[@unhead/vue]: https://unhead.unjs.io/

1 change: 1 addition & 0 deletions docs/composables.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare global {
const definePageComponent: typeof import('iles')['definePageComponent']
const useDocuments: typeof import('iles')['useDocuments']
const useHead: typeof import('iles')['useHead']
const useSeoMeta: typeof import('iles')['useSeoMeta']
const usePage: typeof import('iles')['usePage']
const useRoute: typeof import('iles')['useRoute']
}
Expand Down
41 changes: 22 additions & 19 deletions docs/cypress/e2e/sidebar.cypress.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { visit, navigateTo, goBackHome, assertPage, waitForHydration } from './helpers'
import { visit, visitHome, navigateTo, goBackHome, assertPage, waitForHydration } from './helpers'

describe('Sidebar Toggle', () => {
const sidebar = () =>
Expand All @@ -24,23 +24,26 @@ describe('Sidebar Toggle', () => {
sidebarToggle().should('not.be.visible')
})

test.skipIf(process.env.CI)('can open in mobile', () => {
visitHome()
cy.viewport(500, 720)
visit('/guide/frameworks')
openSidebar()
closeSidebar()

// Ensure Turbo reactivates the islands.
openSidebar()
sidebar().contains('Config').click()

// Give Turbo time to replace the body.
waitForHydration()
assertPage({ title: 'Config' })
sidebar().should('not.be.visible')

openSidebar()
closeSidebar()
it('can open in mobile', () => {
cy.skipIf(process.env.CI)
it('can open in mobile', () => {
visitHome()
cy.viewport(500, 720)
visit('/guide/frameworks')
openSidebar()
closeSidebar()

// Ensure Turbo reactivates the islands.
openSidebar()
sidebar().contains('Config').click()

// Give Turbo time to replace the body.
waitForHydration()
assertPage({ title: 'Config' })
sidebar().should('not.be.visible')

openSidebar()
closeSidebar()
})
})
})
7 changes: 7 additions & 0 deletions docs/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

Cypress.Commands.add(
'skipIf',
(expression) => {
if (expression) context.skip.bind(context)();
}
);
18 changes: 17 additions & 1 deletion docs/iles.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import headings from '@islands/headings'
import icons from '@islands/icons'
import prism from '@islands/prism'
import pwa from '@islands/pwa'
import excerpt from '@islands/excerpt'
import reactivityTransform from '@vue-macros/reactivity-transform/vite'

import UnoCSS from 'unocss/vite'
Expand All @@ -16,13 +17,21 @@ const { title, description } = site

export default defineConfig({
siteUrl: 'https://iles-docs.netlify.app',

extendFrontmatter(frontmatter, filename) {
if (filename.includes('/recipes/') && !filename.includes('/recipes/index.vue')) {
frontmatter.layout = 'recipe'
}
},

turbo: true,
jsx: 'preact',
debug: false,
modules: [
headings(),
icons(),
prism(),
excerpt({ maxLength: 140 }),
lastUpdated(),
pwa({
manifestFilename: 'pwa-manifest.json',
Expand Down Expand Up @@ -59,7 +68,14 @@ export default defineConfig({
],
markdown: {
rehypePlugins: [
'rehype-external-links',
[
'rehype-external-links',
{
target: '_blank',
rel: ['noopener'],
test: (node: any) => /^https?:\/\//.test(node.properties.href),
},
],
],
},
ssg: {
Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"@iconify-json/bx": "^1.1.10",
"@iconify-json/heroicons-outline": "^1.1.10",
"@islands/excerpt": "workspace:*",
"@islands/headings": "workspace:*",
"@islands/icons": "workspace:*",
"@islands/prism": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions docs/scripts/test-cypress
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ echo '== Starting server =='
pnpm run preview &

echo '== Waiting for server to respond... =='
pnpx wait-on http-get://localhost:3050 --delay 1000 --timeout 15000
pnpx wait-on http-get://[::1]:3050 --delay 1000 --timeout 15000

echo '== Server ready! =='

pnpx cypress@10.6.0 run && echo '== Finished! =='
pnpx cypress@13.13.2 run && echo '== Finished! =='
3 changes: 3 additions & 0 deletions docs/src/assets/recipes/vanilla-vue-to-iles/iles-build.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/src/assets/recipes/vanilla-vue-to-iles/netlify-drop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/src/assets/recipes/vanilla-vue-to-iles/vanilla-vue.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/src/components/AutoImported.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<Tip title="Composables are auto-imported">
You don't need to import <kbd>usePage</kbd>, <kbd>useRoute</kbd>, <kbd>useHead</kbd>, or <kbd>definePageComponent</kbd>.
You don't need to import <kbd>usePage</kbd>, <kbd>definePageComponent</kbd>, <kbd>useRoute</kbd>, <kbd>useHead</kbd> or <kbd>useSeoMeta</kbd>.
</Tip>
</template>
32 changes: 22 additions & 10 deletions docs/src/components/MetaTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,36 @@ const { frontmatter, site } = usePage()
let imageUrl = $computed(() => `${site.url}${frontmatter.image || bannerSrc}`)

const isProd = import.meta.env.PROD

const author = frontmatter.author || site.author
const keywords = (frontmatter.tags || site.tags)?.join(', ')

// Manage head meta with useSeoMeta
useSeoMeta({
author,
keywords,

// Open Graph / Facebook / LinkedIn / Discord
ogType: 'website',
ogImage: imageUrl,
ogImageAlt: 'Îles',
ogLocale: 'en_US',

// Twitter (X)
twitterCard: 'summary_large_image',
twitterImage: imageUrl,
twitterImageAlt: 'Îles',
twitterSite: site.twitterHandle,
twitterCreator: site.authorHandle,
})
</script>

<template>
<Head>
<meta property="author" :content="site.author">
<meta property="keywords" :content="site.tags.join(', ')">
<meta property="HandheldFriendly" content="True">
<meta property="MobileOptimized" content="320">
<meta http-equiv="cleartype" content="on">
<meta name="theme-color" content="#5C7E8F">
<meta property="og:type" content="website">
<meta property="og:locale" content="en_US">
<meta property="og:image" :content="imageUrl">
<meta property="twitter:image" :content="imageUrl">
<meta property="twitter:image:alt" content="îles">
<meta property="twitter:site" :content="`@${site.twitterHandle}`">
<meta property="twitter:creator" :content="`@${site.authorHandle}`">
<meta property="twitter:card" content="summary_large_image">
<link rel="icon" type="image/svg+xml" :href="logoSrc">
<link rel="shortcut icon" :href="faviconSrc">
<link rel="mask-icon" :href="logoSrc" color="#5C7E8F">
Expand Down
47 changes: 47 additions & 0 deletions docs/src/components/MetaTagsRecipe.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script setup lang="ts">
import { computed } from 'vue'
import { getPosts } from '~/logic/recipes'
import { getImage } from '~/logic/utils';

const posts = getPosts()
const { page, site } = usePage()

const currentIndex = computed(() =>
posts.value.findIndex((p) => p.href === page.value.href),
)
const post = computed(() => currentIndex.value > -1 ? posts.value[currentIndex.value] : posts.value[0])

const title = computed(() => {
return post.value?.title
})

const ogImage = computed(() => {
const image = getImage(post.value?.image)
return `${site.url}${image}`
})

const author = computed(() => {
return post.value?.author
})

const twitterCreator = computed(() => {
return post.value?.twitter
})

useSeoMeta({
author,

// Open Graph / Facebook / LinkedIn / Discord
ogImage,
ogImageAlt: title,

// Twitter (X)
twitterImage: ogImage,
twitterImageAlt: title,
twitterCreator,
})
</script>

<template>
<div></div>
</template>
30 changes: 30 additions & 0 deletions docs/src/components/PostDate.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script setup lang="ts">
defineProps<{ date: string | Date }>()

function toDate(date: string | Date) {
return date instanceof Date ? date : new Date(date)
}

function getDateTime(date: string | Date) {
return toDate(date).toISOString()
}

function formatDate(dateStr: string | Date) {
const date = toDate(dateStr)
date.setUTCHours(12)
return date.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
})
}
</script>

<template>
<dl>
<dt class="sr-only">Published on</dt>
<dd>
<time :datetime="getDateTime(date)">{{ formatDate(date) }}</time>
</dd>
</dl>
</template>
2 changes: 1 addition & 1 deletion docs/src/components/ReloadPrompt.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script client:load lang="ts">
import { OnLoadFn } from 'iles'
import type { OnLoadFn } from 'iles'
import { registerSW } from 'virtual:pwa-register'

let refreshSW: ((reloadPage?: boolean) => Promise<void>) | undefined
Expand Down
29 changes: 29 additions & 0 deletions docs/src/layouts/recipe.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { computed } from 'vue'
import { getPosts } from '~/logic/recipes'

const posts = getPosts()
const { page } = usePage()

const currentIndex = computed(() =>
posts.value.findIndex((p) => p.href === page.value.href),
)
const post = computed(() => posts.value[currentIndex.value])
</script>

<template layout="default">
<h1 v-if="post">
{{ post.title }}
</h1>
<slot/>
</template>

<style scoped>
.prose h1#introduction {
font-size: 1.5em;
font-weight: 700;
line-height: 1.3333333;
margin-bottom: 1em;
margin-top: 1.8em;
}
</style>
19 changes: 19 additions & 0 deletions docs/src/logic/recipes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Document, PageComponent } from 'iles'
import { computed } from 'vue'

export interface Post extends PageComponent {
date: Date
author: string
title: string
twitter: string
image: string
}

function byDate(a: Document<Post>, b: Document<Post>) {
return Number(new Date(b.date)) - Number(new Date(a.date))
}

export function getPosts() {
const posts = useDocuments<Post>('~/pages/recipes/*.{md,mdx}')
return computed(() => posts.value.sort(byDate))
}
7 changes: 7 additions & 0 deletions docs/src/logic/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@ export function joinUrl (base: string, path: string): string {
if (path.startsWith('#')) return path
return `${base}${path.startsWith('/') ? path.slice(1) : path}`
}

export function getImage(fileName: string) {
const modules = import.meta.glob('@/assets/recipes/**/*.{jpg,png,svg}', { eager: true, import: 'default' })
const moduleKeys = Object.keys(modules)
const fileSrc = moduleKeys.find(key => key.endsWith(fileName))
return fileSrc ? modules[fileSrc] : ''
}
Loading