Skip to content

Commit 06c700b

Browse files
committed
docs: init
1 parent 70ae8d8 commit 06c700b

30 files changed

+5366
-133
lines changed

.dockerignore

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# .dockerignore - v1.4.2
2+
# https://gist.github.com/sandros94/03675514546f17af1fd6db3863c043b4
3+
4+
5+
# Nuxt dev/build outputs
6+
.output
7+
.nuxt
8+
.nitro
9+
.cache
10+
.data
11+
dist
12+
13+
# Node dependencies
14+
node_modules
15+
16+
# Local env files
17+
.env
18+
.env.*
19+
20+
# Logs
21+
logs
22+
*.log
23+
24+
# VSCode
25+
.vscode
26+
.devcontainer
27+
.editorconfig
28+
29+
# Misc
30+
.git
31+
.github
32+
.gitignore
33+
.dockerignore
34+
.DS_Store
35+
.AppleDouble
36+
.LSOverride
37+
.fleet
38+
.idea
39+
Dockerfile*
40+
docker-compose*
41+
README.md
42+
Makefile
43+
helm-charts
44+
coverage*
45+
46+
# Project specific

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Dockerfile with PNPM for Nuxt - v1.2.1
2+
# https://gist.github.com/sandros94/03675514546f17af1fd6db3863c043b4
3+
4+
# Base configuration
5+
ARG node_tag=22-alpine
6+
FROM node:${node_tag} AS base
7+
WORKDIR /app
8+
9+
# Builder
10+
FROM base AS builder
11+
ENV PNPM_HOME="/pnpm"
12+
ENV PATH="$PNPM_HOME:$PATH"
13+
14+
COPY package.json pnpm-lock.yaml .npmrc /app/
15+
RUN npm i -g --force corepack && corepack enable
16+
17+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
18+
pnpm install --frozen-lockfile --shamefully-hoist
19+
20+
ARG NUXT_UI_PRO_LICENSE
21+
ENV NUXT_UI_PRO_LICENSE=$NUXT_UI_PRO_LICENSE
22+
23+
COPY . .
24+
RUN pnpm run dev:prepare
25+
RUN --mount=type=cache,id=nuxt,target=/app/node_modules/.cache/nuxt/.nuxt \
26+
pnpm run docs:build
27+
28+
# Final production container
29+
FROM base AS runtime
30+
ARG NODE_ENV=production
31+
ENV NODE_ENV=${NODE_ENV}
32+
33+
USER node
34+
EXPOSE 3000
35+
HEALTHCHECK --retries=10 --start-period=5s \
36+
CMD wget --no-verbose --spider http://0.0.0.0:3000/ || exit 1
37+
38+
COPY --link --from=builder /app/docs/.output/ ./
39+
40+
ENTRYPOINT [ "node", "server/index.mjs" ]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License][license-src]][license-href]
66
[![Nuxt][nuxt-src]][nuxt-href]
77

8-
A Nuxt module aimed to simplify the use of WebSockets.
8+
A Nuxt module aimed to simplify real-time communication with built-in automatic topic subscriptions, reactive shared state management, and type safety.
99

1010
- [ Release Notes](/CHANGELOG.md)
1111
<!-- - [🏀 Online playground](https://stackblitz.com/github/sandros94/lab?file=playground%2Fapp.vue) -->

docs/.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- v3
7+
pull_request:
8+
branches:
9+
- v3
10+
11+
jobs:
12+
ci:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest]
18+
node: [22]
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Install pnpm
25+
uses: pnpm/action-setup@v4
26+
27+
- name: Install node
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ matrix.node }}
31+
cache: pnpm
32+
33+
- name: Install dependencies
34+
run: pnpm install
35+
36+
- name: Lint
37+
run: pnpm run lint
38+
39+
- name: Typecheck
40+
run: pnpm run typecheck

docs/app/app.config.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
export default defineAppConfig({
2+
ui: {
3+
colors: {
4+
primary: 'green',
5+
neutral: 'slate',
6+
},
7+
},
8+
uiPro: {
9+
footer: {
10+
slots: {
11+
root: 'border-t border-(--ui-border)',
12+
left: 'text-sm text-(--ui-text-muted)',
13+
},
14+
},
15+
},
16+
seo: {
17+
siteName: 'Nuxt WebSocket - Docs',
18+
},
19+
header: {
20+
title: 'Nuxt WebSocket',
21+
to: '/',
22+
search: true,
23+
colorMode: true,
24+
links: [{
25+
'icon': 'i-simple-icons-github',
26+
'to': 'https://github.com/sandros94/nuxt-ws',
27+
'target': '_blank',
28+
'aria-label': 'GitHub',
29+
}],
30+
},
31+
footer: {
32+
credits: `Copyright © ${new Date().getFullYear()}`,
33+
colorMode: false,
34+
links: [
35+
{
36+
'icon': 'i-simple-icons-github',
37+
'to': 'https://github.com/sandros94/nuxt-ws',
38+
'target': '_blank',
39+
'aria-label': 'Nuxt WebSocket',
40+
}, {
41+
'icon': 'i-simple-icons-bluesky',
42+
'to': 'https://bsky.app/profile/sandros94.com',
43+
'target': '_blank',
44+
'aria-label': 'Sandros94 on BlueSky',
45+
},
46+
],
47+
},
48+
toc: {
49+
title: 'Table of Contents',
50+
bottom: {
51+
title: 'Community',
52+
edit: 'https://github.com/sandros94/nuxt-ws/edit/main/docs/content',
53+
links: [
54+
{
55+
icon: 'i-lucide-star',
56+
label: 'Star on GitHub',
57+
to: 'https://github.com/sandros94/nuxt-ws',
58+
target: '_blank',
59+
},
60+
],
61+
},
62+
},
63+
})

