@ghentcdh/create-crouton 0.0.1-alpha.28 → 0.0.1-alpha.30
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/dist/templates/docker/Dockerfile.dev.tmpl +1 -0
- package/dist/templates/docker/Dockerfile.prod.tmpl +1 -0
- package/dist/templates/docker/compose.yml.tmpl +6 -9
- package/dist/templates/nx/root/.gitignore.tmpl +1 -0
- package/dist/templates/nx/root/package.json.tmpl +1 -1
- package/dist/templates/nx/root/pnpm-workspace.yaml.tmpl +2 -0
- package/dist/templates/nx/workspace/.env.tmpl +3 -0
- package/dist/templates/nx/workspace/apps/backend/project.json.tmpl +1 -1
- package/dist/templates/nx/workspace/apps/frontend/Caddyfile.tmpl +44 -0
- package/dist/templates/nx/workspace/apps/frontend/Dockerfile.tmpl +51 -0
- package/dist/templates/nx/workspace/apps/frontend/docker-entrypoint.sh.tmpl +34 -0
- package/dist/templates/nx/workspace/apps/frontend/public/config.json.tmpl +5 -0
- package/dist/templates/nx/workspace/apps/frontend/src/App.vue.tmpl +3 -1
- package/dist/templates/nx/workspace/apps/frontend/src/main.ts.tmpl +20 -19
- package/dist/templates/nx/workspace/apps/frontend/src/router.ts.tmpl +13 -0
- package/dist/templates/nx/workspace/apps/frontend/src/style.css.tmpl +1 -33
- package/package.json +2 -2
|
@@ -2,14 +2,13 @@ services:
|
|
|
2
2
|
db:
|
|
3
3
|
image: postgres:17
|
|
4
4
|
restart: unless-stopped
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
POSTGRES_PASSWORD: crouton
|
|
8
|
-
POSTGRES_DB: {{name}}
|
|
5
|
+
env_file:
|
|
6
|
+
- .env
|
|
9
7
|
ports:
|
|
10
8
|
- "5432:5432"
|
|
11
9
|
volumes:
|
|
12
|
-
- pgdata:/var/lib/postgresql/data
|
|
10
|
+
- ./var/pgdata:/var/lib/postgresql/data
|
|
11
|
+
- ./docker/init-data:/docker-entrypoint-initdb.d
|
|
13
12
|
|
|
14
13
|
app:
|
|
15
14
|
build:
|
|
@@ -20,11 +19,9 @@ services:
|
|
|
20
19
|
- db
|
|
21
20
|
ports:
|
|
22
21
|
- "3000:3000"
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
env_file:
|
|
23
|
+
- .env
|
|
25
24
|
volumes:
|
|
26
25
|
- .:/app
|
|
27
26
|
- /app/node_modules
|
|
28
27
|
|
|
29
|
-
volumes:
|
|
30
|
-
pgdata:
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
:9000 {
|
|
2
|
+
# Root directory for static files
|
|
3
|
+
root * /srv
|
|
4
|
+
|
|
5
|
+
# Enable gzip compression
|
|
6
|
+
encode gzip
|
|
7
|
+
|
|
8
|
+
# Health check endpoint
|
|
9
|
+
handle /health {
|
|
10
|
+
rewrite * /health.json
|
|
11
|
+
root * /srv
|
|
12
|
+
file_server
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
handle /* {
|
|
16
|
+
try_files {path} {path} / /index.html
|
|
17
|
+
file_server
|
|
18
|
+
|
|
19
|
+
# Cache static assets
|
|
20
|
+
@static {
|
|
21
|
+
path *.js *.css *.png *.jpg *.jpeg *.gif *.svg *.ico *.woff *.woff2 *.ttf *.eot *.webp *.avif
|
|
22
|
+
}
|
|
23
|
+
header @static Cache-Control "public, max-age=31536000, immutable"
|
|
24
|
+
|
|
25
|
+
# Don't cache HTML
|
|
26
|
+
@html {
|
|
27
|
+
path *.html
|
|
28
|
+
}
|
|
29
|
+
header @html Cache-Control "public, max-age=0, must-revalidate"
|
|
30
|
+
|
|
31
|
+
# Cache JSON data briefly
|
|
32
|
+
@json {
|
|
33
|
+
path *.json
|
|
34
|
+
}
|
|
35
|
+
header @json Cache-Control "public, max-age=3600, must-revalidate"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Logging
|
|
39
|
+
log {
|
|
40
|
+
output stdout
|
|
41
|
+
format console
|
|
42
|
+
level INFO
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1.7-labs
|
|
2
|
+
# Multi-stage build: Build Vue app, then serve with Caddy
|
|
3
|
+
|
|
4
|
+
FROM node:24-alpine AS build
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
# Enable pnpm
|
|
9
|
+
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
10
|
+
ENV CI=true
|
|
11
|
+
|
|
12
|
+
# Copy package.json files for dependency caching
|
|
13
|
+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
|
14
|
+
COPY --parents apps/*/package.json generated/*/package.json ./
|
|
15
|
+
|
|
16
|
+
# Install dependencies
|
|
17
|
+
RUN pnpm install --frozen-lockfile
|
|
18
|
+
|
|
19
|
+
# Copy source code
|
|
20
|
+
COPY . .
|
|
21
|
+
|
|
22
|
+
# Build the Vue app
|
|
23
|
+
RUN NX_DAEMON=false pnpm exec nx build {{#if prefix}}{{prefix}}-{{/if}}frontend --prod
|
|
24
|
+
|
|
25
|
+
# Production stage with Caddy web server
|
|
26
|
+
FROM caddy:2-alpine
|
|
27
|
+
|
|
28
|
+
# Build arguments for version and git sha
|
|
29
|
+
ARG VERSION
|
|
30
|
+
ARG BUILD_SHA
|
|
31
|
+
|
|
32
|
+
# Set as environment variables for runtime
|
|
33
|
+
ENV APP_VERSION=${VERSION:-unknown}
|
|
34
|
+
ENV BUILD_SHA=${BUILD_SHA:-unknown}
|
|
35
|
+
ENV NODE_ENV=production
|
|
36
|
+
|
|
37
|
+
# Copy entrypoint script
|
|
38
|
+
COPY --from=build /app/{{appsRoot}}/frontend/docker-entrypoint.sh /docker-entrypoint.sh
|
|
39
|
+
RUN chmod +x /docker-entrypoint.sh
|
|
40
|
+
|
|
41
|
+
# Copy Caddy configuration
|
|
42
|
+
COPY --from=build /app/{{appsRoot}}/frontend/Caddyfile /etc/caddy/Caddyfile
|
|
43
|
+
|
|
44
|
+
# Copy built assets from build stage
|
|
45
|
+
COPY --from=build /app/dist/apps/frontend /srv
|
|
46
|
+
|
|
47
|
+
# Expose port 9000
|
|
48
|
+
EXPOSE 9000
|
|
49
|
+
|
|
50
|
+
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
51
|
+
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Generate runtime config for the frontend
|
|
5
|
+
cat > /srv/config.json <<EOF
|
|
6
|
+
{
|
|
7
|
+
"APP_VERSION": "${APP_VERSION:-unknown}",
|
|
8
|
+
"BUILD_SHA": "${BUILD_SHA:-unknown}",
|
|
9
|
+
"ENVIRONMENT": "${ENVIRONMENT:-unknown}",
|
|
10
|
+
"env": "${NODE_ENV:-PRD}",
|
|
11
|
+
"API_URL": "${API_URL:-/api}"
|
|
12
|
+
}
|
|
13
|
+
EOF
|
|
14
|
+
|
|
15
|
+
echo "Generated /srv/config.json with runtime configuration"
|
|
16
|
+
|
|
17
|
+
# Generate health config for the frontend
|
|
18
|
+
cat > /srv/health.json <<EOF
|
|
19
|
+
{
|
|
20
|
+
"status": "ok",
|
|
21
|
+
"version": "${APP_VERSION:-unknown}",
|
|
22
|
+
"buildSha": "${BUILD_SHA:-unknown}",
|
|
23
|
+
"env": "${NODE_ENV:-DEV}",
|
|
24
|
+
"environment": "${ENVIRONMENT:-unknown}",
|
|
25
|
+
"service": "frontend"
|
|
26
|
+
}
|
|
27
|
+
EOF
|
|
28
|
+
|
|
29
|
+
echo "Generated /srv/health.json with runtime configuration"
|
|
30
|
+
|
|
31
|
+
# Execute the main command if provided
|
|
32
|
+
if [ $# -gt 0 ]; then
|
|
33
|
+
exec "$@"
|
|
34
|
+
fi
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import './style.css';
|
|
2
2
|
import { createApp } from 'vue';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
useCrouton,
|
|
5
|
+
loadRuntimeConfig,
|
|
6
|
+
getRuntimeConfig,
|
|
7
|
+
} from '@ghentcdh/crouton-vue';
|
|
5
8
|
import { api } from './api';
|
|
9
|
+
import { router } from './router';
|
|
6
10
|
import App from './App.vue';
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
children: [...CroutonRouter],
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
});
|
|
12
|
+
loadRuntimeConfig().then(() => {
|
|
13
|
+
const env = getRuntimeConfig();
|
|
14
|
+
const VERSION =
|
|
15
|
+
env.env === 'PRD'
|
|
16
|
+
? env.APP_VERSION
|
|
17
|
+
: `${env.APP_VERSION} (${env.env})`;
|
|
18
18
|
|
|
19
|
-
useCrouton()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
useCrouton()
|
|
20
|
+
.init(api, { VERSION, title: '{{Name}}' })
|
|
21
|
+
.then(() => {
|
|
22
|
+
const app = createApp(App);
|
|
23
|
+
app.use(router);
|
|
24
|
+
app.mount('#app');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
|
+
import { CroutonRouter } from '@ghentcdh/crouton-vue';
|
|
3
|
+
|
|
4
|
+
export const router = createRouter({
|
|
5
|
+
history: createWebHistory(),
|
|
6
|
+
routes: [
|
|
7
|
+
{
|
|
8
|
+
path: '/',
|
|
9
|
+
name: 'admin',
|
|
10
|
+
children: [...CroutonRouter],
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
});
|
|
@@ -1,38 +1,6 @@
|
|
|
1
1
|
/* App Tailwind build (processed by @tailwindcss/vite). */
|
|
2
2
|
@import 'tailwindcss';
|
|
3
3
|
|
|
4
|
-
/*
|
|
5
|
-
* Compiled crouton styles — already wraps @ghentcdh/ui/index.css (preflight,
|
|
6
|
-
* daisyUI + ugent theme, ui components) plus crouton's own utilities.
|
|
7
|
-
*/
|
|
8
|
-
@import '@ghentcdh/ui/index.css';
|
|
9
4
|
@import '@ghentcdh/crouton-vue/styles.css';
|
|
10
5
|
|
|
11
|
-
@source './';
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
* Expose the daisyUI theme colors (defined at runtime by the ugent theme)
|
|
15
|
-
* as Tailwind tokens, so app sources can use `text-primary`, `bg-base-200`, …
|
|
16
|
-
*/
|
|
17
|
-
@theme inline {
|
|
18
|
-
--color-base-100: var(--color-base-100);
|
|
19
|
-
--color-base-200: var(--color-base-200);
|
|
20
|
-
--color-base-300: var(--color-base-300);
|
|
21
|
-
--color-base-content: var(--color-base-content);
|
|
22
|
-
--color-primary: var(--color-primary);
|
|
23
|
-
--color-primary-content: var(--color-primary-content);
|
|
24
|
-
--color-secondary: var(--color-secondary);
|
|
25
|
-
--color-secondary-content: var(--color-secondary-content);
|
|
26
|
-
--color-accent: var(--color-accent);
|
|
27
|
-
--color-accent-content: var(--color-accent-content);
|
|
28
|
-
--color-neutral: var(--color-neutral);
|
|
29
|
-
--color-neutral-content: var(--color-neutral-content);
|
|
30
|
-
--color-info: var(--color-info);
|
|
31
|
-
--color-info-content: var(--color-info-content);
|
|
32
|
-
--color-success: var(--color-success);
|
|
33
|
-
--color-success-content: var(--color-success-content);
|
|
34
|
-
--color-warning: var(--color-warning);
|
|
35
|
-
--color-warning-content: var(--color-warning-content);
|
|
36
|
-
--color-error: var(--color-error);
|
|
37
|
-
--color-error-content: var(--color-error-content);
|
|
38
|
-
}
|
|
6
|
+
@source './';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghentcdh/create-crouton",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.30",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"tag": "alpha"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"picocolors": "^1.1.0",
|
|
32
32
|
"tsup": "^8.0.0",
|
|
33
33
|
"@ghentcdh/crouton-codegen": "0.0.1",
|
|
34
|
-
"@ghentcdh/crouton-cli": "0.0.1-alpha.
|
|
34
|
+
"@ghentcdh/crouton-cli": "0.0.1-alpha.30"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsup",
|