@kevinmarrec/create-app 0.10.1 → 0.12.0
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 +29 -5
- package/dist/index.js +8 -13
- package/package.json +13 -13
- package/template/.docker/analytics/service.yaml +22 -0
- package/template/.docker/mailpit/service.yaml +13 -0
- package/template/.docker/metabase/service.yaml +27 -0
- package/template/.docker/postgres/init.sql +5 -0
- package/template/.docker/postgres/service.yaml +20 -0
- package/template/.docker/studio/service.yaml +22 -0
- package/template/.docker/traefik/service.yaml +41 -0
- package/template/.github/renovate.json +6 -1
- package/template/.vscode/settings.json +10 -5
- package/template/README.md +92 -193
- package/template/api/Dockerfile +45 -0
- package/template/api/package.json +7 -5
- package/template/api/src/env.ts +18 -5
- package/template/api/src/utils/cors.ts +1 -1
- package/template/api/tsconfig.json +1 -1
- package/template/app/.env +2 -0
- package/template/app/index.html +3 -0
- package/template/app/package.json +16 -12
- package/template/app/src/App.vue +0 -5
- package/template/app/src/env.d.ts +1 -3
- package/template/app/tsconfig.json +8 -3
- package/template/app/vite.config.ts +61 -41
- package/template/compose.yaml +14 -88
- package/template/knip.config.ts +3 -2
- package/template/package.json +8 -7
- package/template/tsconfig.json +1 -8
|
@@ -6,60 +6,80 @@ import unhead from '@unhead/addons/vite'
|
|
|
6
6
|
import vue from '@vitejs/plugin-vue'
|
|
7
7
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
8
8
|
import unocss from 'unocss/vite'
|
|
9
|
-
import
|
|
9
|
+
import * as v from 'valibot'
|
|
10
|
+
import { defineConfig, type PluginOption } from 'vite'
|
|
11
|
+
import valibot from 'vite-plugin-valibot-env'
|
|
10
12
|
import devtools from 'vite-plugin-vue-devtools'
|
|
11
13
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
12
14
|
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
sourcemap: mode === 'analyze',
|
|
19
|
-
},
|
|
20
|
-
builder: {
|
|
21
|
-
async buildApp(builder) {
|
|
22
|
-
if (builder.config.mode === 'static') {
|
|
23
|
-
const { build } = await import('vite-ssg/node')
|
|
24
|
-
await build(builder.config.ssgOptions)
|
|
25
|
-
process.exit(0)
|
|
26
|
-
}
|
|
15
|
+
export const envSchema = v.object({
|
|
16
|
+
VITE_API_URL: v.pipe(v.string(), v.nonEmpty(), v.readonly()),
|
|
17
|
+
VITE_ANALYTICS_URL: v.pipe(v.string(), v.nonEmpty(), v.readonly()),
|
|
18
|
+
VITE_ANALYTICS_WEBSITE_ID: v.pipe(v.string(), v.nonEmpty(), v.readonly()),
|
|
19
|
+
})
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
optionsAPI: command !== 'build',
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
yaml(),
|
|
21
|
+
declare global {
|
|
22
|
+
interface ViteEnv extends v.InferOutput<typeof envSchema> {}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default defineConfig(({ command, mode }) => {
|
|
26
|
+
const plugins: PluginOption[] = [
|
|
38
27
|
darkMode(),
|
|
39
|
-
unocss(),
|
|
40
|
-
unhead(),
|
|
41
|
-
tsconfigPaths(),
|
|
42
28
|
devtools({
|
|
43
29
|
componentInspector: {
|
|
44
30
|
toggleComboKey: 'alt-s',
|
|
45
31
|
},
|
|
46
32
|
}),
|
|
47
|
-
|
|
33
|
+
tsconfigPaths(),
|
|
34
|
+
unhead(),
|
|
35
|
+
unocss(),
|
|
36
|
+
valibot(envSchema),
|
|
37
|
+
vue({
|
|
38
|
+
features: {
|
|
39
|
+
optionsAPI: command !== 'build',
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
yaml(),
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
if (mode === 'analyze') {
|
|
46
|
+
plugins.push(visualizer({
|
|
48
47
|
filename: 'node_modules/.vite/stats.html',
|
|
49
48
|
brotliSize: true,
|
|
50
49
|
gzipSize: true,
|
|
51
50
|
open: true,
|
|
52
51
|
sourcemap: true,
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
}))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
build: {
|
|
57
|
+
modulePreload: {
|
|
58
|
+
polyfill: false,
|
|
59
|
+
},
|
|
60
|
+
sourcemap: mode === 'analyze',
|
|
61
|
+
},
|
|
62
|
+
builder: {
|
|
63
|
+
async buildApp(builder) {
|
|
64
|
+
if (builder.config.mode === 'static') {
|
|
65
|
+
const { build } = await import('vite-ssg/node')
|
|
66
|
+
await build(builder.config.ssgOptions)
|
|
67
|
+
process.exit(0)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
await builder.build(builder.environments.client)
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
plugins,
|
|
74
|
+
ssgOptions: {
|
|
75
|
+
script: 'async',
|
|
76
|
+
formatting: 'minify',
|
|
77
|
+
beastiesOptions: {
|
|
78
|
+
reduceInlineStyles: false,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
ssr: {
|
|
82
|
+
noExternal: ['@kevinmarrec/vue-i18n'],
|
|
60
83
|
},
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
noExternal: ['@kevinmarrec/vue-i18n'],
|
|
64
|
-
},
|
|
65
|
-
}))
|
|
84
|
+
}
|
|
85
|
+
})
|
package/template/compose.yaml
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
include:
|
|
2
|
+
- path: .docker/traefik/service.yaml
|
|
3
|
+
- path: .docker/postgres/service.yaml
|
|
4
|
+
- path: .docker/metabase/service.yaml
|
|
5
|
+
- path: .docker/studio/service.yaml
|
|
6
|
+
- path: .docker/analytics/service.yaml
|
|
7
|
+
- path: .docker/mailpit/service.yaml
|
|
8
|
+
|
|
1
9
|
x-common: &common
|
|
2
10
|
volumes:
|
|
3
11
|
- ./:/code
|
|
@@ -5,95 +13,17 @@ x-common: &common
|
|
|
5
13
|
user: 1000:1000
|
|
6
14
|
|
|
7
15
|
services:
|
|
8
|
-
traefik:
|
|
9
|
-
image: traefik:v3.6
|
|
10
|
-
container_name: traefik
|
|
11
|
-
restart: unless-stopped
|
|
12
|
-
security_opt:
|
|
13
|
-
- no-new-privileges:true
|
|
14
|
-
command:
|
|
15
|
-
# General configuration
|
|
16
|
-
- --api.dashboard=true
|
|
17
|
-
- --ping=true
|
|
18
|
-
- --log.level=INFO
|
|
19
|
-
# Entrypoints for HTTP and HTTPS
|
|
20
|
-
- --entrypoints.websecure.address=:443
|
|
21
|
-
- --entrypoints.web.address=:80
|
|
22
|
-
# Redirect HTTP to HTTPS
|
|
23
|
-
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
|
24
|
-
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
|
25
|
-
# Providers (Docker & File for dynamic config)
|
|
26
|
-
- --providers.docker=true
|
|
27
|
-
- --providers.docker.exposedbydefault=false
|
|
28
|
-
- --providers.file.directory=/etc/traefik/dynamic
|
|
29
|
-
- --providers.file.watch=true
|
|
30
|
-
ports:
|
|
31
|
-
- 80:80
|
|
32
|
-
- 443:443
|
|
33
|
-
volumes:
|
|
34
|
-
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
35
|
-
- ./.docker/traefik/dynamic:/etc/traefik/dynamic:ro # Mount the dynamic config directory
|
|
36
|
-
- ./.docker/traefik/certs:/certs:ro # Mount the certs directory
|
|
37
|
-
healthcheck:
|
|
38
|
-
test: [CMD-SHELL, traefik healthcheck --ping]
|
|
39
|
-
interval: 1s
|
|
40
|
-
timeout: 1s
|
|
41
|
-
retries: 10
|
|
42
|
-
labels:
|
|
43
|
-
traefik.enable: 'true'
|
|
44
|
-
traefik.http.routers.traefik.rule: Host(`traefik.dev.localhost`)
|
|
45
|
-
traefik.http.routers.traefik.entrypoints: websecure
|
|
46
|
-
traefik.http.routers.traefik.tls: 'true'
|
|
47
|
-
traefik.http.routers.traefik.service: api@internal
|
|
48
|
-
|
|
49
|
-
postgres:
|
|
50
|
-
image: postgres:18-alpine
|
|
51
|
-
container_name: postgres
|
|
52
|
-
environment:
|
|
53
|
-
- POSTGRES_USER=user
|
|
54
|
-
- POSTGRES_PASSWORD=password
|
|
55
|
-
- POSTGRES_DB=app
|
|
56
|
-
ports:
|
|
57
|
-
- 5432:5432
|
|
58
|
-
volumes:
|
|
59
|
-
- postgres_data:/var/lib/postgresql/data
|
|
60
|
-
healthcheck:
|
|
61
|
-
test: [CMD-SHELL, "psql postgresql://user:password@postgres:5432/app -c 'SELECT 1' 2> /dev/null"]
|
|
62
|
-
interval: 1s
|
|
63
|
-
timeout: 1s
|
|
64
|
-
retries: 10
|
|
65
|
-
|
|
66
|
-
metabase:
|
|
67
|
-
image: metabase/metabase:v0.57.x
|
|
68
|
-
container_name: metabase
|
|
69
|
-
environment:
|
|
70
|
-
- MB_DB_TYPE=h2
|
|
71
|
-
- MB_DB_FILE=/var/lib/metabase/metabase.db
|
|
72
|
-
- MB_SITE_URL=https://metabase.dev.localhost
|
|
73
|
-
volumes:
|
|
74
|
-
- metabase_data:/var/lib/metabase
|
|
75
|
-
healthcheck:
|
|
76
|
-
test: [CMD-SHELL, curl -f http://localhost:3000/api/health]
|
|
77
|
-
interval: 1s
|
|
78
|
-
timeout: 1s
|
|
79
|
-
retries: 20
|
|
80
|
-
labels:
|
|
81
|
-
traefik.enable: 'true'
|
|
82
|
-
traefik.http.routers.metabase.rule: Host(`metabase.dev.localhost`)
|
|
83
|
-
traefik.http.routers.metabase.entrypoints: websecure
|
|
84
|
-
traefik.http.routers.metabase.tls: 'true'
|
|
85
|
-
traefik.http.services.metabase.loadbalancer.server.port: '3000'
|
|
86
16
|
|
|
87
17
|
api:
|
|
88
18
|
<<: *common
|
|
19
|
+
image: oven/bun:1.3.3-alpine
|
|
20
|
+
container_name: api
|
|
21
|
+
init: true
|
|
89
22
|
depends_on:
|
|
90
23
|
traefik:
|
|
91
24
|
condition: service_healthy
|
|
92
25
|
postgres:
|
|
93
26
|
condition: service_healthy
|
|
94
|
-
container_name: api
|
|
95
|
-
image: oven/bun:1-alpine
|
|
96
|
-
init: true
|
|
97
27
|
command: [bun, --cwd, api, dev]
|
|
98
28
|
environment:
|
|
99
29
|
- FORCE_COLOR=1
|
|
@@ -106,11 +36,11 @@ services:
|
|
|
106
36
|
|
|
107
37
|
app:
|
|
108
38
|
<<: *common
|
|
109
|
-
|
|
110
|
-
- api
|
|
39
|
+
image: imbios/bun-node:1.3.3-24-alpine
|
|
111
40
|
container_name: app
|
|
112
|
-
image: imbios/bun-node:24-alpine
|
|
113
41
|
init: true
|
|
42
|
+
depends_on:
|
|
43
|
+
- api
|
|
114
44
|
command: [bun, --cwd, app, dev, --host, 0.0.0.0]
|
|
115
45
|
environment:
|
|
116
46
|
- FORCE_COLOR=1
|
|
@@ -124,7 +54,3 @@ services:
|
|
|
124
54
|
networks:
|
|
125
55
|
default:
|
|
126
56
|
name: dev
|
|
127
|
-
|
|
128
|
-
volumes:
|
|
129
|
-
postgres_data:
|
|
130
|
-
metabase_data:
|
package/template/knip.config.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { KnipConfig } from 'knip'
|
|
|
2
2
|
|
|
3
3
|
// Required for Knip to pass
|
|
4
4
|
Object.assign(import.meta.env, {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
ALLOWED_ORIGINS: 'https://foo.bar',
|
|
6
|
+
AUTH_SECRET: 'foo',
|
|
7
|
+
DATABASE_URL: 'postgresql://foo:bar@localhost:5432/foo',
|
|
7
8
|
})
|
|
8
9
|
|
|
9
10
|
export default {
|
package/template/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "project",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"private": true,
|
|
5
|
-
"packageManager": "bun@1.3.
|
|
5
|
+
"packageManager": "bun@1.3.3",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "lts/*"
|
|
8
8
|
},
|
|
@@ -16,21 +16,22 @@
|
|
|
16
16
|
"check:stylelint": "stylelint '**/*.{css,scss,vue}' --ignorePath .gitignore --cache",
|
|
17
17
|
"check:types": "vue-tsc --noEmit",
|
|
18
18
|
"check:unused": "knip -n",
|
|
19
|
+
"dev": "docker compose",
|
|
19
20
|
"lint": "bun run check:eslint && bun run check:stylelint",
|
|
20
21
|
"lint:inspect": "bunx @eslint/config-inspector",
|
|
21
22
|
"update": "bunx taze -I -rwi"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"@kevinmarrec/eslint-config": "^1.5.
|
|
25
|
-
"@kevinmarrec/stylelint-config": "^1.5.
|
|
26
|
-
"@kevinmarrec/tsconfig": "^1.5.
|
|
25
|
+
"@kevinmarrec/eslint-config": "^1.5.8",
|
|
26
|
+
"@kevinmarrec/stylelint-config": "^1.5.8",
|
|
27
|
+
"@kevinmarrec/tsconfig": "^1.5.8",
|
|
27
28
|
"eslint": "^9.39.1",
|
|
28
29
|
"filesize": "^11.0.13",
|
|
29
|
-
"knip": "^5.
|
|
30
|
-
"stylelint": "^16.
|
|
30
|
+
"knip": "^5.70.2",
|
|
31
|
+
"stylelint": "^16.26.1",
|
|
31
32
|
"tinyexec": "^1.0.2",
|
|
32
33
|
"tinyglobby": "^0.2.15",
|
|
33
34
|
"typescript": "~5.9.3",
|
|
34
|
-
"vue-tsc": "^3.1.
|
|
35
|
+
"vue-tsc": "^3.1.5"
|
|
35
36
|
}
|
|
36
37
|
}
|