docs/app/app.vue

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<script setup lang="ts">
2+
const { seo } = useAppConfig()
3+
4+
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('docs'))
5+
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('docs'), {
6+
server: false,
7+
})
8+
9+
useHead({
10+
meta: [
11+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
12+
],
13+
link: [
14+
{ rel: 'icon', href: '/favicon.svg' },
15+
],
16+
htmlAttrs: {
17+
lang: 'en',
18+
},
19+
})
20+
21+
useSeoMeta({
22+
titleTemplate: `%s - ${seo?.siteName}`,
23+
ogSiteName: seo?.siteName,
24+
twitterCard: 'summary_large_image',
25+
})
26+
27+
provide('navigation', navigation)
28+
</script>
29+
30+
<template>
31+
<UApp>
32+
<NuxtLoadingIndicator />
33+
34+
<AppHeader />
35+
36+
<UMain>
37+
<NuxtLayout>
38+
<NuxtPage />
39+
</NuxtLayout>
40+
</UMain>
41+
42+
<AppFooter />
43+
44+
<ClientOnly>
45+
<LazyUContentSearch
46+
:files="files"
47+
:navigation="navigation"
48+
/>
49+
</ClientOnly>
50+
</UApp>
51+
</template>

docs/app/assets/css/main.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@import "tailwindcss" theme(static);
2+
@import "@nuxt/ui-pro";
3+
4+
@source "../../../content/**/*";
5+
6+
@theme static {
7+
--font-sans: 'Public Sans', sans-serif;
8+
9+
--color-green-50: #EFFDF5;
10+
--color-green-100: #D9FBE8;
11+
--color-green-200: #B3F5D1;
12+
--color-green-300: #75EDAE;
13+
--color-green-400: #00DC82;
14+
--color-green-500: #00C16A;
15+
--color-green-600: #00A155;
16+
--color-green-700: #007F45;
17+
--color-green-800: #016538;
18+
--color-green-900: #0A5331;
19+
--color-green-950: #052E16;
20+
}

docs/app/components/AppFooter.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<script setup lang="ts">
2+
const { footer } = useAppConfig()
3+
</script>
4+
5+
<template>
6+
<UFooter>
7+
<template #left>
8+
{{ footer.credits }}
9+
</template>
10+
11+
<template #right>
12+
<UColorModeButton v-if="footer?.colorMode" />
13+
14+
<template v-if="footer?.links">
15+
<UButton
16+
v-for="(link, index) of footer?.links"
17+
:key="index"
18+
v-bind="{ color: 'neutral', variant: 'ghost', ...link }"
19+
/>
20+
</template>
21+
</template>
22+
</UFooter>
23+
</template>

docs/app/components/AppHeader.vue

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<script setup lang="ts">
2+
import type { ContentNavigationItem } from '@nuxt/content'
3+
import type { NavigationMenuItem } from '@nuxt/ui'
4+
5+
const { version } = useRuntimeConfig().public
6+
7+
const navigation = inject<Ref<ContentNavigationItem[]>>('navigation')
8+
const links = parseNavigation(navigation)
9+
10+
const { header } = useAppConfig()
11+
12+
function parseNavigation(contentNavigation?: Ref<ContentNavigationItem[]>): Ref<NavigationMenuItem[]> {
13+
return computed(() => {
14+
if (!contentNavigation?.value) return []
15+
16+
const navigation = contentNavigation.value
17+
const items: NavigationMenuItem[] = []
18+
19+
navigation.forEach((item) => {
20+
const children = item.children?.map(child => ({
21+
label: child.title,
22+
to: child.page !== false
23+
? child.path
24+
: undefined,
25+
icon: child.icon as string | undefined,
26+
children: child.children
27+
? child.children.map(subChild => ({
28+
label: subChild.title,
29+
to: subChild.page !== false
30+
? subChild.path
31+
: undefined,
32+
}))
33+
: undefined,
34+
}))
35+
36+
items.push({
37+
label: item.title,
38+
to: item.page !== false
39+
? item.path
40+
: undefined,
41+
icon: item.icon as string | undefined,
42+
children,
43+
})
44+
})
45+
46+
return items
47+
})
48+
}
49+
</script>
50+
51+
<template>
52+
<UHeader
53+
:ui="{ center: 'flex-1' }"
54+
:to="header.to"
55+
:title="header.title"
56+
>
57+
<UNavigationMenu :items="links" variant="link" class="w-full justify-center" />
58+
59+
<template #left>
60+
<NuxtLink
61+
:to="header.to"
62+
class="flex items-end gap-2 font-bold text-xl text-[var(--ui-text-highlighted)] min-w-0 focus-visible:outline-[var(--ui-primary)]"
63+
>
64+
{{ header.title }}
65+
66+
<UBadge
67+
:label="`v${version}`"
68+
variant="subtle"
69+
size="sm"
70+
class="font-semibold inline-block truncate place-self-center"
71+
/>
72+
</NuxtLink>
73+
</template>
74+
75+
<template #body>
76+
<UContentNavigation
77+
highlight
78+
:navigation="navigation"
79+
/>
80+
</template>
81+
82+
<template #right>
83+
<UContentSearchButton v-if="header.search" />
84+
85+
<UColorModeButton v-if="header.colorMode" />
86+
87+
<template v-if="header.links">
88+
<UButton
89+
v-for="(link, index) of header.links"
90+
:key="index"
91+
v-bind="{ color: 'neutral', variant: 'ghost', ...link }"
92+
/>
93+
</template>
94+
</template>
95+
</UHeader>
96+
</template>

0 commit comments

Comments
 (0)