@dargmuesli/nuxt-vio 3.8.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -71
- package/app.config.ts +0 -4
- package/components/vio/_/VioError.vue +8 -6
- package/composables/useAppLayout.ts +7 -14
- package/composables/useFavicons.ts +2 -3
- package/composables/useHeadDefault.ts +11 -5
- package/composables/usePolyfills.ts +1 -2
- package/error.vue +1 -2
- package/nuxt.config.ts +6 -5
- package/package.json +24 -16
- package/playwright.config.ts +5 -7
- package/utils/constants.ts +19 -14
package/README.md
CHANGED
@@ -1,73 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# Vio
|
2
2
|
|
3
|
-
|
3
|
+
Vio is a [Nuxt layer](https://nuxt.com/docs/getting-started/layers) powering:
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
```bash
|
10
|
-
pnpm install
|
11
|
-
```
|
12
|
-
|
13
|
-
## Working on your theme
|
14
|
-
|
15
|
-
Your theme is at the root of this repository, it is exactly like a regular Nuxt project, except you can publish it on NPM.
|
16
|
-
|
17
|
-
The `.playground` directory should help you on trying your theme during development.
|
18
|
-
|
19
|
-
Running `pnpm dev` will prepare and boot `.playground` directory, which imports your theme itself.
|
20
|
-
|
21
|
-
## Distributing your theme
|
22
|
-
|
23
|
-
Your Nuxt layer is shaped exactly the same as any other Nuxt project, except you can publish it on NPM.
|
24
|
-
|
25
|
-
To do so, you only have to check if `files` in `package.json` are valid, then run:
|
26
|
-
|
27
|
-
```bash
|
28
|
-
npm publish --access public
|
29
|
-
```
|
30
|
-
|
31
|
-
Once done, your users will only have to run:
|
32
|
-
|
33
|
-
```bash
|
34
|
-
npm install --save your-theme
|
35
|
-
```
|
36
|
-
|
37
|
-
Then add the dependency to their `extends` in `nuxt.config`:
|
38
|
-
|
39
|
-
```ts
|
40
|
-
defineNuxtConfig({
|
41
|
-
extends: 'your-theme'
|
42
|
-
})
|
43
|
-
```
|
44
|
-
|
45
|
-
## Development Server
|
46
|
-
|
47
|
-
Start the development server on http://localhost:3000
|
48
|
-
|
49
|
-
```bash
|
50
|
-
pnpm dev
|
51
|
-
```
|
52
|
-
|
53
|
-
## Production
|
54
|
-
|
55
|
-
Build the application for production:
|
56
|
-
|
57
|
-
```bash
|
58
|
-
pnpm build
|
59
|
-
```
|
60
|
-
|
61
|
-
Or statically generate it with:
|
62
|
-
|
63
|
-
```bash
|
64
|
-
pnpm generate
|
65
|
-
```
|
66
|
-
|
67
|
-
Locally preview production build:
|
68
|
-
|
69
|
-
```bash
|
70
|
-
pnpm preview
|
71
|
-
```
|
72
|
-
|
73
|
-
Checkout the [deployment documentation](https://v3.nuxtjs.org/docs/deployment) for more information.
|
5
|
+
- https://jonas-thelemann.de
|
6
|
+
- https://creal.jonas-thelemann.de
|
7
|
+
- https://trapparty.jonas-thelemann.de
|
package/app.config.ts
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
import { useServerSeoMeta } from '@unhead/vue'
|
2
|
-
|
3
1
|
export default defineAppConfig({
|
4
2
|
vio: {
|
5
3
|
pages: undefined,
|
6
|
-
seoMeta: undefined,
|
7
4
|
server: {
|
8
5
|
middleware: {
|
9
6
|
headers: {
|
@@ -83,7 +80,6 @@ declare module 'nuxt/schema' {
|
|
83
80
|
}
|
84
81
|
}
|
85
82
|
}
|
86
|
-
seoMeta?: Parameters<typeof useServerSeoMeta>[0]
|
87
83
|
server?: {
|
88
84
|
middleware: {
|
89
85
|
headers: {
|
@@ -1,12 +1,14 @@
|
|
1
1
|
<template>
|
2
|
-
<h1>{{ `${statusCode} - ${statusReason}` }}</h1>
|
3
2
|
<div>
|
4
|
-
{{
|
3
|
+
<h1>{{ `${statusCode} - ${statusReason}` }}</h1>
|
4
|
+
<div>
|
5
|
+
{{ description }}
|
6
|
+
</div>
|
7
|
+
<pre
|
8
|
+
v-if="stack && !runtimeConfig.public.vio.isInProduction"
|
9
|
+
v-html="stack"
|
10
|
+
/>
|
5
11
|
</div>
|
6
|
-
<pre
|
7
|
-
v-if="stack && !runtimeConfig.public.vio.isInProduction"
|
8
|
-
v-html="stack"
|
9
|
-
/>
|
10
12
|
</template>
|
11
13
|
|
12
14
|
<script setup lang="ts">
|
@@ -2,8 +2,7 @@ export const useAppLayout = () => {
|
|
2
2
|
const appConfig = useAppConfig()
|
3
3
|
const siteConfig = useSiteConfig()
|
4
4
|
|
5
|
-
|
6
|
-
useHeadSafe({
|
5
|
+
useServerHeadSafe({
|
7
6
|
...useLocaleHead({ addDirAttribute: true, addSeoAttributes: true }).value,
|
8
7
|
bodyAttrs: {
|
9
8
|
class:
|
@@ -11,22 +10,16 @@ export const useAppLayout = () => {
|
|
11
10
|
},
|
12
11
|
})
|
13
12
|
|
14
|
-
|
15
|
-
useSeoMeta({
|
13
|
+
useServerSeoMeta({
|
16
14
|
titleTemplate: (title) =>
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
TITLE_TEMPLATE({
|
16
|
+
siteName: siteConfig.name,
|
17
|
+
title,
|
18
|
+
}),
|
20
19
|
})
|
21
20
|
|
22
|
-
if (appConfig.vio.seoMeta) {
|
23
|
-
// TODO: replace with `useServerSeoMeta`
|
24
|
-
useSeoMeta(appConfig.vio.seoMeta)
|
25
|
-
}
|
26
|
-
|
27
21
|
if (appConfig.vio.themeColor) {
|
28
|
-
|
29
|
-
useSeoMeta({
|
22
|
+
useServerSeoMeta({
|
30
23
|
msapplicationTileColor: appConfig.vio.themeColor,
|
31
24
|
themeColor: appConfig.vio.themeColor,
|
32
25
|
})
|
@@ -1,11 +1,10 @@
|
|
1
1
|
export const useFavicons = () => {
|
2
2
|
const appConfig = useAppConfig()
|
3
3
|
|
4
|
-
|
5
|
-
useHeadSafe({
|
4
|
+
useServerHeadSafe({
|
6
5
|
link: [
|
7
6
|
{
|
8
|
-
href: `/
|
7
|
+
href: `/site.webmanifest?v=${CACHE_VERSION}`,
|
9
8
|
rel: 'manifest',
|
10
9
|
},
|
11
10
|
{
|
@@ -1,22 +1,28 @@
|
|
1
1
|
import { defu } from 'defu'
|
2
|
-
import type {
|
2
|
+
import type { UseSeoMetaInput } from '@unhead/vue'
|
3
3
|
|
4
4
|
export const useHeadDefault = ({
|
5
5
|
extension,
|
6
6
|
title,
|
7
7
|
}: {
|
8
|
-
extension?:
|
8
|
+
extension?: UseSeoMetaInput
|
9
9
|
title: string | ComputedRef<string>
|
10
10
|
}) => {
|
11
11
|
const attrs = useAttrs()
|
12
|
+
const siteConfig = useSiteConfig()
|
12
13
|
|
13
|
-
const defaults:
|
14
|
+
const defaults: UseSeoMetaInput = {
|
14
15
|
description: attrs['site-description'] as string, // TODO: remove (https://github.com/harlan-zw/nuxt-site-config/pull/7)
|
15
16
|
msapplicationConfig: `/assets/static/favicon/browserconfig.xml?v=${CACHE_VERSION}`,
|
16
17
|
title,
|
17
18
|
twitterDescription: attrs['site-description'] as string,
|
18
|
-
twitterTitle:
|
19
|
+
twitterTitle: ref(
|
20
|
+
TITLE_TEMPLATE({
|
21
|
+
siteName: siteConfig.name,
|
22
|
+
title: toValue(title),
|
23
|
+
}),
|
24
|
+
), // TODO: remove `ref`
|
19
25
|
}
|
20
26
|
|
21
|
-
|
27
|
+
useServerSeoMeta(defu(extension, defaults))
|
22
28
|
}
|
package/error.vue
CHANGED
@@ -21,8 +21,7 @@ const errorProp = toRef(() => props.error)
|
|
21
21
|
// initialization
|
22
22
|
useAppLayout()
|
23
23
|
|
24
|
-
|
25
|
-
useHeadSafe({
|
24
|
+
useServerHeadSafe({
|
26
25
|
title: `${errorProp.value.statusCode} - ${errorProp.value.message}`,
|
27
26
|
})
|
28
27
|
</script>
|
package/nuxt.config.ts
CHANGED
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url'
|
|
4
4
|
import { defu } from 'defu'
|
5
5
|
|
6
6
|
import {
|
7
|
-
|
7
|
+
SITE_URL,
|
8
8
|
I18N_COOKIE_NAME,
|
9
9
|
I18N_MODULE_CONFIG,
|
10
10
|
SITE_NAME,
|
@@ -29,6 +29,9 @@ export default defineNuxtConfig(
|
|
29
29
|
lang: 'en', // fallback data to prevent invalid html at generation
|
30
30
|
},
|
31
31
|
titleTemplate: '%s', // fully set in `composables/useAppLayout.ts`
|
32
|
+
templateParams: {
|
33
|
+
separator: '·',
|
34
|
+
},
|
32
35
|
},
|
33
36
|
pageTransition: {
|
34
37
|
name: 'layout',
|
@@ -36,7 +39,7 @@ export default defineNuxtConfig(
|
|
36
39
|
},
|
37
40
|
devtools: {
|
38
41
|
enabled:
|
39
|
-
process.env.NODE_ENV
|
42
|
+
process.env.NODE_ENV === 'development' &&
|
40
43
|
!process.env.NUXT_PUBLIC_VIO_IS_TESTING,
|
41
44
|
timeline: {
|
42
45
|
enabled: true,
|
@@ -149,7 +152,6 @@ export default defineNuxtConfig(
|
|
149
152
|
},
|
150
153
|
},
|
151
154
|
linkChecker: {
|
152
|
-
debug: process.env.NODE_ENV === 'development',
|
153
155
|
failOnError: true,
|
154
156
|
},
|
155
157
|
seo: {
|
@@ -157,7 +159,6 @@ export default defineNuxtConfig(
|
|
157
159
|
},
|
158
160
|
site: {
|
159
161
|
debug: process.env.NODE_ENV === 'development',
|
160
|
-
titleSeparator: '·',
|
161
162
|
},
|
162
163
|
sitemap: {
|
163
164
|
exclude: I18N_MODULE_CONFIG.locales.map(
|
@@ -170,7 +171,7 @@ export default defineNuxtConfig(
|
|
170
171
|
},
|
171
172
|
},
|
172
173
|
VIO_NUXT_BASE_CONFIG({
|
173
|
-
|
174
|
+
siteUrl: SITE_URL,
|
174
175
|
defaultLocale: 'en',
|
175
176
|
siteName: SITE_NAME,
|
176
177
|
stagingHost: 'localhost:3000',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dargmuesli/nuxt-vio",
|
3
|
-
"version": "
|
3
|
+
"version": "4.0.1",
|
4
4
|
"type": "module",
|
5
5
|
"publishConfig": {
|
6
6
|
"access": "public"
|
@@ -30,27 +30,34 @@
|
|
30
30
|
],
|
31
31
|
"main": "nuxt.config.ts",
|
32
32
|
"scripts": {
|
33
|
-
"build": "
|
34
|
-
"
|
35
|
-
"
|
36
|
-
"
|
33
|
+
"build": "pnpm run build:node",
|
34
|
+
"build:node": "nuxt build .playground",
|
35
|
+
"build:static": "SITE_URL=http://localhost:3002 nuxt generate .playground",
|
36
|
+
"dev": "pnpm run start:dev",
|
37
|
+
"generate": "pnpm run build:static",
|
38
|
+
"lint:fix": "pnpm run lint:js --fix && pnpm run lint:ts --fix && pnpm run lint:style --fix",
|
37
39
|
"lint:js": "eslint --cache --ext .js,.ts,.vue --ignore-path .gitignore .",
|
38
40
|
"lint:staged": "lint-staged",
|
39
41
|
"lint:style": "stylelint --cache \"**/*.{vue,css}\" --ignore-path .gitignore",
|
40
42
|
"lint:ts": "nuxt typecheck",
|
41
|
-
"lint": "pnpm lint:js && pnpm lint:ts && pnpm lint:style",
|
43
|
+
"lint": "pnpm run lint:js && pnpm run lint:ts && pnpm run lint:style",
|
42
44
|
"prepare": "nuxt prepare .playground",
|
43
45
|
"preview": "nuxt preview .playground",
|
44
|
-
"start": "
|
45
|
-
"
|
46
|
-
"
|
46
|
+
"start:dev": "nuxt dev .playground",
|
47
|
+
"start:node": "node .playground/.output/server/index.mjs",
|
48
|
+
"start:static": "serve .playground/.output/public",
|
49
|
+
"test:e2e:docker:br": "pnpm run test:e2e:docker:build && pnpm run test:e2e:docker:run",
|
47
50
|
"test:e2e:docker:build": "docker build -t test-e2e_base --build-arg UID=$(id -u) --build-arg GID=$(id -g) --target test-e2e_base ..",
|
48
|
-
"test:e2e:docker:dev:update": "pnpm test:e2e:docker:dev --update-snapshots",
|
49
|
-
"test:e2e:docker:dev": "pnpm test:e2e:docker:br pnpm --dir src run test:e2e:dev",
|
50
|
-
"test:e2e:docker:prod:update": "pnpm test:e2e:docker:prod --update-snapshots",
|
51
|
-
"test:e2e:docker:prod": "pnpm test:e2e:docker:br pnpm --dir src run test:e2e:prod",
|
52
51
|
"test:e2e:docker:run": "docker run --rm -v \"$PWD/..:/srv/app\" -v \"$(pnpm store path):/srv/.pnpm-store\" test-e2e_base",
|
53
|
-
"test:e2e:
|
52
|
+
"test:e2e:docker:server:dev:update": "pnpm run test:e2e:docker:server:dev --update-snapshots",
|
53
|
+
"test:e2e:docker:server:dev": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:dev",
|
54
|
+
"test:e2e:docker:server:node:update": "pnpm run test:e2e:docker:server:node --update-snapshots",
|
55
|
+
"test:e2e:docker:server:node": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:node",
|
56
|
+
"test:e2e:docker:server:static:update": "pnpm run test:e2e:docker:server:static --update-snapshots",
|
57
|
+
"test:e2e:docker:server:static": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:static",
|
58
|
+
"test:e2e:server:dev": "cross-env PORT=3000 SITE_URL=http://localhost:3000 VIO_SERVER=dev pnpm run test:e2e",
|
59
|
+
"test:e2e:server:node": "cross-env NODE_ENV=production NUXT_PUBLIC_I18N_BASE_URL=http://localhost:3001 NUXT_PUBLIC_SITE_URL=http://localhost:3001 PORT=3001 VIO_SERVER=node pnpm run test:e2e",
|
60
|
+
"test:e2e:server:static": "cross-env NODE_ENV=production PORT=3002 SITE_URL=http://localhost:3002 VIO_SERVER=static pnpm run test:e2e",
|
54
61
|
"test:e2e": "playwright test"
|
55
62
|
},
|
56
63
|
"dependencies": {
|
@@ -62,7 +69,7 @@
|
|
62
69
|
"@nuxtjs/html-validator": "1.5.2",
|
63
70
|
"@nuxtjs/i18n": "8.0.0-rc.4",
|
64
71
|
"@nuxtjs/tailwindcss": "6.8.0",
|
65
|
-
"@nuxtseo/module": "2.0.0-beta.
|
72
|
+
"@nuxtseo/module": "2.0.0-beta.29",
|
66
73
|
"@pinia/nuxt": "0.4.11",
|
67
74
|
"@playwright/test": "1.37.1",
|
68
75
|
"@tailwindcss/forms": "0.5.6",
|
@@ -84,6 +91,7 @@
|
|
84
91
|
"jose": "4.14.6",
|
85
92
|
"lodash-es": "4.17.21",
|
86
93
|
"pinia": "2.1.6",
|
94
|
+
"serve": "14.2.1",
|
87
95
|
"sweetalert2": "11.7.27",
|
88
96
|
"vue-gtag": "2.0.1",
|
89
97
|
"vue-tsc": "1.8.10"
|
@@ -96,7 +104,7 @@
|
|
96
104
|
"eslint-plugin-compat": "4.2.0",
|
97
105
|
"eslint-plugin-nuxt": "4.0.0",
|
98
106
|
"eslint-plugin-prettier": "5.0.0",
|
99
|
-
"eslint-plugin-yml": "1.
|
107
|
+
"eslint-plugin-yml": "1.9.0",
|
100
108
|
"lint-staged": "14.0.1",
|
101
109
|
"nuxt": "3.7.1",
|
102
110
|
"prettier": "3.0.3",
|
package/playwright.config.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { defineConfig, devices } from '@playwright/test'
|
2
|
-
import {
|
2
|
+
import { SITE_URL } from './utils/constants'
|
3
3
|
|
4
4
|
/**
|
5
5
|
* Read environment variables from file.
|
@@ -74,7 +74,7 @@ export default defineConfig({
|
|
74
74
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
75
75
|
use: {
|
76
76
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
77
|
-
baseURL:
|
77
|
+
baseURL: SITE_URL,
|
78
78
|
|
79
79
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
80
80
|
trace: 'on-first-retry',
|
@@ -82,16 +82,14 @@ export default defineConfig({
|
|
82
82
|
|
83
83
|
/* Run your local dev server before starting the tests */
|
84
84
|
webServer: {
|
85
|
-
command:
|
86
|
-
process.env.NODE_ENV === 'production' ? 'pnpm run start' : 'pnpm run dev',
|
85
|
+
command: `pnpm run start:${process.env.VIO_SERVER || 'dev'}`,
|
87
86
|
env: {
|
88
87
|
NUXT_PUBLIC_VIO_IS_TESTING: 'true',
|
89
88
|
},
|
90
89
|
timeout: process.env.NODE_ENV === 'production' ? 10000 : 100000,
|
91
|
-
url:
|
90
|
+
url: process.env.SITE_URL || SITE_URL,
|
92
91
|
reuseExistingServer: !process.env.CI,
|
93
92
|
},
|
94
93
|
|
95
|
-
|
96
|
-
workers: process.env.CI ? 1 : undefined,
|
94
|
+
workers: undefined,
|
97
95
|
})
|
package/utils/constants.ts
CHANGED
@@ -2,15 +2,13 @@ import { helpers } from '@vuelidate/validators'
|
|
2
2
|
|
3
3
|
export const SITE_NAME = 'Vio'
|
4
4
|
|
5
|
-
export const
|
6
|
-
|
7
|
-
|
8
|
-
(process.env.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
: '3000'
|
13
|
-
}`)
|
5
|
+
export const SITE_URL =
|
6
|
+
process.env.SITE_URL ||
|
7
|
+
process.env.NUXT_PUBLIC_SITE_URL ||
|
8
|
+
(process.env.HOST ? 'https' : 'http') +
|
9
|
+
'://' +
|
10
|
+
(process.env.HOST ||
|
11
|
+
`${process.env.HOST || 'localhost'}:${process.env.PORT || '3000'}`)
|
14
12
|
export const CACHE_VERSION = 'bOXMwoKlJr'
|
15
13
|
export const COOKIE_PREFIX = SITE_NAME.toLocaleLowerCase()
|
16
14
|
export const COOKIE_SEPARATOR = '_'
|
@@ -45,15 +43,22 @@ export const REGEX_UUID =
|
|
45
43
|
/^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/
|
46
44
|
export const TIMEZONE_COOKIE_NAME = [COOKIE_PREFIX, 'tz'].join(COOKIE_SEPARATOR)
|
47
45
|
export const TIMEZONE_HEADER_KEY = `X-${SITE_NAME}-Timezone`
|
46
|
+
export const TITLE_TEMPLATE = ({
|
47
|
+
siteName,
|
48
|
+
title,
|
49
|
+
}: {
|
50
|
+
siteName: string
|
51
|
+
title?: string
|
52
|
+
}) => (title && title !== siteName ? `${title} · ${siteName}` : siteName)
|
48
53
|
export const VALIDATION_SUGGESTION_TITLE_LENGTH_MAXIMUM = 300
|
49
54
|
export const VERIFICATION_FORMAT_UUID = helpers.regex(REGEX_UUID)
|
50
55
|
export const VIO_NUXT_BASE_CONFIG = ({
|
51
|
-
|
56
|
+
siteUrl,
|
52
57
|
defaultLocale,
|
53
58
|
siteName,
|
54
59
|
stagingHost,
|
55
60
|
}: {
|
56
|
-
|
61
|
+
siteUrl?: string
|
57
62
|
defaultLocale?: string
|
58
63
|
siteName: string
|
59
64
|
stagingHost?: string
|
@@ -67,14 +72,14 @@ export const VIO_NUXT_BASE_CONFIG = ({
|
|
67
72
|
runtimeConfig: {
|
68
73
|
public: {
|
69
74
|
i18n: {
|
70
|
-
...(
|
75
|
+
...(siteUrl ? { baseUrl: siteUrl } : {}),
|
71
76
|
},
|
72
77
|
vio: {
|
73
78
|
...(stagingHost
|
74
79
|
? {
|
75
80
|
stagingHost:
|
76
81
|
process.env.NODE_ENV !== 'production' &&
|
77
|
-
!process.env.
|
82
|
+
!process.env.NUXT_PUBLIC_SITE_URL
|
78
83
|
? stagingHost
|
79
84
|
: undefined,
|
80
85
|
}
|
@@ -89,7 +94,7 @@ export const VIO_NUXT_BASE_CONFIG = ({
|
|
89
94
|
...I18N_MODULE_CONFIG, // `langDir`, `lazy` and `locales` must be configured to extend a layer having lazy-loaded translations (https://v8.i18n.nuxtjs.org/guide/layers#locales)
|
90
95
|
},
|
91
96
|
site: {
|
92
|
-
...(
|
97
|
+
...(siteUrl ? { url: siteUrl } : {}),
|
93
98
|
...(defaultLocale ? { defaultLocale } : {}),
|
94
99
|
name: siteName,
|
95
100
|
},
|