@dargmuesli/nuxt-vio 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +73 -0
- package/composables/useFavicons.ts +47 -0
- package/composables/useHost.ts +9 -0
- package/nuxt.config.ts +3 -0
- package/package.json +32 -0
- package/server/api/healthcheck.ts +7 -0
- package/server/middleware/headers.ts +13 -0
- package/utils/constants.ts +1 -0
- package/utils/networking.ts +7 -0
- package/utils/routing.ts +2 -0
- package/utils/testing.ts +7 -0
package/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Nuxt Layer Starter
|
2
|
+
|
3
|
+
Create Nuxt extendable layer with this GitHub template.
|
4
|
+
|
5
|
+
## Setup
|
6
|
+
|
7
|
+
Make sure to install the dependencies:
|
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.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
export const useFavicons = () => {
|
2
|
+
useHead({
|
3
|
+
link: [
|
4
|
+
{
|
5
|
+
href: '/assets/static/favicon/apple-touch-icon.png?v=bOXMwoKlJr',
|
6
|
+
rel: 'apple-touch-icon',
|
7
|
+
sizes: '180x180',
|
8
|
+
},
|
9
|
+
{
|
10
|
+
href: '/assets/static/favicon/favicon-16x16.png?v=bOXMwoKlJr',
|
11
|
+
rel: 'icon',
|
12
|
+
sizes: '16x16',
|
13
|
+
type: 'image/png',
|
14
|
+
},
|
15
|
+
{
|
16
|
+
href: '/assets/static/favicon/favicon-32x32.png?v=bOXMwoKlJr',
|
17
|
+
rel: 'icon',
|
18
|
+
sizes: '32x32',
|
19
|
+
type: 'image/png',
|
20
|
+
},
|
21
|
+
{
|
22
|
+
href: '/favicon.ico',
|
23
|
+
rel: 'icon',
|
24
|
+
type: 'image/x-icon',
|
25
|
+
},
|
26
|
+
{
|
27
|
+
href: '/assets/static/favicon/site.webmanifest?v=bOXMwoKlJr',
|
28
|
+
rel: 'manifest',
|
29
|
+
},
|
30
|
+
{
|
31
|
+
color: '#202020',
|
32
|
+
href: '/assets/static/favicon/safari-pinned-tab.svg?v=bOXMwoKlJr',
|
33
|
+
rel: 'mask-icon',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
href: '/favicon.ico?v=bOXMwoKlJr',
|
37
|
+
rel: 'shortcut icon',
|
38
|
+
},
|
39
|
+
],
|
40
|
+
meta: [
|
41
|
+
{
|
42
|
+
content: '/assets/static/favicon/browserconfig.xml?v=bOXMwoKlJr',
|
43
|
+
name: 'msapplication-config',
|
44
|
+
},
|
45
|
+
],
|
46
|
+
})
|
47
|
+
}
|
package/nuxt.config.ts
ADDED
package/package.json
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"name": "@dargmuesli/nuxt-vio",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"type": "module",
|
5
|
+
"publishConfig": {
|
6
|
+
"access": "public"
|
7
|
+
},
|
8
|
+
"engines": {
|
9
|
+
"node": "19"
|
10
|
+
},
|
11
|
+
"packageManager": "pnpm@8.0.0",
|
12
|
+
"files": [
|
13
|
+
"composables",
|
14
|
+
"server",
|
15
|
+
"utils",
|
16
|
+
"nuxt.config.ts"
|
17
|
+
],
|
18
|
+
"main": "./nuxt.config.ts",
|
19
|
+
"scripts": {
|
20
|
+
"dev": "nuxi prepare & nuxi dev .playground",
|
21
|
+
"build": "nuxi build .playground",
|
22
|
+
"generate": "nuxi generate .playground",
|
23
|
+
"preview": "nuxi preview .playground",
|
24
|
+
"lint": "eslint ."
|
25
|
+
},
|
26
|
+
"devDependencies": {
|
27
|
+
"@nuxtjs/eslint-config-typescript": "12.0.0",
|
28
|
+
"eslint": "8.37.0",
|
29
|
+
"nuxt": "3.3.3",
|
30
|
+
"typescript": "5.0.3"
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { defineEventHandler } from 'h3'
|
2
|
+
|
3
|
+
export default defineEventHandler((event) => {
|
4
|
+
const { res } = event.node
|
5
|
+
|
6
|
+
res.setHeader('Permissions-Policy', '')
|
7
|
+
|
8
|
+
// // Disabled until there is better browser support (https://caniuse.com/?search=report-to)
|
9
|
+
// res.setHeader(
|
10
|
+
// 'Report-To',
|
11
|
+
// '{"group":"default","max_age":31536000,"endpoints":[{"url":"https://dargmuesli.report-uri.com/a/d/g"}],"include_subdomains":true}'
|
12
|
+
// )
|
13
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
export const CYPRESS_BASE_URL = 'http://localhost:3000'
|
package/utils/routing.ts
ADDED