@dargmuesli/nuxt-vio 12.1.0 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.config/certificates/mkcert.sh +30 -0
- package/nuxt.config.ts +7 -1
- package/package.json +6 -25
- package/utils/constants.ts +0 -37
- package/utils/nuxt.ts +39 -0
- package/playwright.config.ts +0 -99
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
THIS=$(dirname "$(readlink -f "$0")")
|
3
|
+
|
4
|
+
create() {
|
5
|
+
NAME="$1"
|
6
|
+
shift
|
7
|
+
CONTENT=$*
|
8
|
+
|
9
|
+
path="$THIS/$NAME"
|
10
|
+
certfile="$path.crt"
|
11
|
+
keyfile="$path.key"
|
12
|
+
|
13
|
+
if [ "$CONTENT" != "" ]; then
|
14
|
+
# shellcheck disable=SC2086
|
15
|
+
mkcert \
|
16
|
+
-cert-file "$certfile" \
|
17
|
+
-ecdsa \
|
18
|
+
-key-file "$keyfile" $CONTENT
|
19
|
+
fi
|
20
|
+
|
21
|
+
cat "$(mkcert -CAROOT)/rootCA.pem" >> "$certfile"
|
22
|
+
}
|
23
|
+
|
24
|
+
echo "key crt" | tr ' ' '\n' | while read -r glob; do
|
25
|
+
if test -n "$(find "$THIS" -maxdepth 1 -name "*.$glob" -print -quit)"; then
|
26
|
+
rm "$THIS"/*."$glob"
|
27
|
+
fi
|
28
|
+
done
|
29
|
+
|
30
|
+
create "ssl" "localhost" "127.0.0.1" "0.0.0.0"
|
package/nuxt.config.ts
CHANGED
@@ -8,9 +8,9 @@ import {
|
|
8
8
|
SITE_NAME,
|
9
9
|
TIMEZONE_COOKIE_NAME,
|
10
10
|
GTAG_COOKIE_ID,
|
11
|
-
VIO_NUXT_BASE_CONFIG,
|
12
11
|
GET_CSP,
|
13
12
|
} from './utils/constants'
|
13
|
+
import { VIO_NUXT_BASE_CONFIG } from './utils/nuxt'
|
14
14
|
|
15
15
|
const currentDir = dirname(fileURLToPath(import.meta.url))
|
16
16
|
|
@@ -29,6 +29,12 @@ export default defineNuxtConfig(
|
|
29
29
|
name: 'layout',
|
30
30
|
},
|
31
31
|
},
|
32
|
+
devServer: {
|
33
|
+
https: {
|
34
|
+
key: './.config/certificates/ssl.key',
|
35
|
+
cert: './.config/certificates/ssl.crt',
|
36
|
+
},
|
37
|
+
},
|
32
38
|
devtools: {
|
33
39
|
timeline: {
|
34
40
|
enabled: true,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dargmuesli/nuxt-vio",
|
3
|
-
"version": "
|
3
|
+
"version": "13.0.0",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/dargmuesli/vio.git"
|
@@ -66,11 +66,10 @@
|
|
66
66
|
"jose": "5.4.0",
|
67
67
|
"nuxt-gtag": "2.0.6",
|
68
68
|
"nuxt-security": "1.4.3",
|
69
|
-
"sweetalert2": "11.11.1"
|
69
|
+
"sweetalert2": "11.11.1",
|
70
|
+
"vue-tsc": "2.0.21"
|
70
71
|
},
|
71
72
|
"devDependencies": {
|
72
|
-
"@axe-core/playwright": "4.9.1",
|
73
|
-
"@playwright/test": "1.44.1",
|
74
73
|
"@unhead/vue": "1.9.13",
|
75
74
|
"@urql/devtools": "2.0.3",
|
76
75
|
"@urql/exchange-graphcache": "7.1.1",
|
@@ -94,15 +93,12 @@
|
|
94
93
|
"stylelint-config-standard": "36.0.0",
|
95
94
|
"stylelint-no-unsupported-browser-features": "8.0.1",
|
96
95
|
"tailwindcss": "3.4.4",
|
97
|
-
"ufo": "1.5.3",
|
98
96
|
"unhead": "1.9.13",
|
99
97
|
"vue": "3.4.29",
|
100
|
-
"vue-router": "4.3.3"
|
101
|
-
"vue-tsc": "2.0.21"
|
98
|
+
"vue-router": "4.3.3"
|
102
99
|
},
|
103
100
|
"peerDependencies": {
|
104
101
|
"nuxt": "3.12.2",
|
105
|
-
"playwright-core": "1.44.1",
|
106
102
|
"vue": "3.4.29",
|
107
103
|
"vue-router": "4.3.3"
|
108
104
|
},
|
@@ -110,7 +106,6 @@
|
|
110
106
|
"build": "pnpm run build:node",
|
111
107
|
"build:node": "nuxt build .playground",
|
112
108
|
"build:static": "nuxt generate .playground",
|
113
|
-
"build:static:test": "cross-env NODE_ENV=production SITE_URL=http://localhost:3002 pnpm run build:static",
|
114
109
|
"dev": "pnpm run start:dev",
|
115
110
|
"generate": "pnpm run build:static",
|
116
111
|
"lint:fix": "pnpm run lint:js --fix && pnpm run lint:ts --fix && pnpm run lint:style --fix",
|
@@ -119,24 +114,10 @@
|
|
119
114
|
"lint:style": "stylelint --cache \"**/*.{vue,css}\" --ignore-path .gitignore",
|
120
115
|
"lint:ts": "nuxt typecheck",
|
121
116
|
"lint": "pnpm run lint:js && pnpm run lint:ts && pnpm run lint:style",
|
122
|
-
"prepare": "nuxt prepare && nuxt prepare .playground",
|
117
|
+
"prepare": "nuxt prepare && nuxt prepare .playground && ./.config/certificates/mkcert.sh",
|
123
118
|
"preview": "nuxt preview .playground",
|
124
119
|
"start:dev": "nuxt dev .playground",
|
125
120
|
"start:node": "node .playground/.output/server/index.mjs",
|
126
|
-
"start:static": "serve .playground/.output/public"
|
127
|
-
"start:static:test": "cross-env PORT=3002 pnpm run start:static",
|
128
|
-
"test:e2e:docker:br": "pnpm run test:e2e:docker:build && pnpm run test:e2e:docker:run",
|
129
|
-
"test:e2e:docker:build": "docker build -t test-e2e_development --build-arg UID=$(id -u) --build-arg GID=$(id -g) --target test-e2e_development ..",
|
130
|
-
"test:e2e:docker:run": "docker run --rm -v \"$PWD/..:/srv/app\" -v \"$(pnpm store path):/srv/.pnpm-store\" test-e2e_development",
|
131
|
-
"test:e2e:docker:server:dev:update": "pnpm run test:e2e:docker:server:dev --update-snapshots",
|
132
|
-
"test:e2e:docker:server:dev": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:dev",
|
133
|
-
"test:e2e:docker:server:node:update": "pnpm run test:e2e:docker:server:node --update-snapshots",
|
134
|
-
"test:e2e:docker:server:node": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:node",
|
135
|
-
"test:e2e:docker:server:static:update": "pnpm run test:e2e:docker:server:static --update-snapshots",
|
136
|
-
"test:e2e:docker:server:static": "pnpm run test:e2e:docker:br pnpm --dir src run test:e2e:server:static",
|
137
|
-
"test:e2e:server:dev": "cross-env PORT=3000 SITE_URL=http://localhost:3000 VIO_SERVER=dev pnpm run test:e2e",
|
138
|
-
"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",
|
139
|
-
"test:e2e:server:static": "cross-env NODE_ENV=production PORT=3002 SITE_URL=http://localhost:3002 VIO_SERVER=static pnpm run test:e2e",
|
140
|
-
"test:e2e": "playwright test"
|
121
|
+
"start:static": "serve .playground/.output/public --ssl-cert ./.config/certificates/ssl.crt --ssl-key ./.config/certificates/ssl.key"
|
141
122
|
}
|
142
123
|
}
|
package/utils/constants.ts
CHANGED
@@ -166,40 +166,3 @@ export const TITLE_TEMPLATE = ({
|
|
166
166
|
title?: string | null
|
167
167
|
}) => (title && title !== siteName ? `${title} · ${siteName}` : siteName)
|
168
168
|
export const VERIFICATION_FORMAT_UUID = helpers.regex(REGEX_UUID)
|
169
|
-
export const VIO_NUXT_BASE_CONFIG = ({
|
170
|
-
siteName,
|
171
|
-
stagingHost,
|
172
|
-
}: {
|
173
|
-
siteName: string
|
174
|
-
stagingHost?: string
|
175
|
-
}) =>
|
176
|
-
({
|
177
|
-
app: {
|
178
|
-
head: {
|
179
|
-
title: siteName, // fallback data to prevent invalid html at generation
|
180
|
-
},
|
181
|
-
},
|
182
|
-
runtimeConfig: {
|
183
|
-
public: {
|
184
|
-
vio: {
|
185
|
-
...(stagingHost
|
186
|
-
? {
|
187
|
-
stagingHost:
|
188
|
-
process.env.NODE_ENV !== 'production' &&
|
189
|
-
!process.env.NUXT_PUBLIC_SITE_URL
|
190
|
-
? stagingHost
|
191
|
-
: undefined,
|
192
|
-
}
|
193
|
-
: {}),
|
194
|
-
},
|
195
|
-
},
|
196
|
-
},
|
197
|
-
|
198
|
-
// modules
|
199
|
-
i18n: {
|
200
|
-
...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)
|
201
|
-
},
|
202
|
-
site: {
|
203
|
-
name: siteName,
|
204
|
-
},
|
205
|
-
}) as Parameters<typeof defineNuxtConfig>[0]
|
package/utils/nuxt.ts
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
import { I18N_MODULE_CONFIG } from './constants'
|
2
|
+
|
3
|
+
export const VIO_NUXT_BASE_CONFIG = ({
|
4
|
+
siteName,
|
5
|
+
stagingHost,
|
6
|
+
}: {
|
7
|
+
siteName: string
|
8
|
+
stagingHost?: string
|
9
|
+
}) =>
|
10
|
+
({
|
11
|
+
app: {
|
12
|
+
head: {
|
13
|
+
title: siteName, // fallback data to prevent invalid html at generation
|
14
|
+
},
|
15
|
+
},
|
16
|
+
runtimeConfig: {
|
17
|
+
public: {
|
18
|
+
vio: {
|
19
|
+
...(stagingHost
|
20
|
+
? {
|
21
|
+
stagingHost:
|
22
|
+
process.env.NODE_ENV !== 'production' &&
|
23
|
+
!process.env.NUXT_PUBLIC_SITE_URL
|
24
|
+
? stagingHost
|
25
|
+
: undefined,
|
26
|
+
}
|
27
|
+
: {}),
|
28
|
+
},
|
29
|
+
},
|
30
|
+
},
|
31
|
+
|
32
|
+
// modules
|
33
|
+
i18n: {
|
34
|
+
...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)
|
35
|
+
},
|
36
|
+
site: {
|
37
|
+
name: siteName,
|
38
|
+
},
|
39
|
+
}) as Parameters<typeof defineNuxtConfig>[0]
|
package/playwright.config.ts
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
import { defineConfig, devices } from '@playwright/test'
|
2
|
-
import { SITE_URL } from './utils/constants'
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Read environment variables from file.
|
6
|
-
* https://github.com/motdotla/dotenv
|
7
|
-
*/
|
8
|
-
// require('dotenv').config();
|
9
|
-
|
10
|
-
/**
|
11
|
-
* See https://playwright.dev/docs/test-configuration.
|
12
|
-
*/
|
13
|
-
export default defineConfig({
|
14
|
-
expect: {
|
15
|
-
toHaveScreenshot: {
|
16
|
-
maxDiffPixelRatio: 0.01,
|
17
|
-
},
|
18
|
-
},
|
19
|
-
|
20
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
21
|
-
forbidOnly: !!process.env.CI,
|
22
|
-
|
23
|
-
/* Run tests in files in parallel */
|
24
|
-
fullyParallel: true,
|
25
|
-
|
26
|
-
outputDir: 'tests/e2e/results',
|
27
|
-
|
28
|
-
/* Configure projects for major browsers */
|
29
|
-
projects: [
|
30
|
-
{
|
31
|
-
name: 'chromium',
|
32
|
-
use: { ...devices['Desktop Chrome'] },
|
33
|
-
},
|
34
|
-
|
35
|
-
{
|
36
|
-
name: 'firefox',
|
37
|
-
use: { ...devices['Desktop Firefox'] },
|
38
|
-
},
|
39
|
-
|
40
|
-
{
|
41
|
-
name: 'webkit',
|
42
|
-
use: { ...devices['Desktop Safari'] },
|
43
|
-
},
|
44
|
-
|
45
|
-
/* Test against mobile viewports. */
|
46
|
-
// {
|
47
|
-
// name: 'Mobile Chrome',
|
48
|
-
// use: { ...devices['Pixel 5'] },
|
49
|
-
// },
|
50
|
-
// {
|
51
|
-
// name: 'Mobile Safari',
|
52
|
-
// use: { ...devices['iPhone 12'] },
|
53
|
-
// },
|
54
|
-
|
55
|
-
/* Test against branded browsers. */
|
56
|
-
// {
|
57
|
-
// name: 'Microsoft Edge',
|
58
|
-
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
59
|
-
// },
|
60
|
-
// {
|
61
|
-
// name: 'Google Chrome',
|
62
|
-
// use: { ..devices['Desktop Chrome'], channel: 'chrome' },
|
63
|
-
// },
|
64
|
-
],
|
65
|
-
|
66
|
-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
67
|
-
reporter: [['html', { outputFolder: 'tests/e2e/report' }]],
|
68
|
-
|
69
|
-
/* Retry on CI only */
|
70
|
-
retries: process.env.CI ? 1 : 0,
|
71
|
-
|
72
|
-
testDir: './tests/e2e/specs',
|
73
|
-
|
74
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
75
|
-
use: {
|
76
|
-
/* Base URL to use in actions like `await page.goto('/')`. */
|
77
|
-
baseURL: SITE_URL,
|
78
|
-
|
79
|
-
// TODO: remove once tests run without it
|
80
|
-
ignoreHTTPSErrors: true,
|
81
|
-
|
82
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
83
|
-
trace: 'on-first-retry',
|
84
|
-
},
|
85
|
-
|
86
|
-
/* Run your local dev server before starting the tests */
|
87
|
-
webServer: {
|
88
|
-
command: `pnpm run start:${process.env.VIO_SERVER || 'dev'}`,
|
89
|
-
env: {
|
90
|
-
NUXT_PUBLIC_VIO_IS_TESTING: 'true',
|
91
|
-
},
|
92
|
-
ignoreHTTPSErrors: true, // TODO: remove once tests run without it
|
93
|
-
timeout: process.env.NODE_ENV === 'production' ? 10000 : 100000,
|
94
|
-
url: SITE_URL,
|
95
|
-
reuseExistingServer: !process.env.CI,
|
96
|
-
},
|
97
|
-
|
98
|
-
workers: undefined,
|
99
|
-
})
|