7 Commits
Author SHA1 Message Date
FernandoJVideira 39678f3ea6 Merge pull request 'Make generated Vue monorepos buildable with docker compose' (#9) from fix/vue-monorepo-docker into main
Reviewed-on: #9
2026-09-16 12:27:07 +00:00
FernandoJVideiraandClaude Fable 5.1 230037c5f5 Make generated Vue monorepos buildable with docker compose
Running `draft new monorepo` with the Vue client and then
`docker compose build client` failed three separate ways, each found by
actually doing it:

- No Dockerfile: the Vue overlay never shipped one. The template now has
  an nginx-based image (project-template#4) and the client-vue sync job
  embeds it plus its nginx.conf.template, with the pnpm pin rewritten to
  the local version like the Nuxt overlay.
- Stale root lockfile: the Vue scaffold wrote a pnpm-workspace.yaml into
  apps/client (to approve vue-demi's build script), which made it its own
  workspace, so the installs updated a nested lockfile and the root one
  kept describing the template's Nuxt client - pnpm install
  --frozen-lockfile then refused it. The file is only written when the
  client isn't already inside a workspace (standalone `draft new client`).
- Missing component: the client-vue job listed components by name, so the
  AuthCard.vue that Login/Signup import was never embedded. It now embeds
  src/components/ as a whole.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 13:22:37 +01:00
FernandoJVideira 1195fdacb5 Merge pull request 'v0.2.0: ship the client Dockerfile with generated Nuxt apps' (#8) from chore/v0.2.0 into main
Reviewed-on: #8
2026-09-16 12:09:31 +00:00
FernandoJVideiraandClaude Fable 5.1 2f1ad93a74 Ship the client Dockerfile with generated Nuxt apps; bump to v0.2.0
A generated monorepo's docker-compose.yml already built apps/client from
apps/client/Dockerfile, but the client overlay only embedded app/ and
public/, so the file never existed and `docker compose build client`
failed on every fresh project. The client-nuxt sync job now embeds the
template's Dockerfile too, and the Nuxt scaffold rewrites its pnpm pin to
the locally detected version - the one that produces the generated
project's lockfile - the same way it already stamps packageManager.

Bumps the submodule to the template commit that mounts ~/.npmrc as a
build secret for the registry token, and the Makefile VERSION to v0.2.0
for the release.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-16 13:08:18 +01:00
FernandoJVideira b3ea1013bc Merge pull request 'Release: vue-ui-kit client scaffolding' (#7) from dev into main
Reviewed-on: #7
2026-09-16 11:57:52 +00:00
FernandoJVideira 4806186ae6 Merge pull request 'Dev' (#5) from dev into main
Reviewed-on: #5
2026-08-25 21:03:41 +00:00
FernandoJVideira dff28b1a4c Merge pull request 'Version 0.1.0' (#3) from dev into main
Reviewed-on: #3
2026-08-25 20:42:49 +00:00
5 changed files with 43 additions and 12 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
PKG_NAME := git.fernandovideira.com/FernandoJVideira/draft
VERSION := v0.1.0
VERSION := v0.2.0
GO_SOURCES := $(shell find . -name '*.go' -not -path './assets/testdata/*')
.PHONY: version build windows win-arm linux mac prepare-embed clean
+1 -1
View File
@@ -85,7 +85,7 @@ draft new client
3. Scaffolds the base app via the official tooling (`nuxi init` for Nuxt, `create-vue` for Vue), so the generated boilerplate, dependency versions, and lockfile are always current rather than pinned by Draft
4. Layers a Draft-maintained overlay on top: an auth store (login/logout/register/token refresh), route guards, API composable, and pages for login/signup/profile/organizations/email verification/invites — all wired up to talk to a Draft-generated API out of the box
Both frameworks produce a comparable app: [`vue-ui-kit`](https://git.fernandovideira.com/FernandoJVideira/vue-ui-kit) (installed from its own Gitea npm registry - see its README for the one-time `.npmrc` token setup) + Tailwind, the same component library and theme tokens on either framework.
Both frameworks produce a comparable app: [`vue-ui-kit`](https://git.fernandovideira.com/FernandoJVideira/vue-ui-kit) (installed from its own Gitea npm registry - see its README for the one-time `.npmrc` token setup) + Tailwind, the same component library and theme tokens on either framework. Both clients ship with a Dockerfile that mounts that `~/.npmrc` as a build secret (wired up in the monorepo's `docker-compose.yml`), so container builds resolve the package without baking the token into the image - Nuxt runs its Nitro server, Vue is served by nginx with an SPA fallback and `/api/` proxied to the api container.
### Create a New Monorepo Project
+36 -6
View File
@@ -68,8 +68,15 @@ func scaffoldClientNuxt(projectDir, serviceName string) error {
return fmt.Errorf("error running nuxi init: %w", err)
}
version, err := pnpmVersion()
if err != nil {
return fmt.Errorf("error detecting pnpm version: %w", err)
}
replacements := map[string]string{
"App Template": serviceName,
// The overlay's Dockerfile pins the pnpm that produced the template's
// lockfile; the generated project's lockfile comes from the local pnpm.
"[email protected]": "pnpm@" + version,
}
if err := copyEmbeddedDir("embedded/client-nuxt", projectDir, replacements); err != nil {
return fmt.Errorf("error copying client overlay: %w", err)
@@ -146,6 +153,19 @@ func patchNuxtConfig(projectDir, serviceName string) error {
return os.WriteFile(configPath, []byte(finalContent), 0644)
}
func insidePnpmWorkspace(dir string) bool {
for {
if _, err := os.Stat(filepath.Join(dir, "pnpm-workspace.yaml")); err == nil {
return true
}
parent := filepath.Dir(dir)
if parent == dir {
return false
}
dir = parent
}
}
func scaffoldClientVue(projectDir, serviceName string) error {
parentDir := filepath.Dir(projectDir)
leafName := filepath.Base(projectDir)
@@ -166,12 +186,19 @@ func scaffoldClientVue(projectDir, serviceName string) error {
return err
}
if err := os.WriteFile(
filepath.Join(projectDir, "pnpm-workspace.yaml"),
[]byte("allowBuilds:\n vue-demi: true\n"),
0644,
); err != nil {
return fmt.Errorf("error writing pnpm-workspace.yaml: %w", err)
// A standalone client is its own workspace root and needs vue-demi's build
// script approved. Inside a monorepo the root pnpm-workspace.yaml already
// does that - and writing one here would make apps/client a separate
// workspace, so the installs below would update a nested lockfile and
// leave the root one describing the template's client instead of this one.
if !insidePnpmWorkspace(parentDir) {
if err := os.WriteFile(
filepath.Join(projectDir, "pnpm-workspace.yaml"),
[]byte("allowBuilds:\n vue-demi: true\n"),
0644,
); err != nil {
return fmt.Errorf("error writing pnpm-workspace.yaml: %w", err)
}
}
fmt.Println("📦 Installing base dependencies...")
@@ -203,6 +230,9 @@ func scaffoldClientVue(projectDir, serviceName string) error {
replacements := map[string]string{
"App Template": serviceName,
// The overlay's Dockerfile pins the pnpm that produced the template's
// lockfile; the generated project's lockfile comes from the local pnpm.
"[email protected]": "pnpm@" + version,
}
if err := copyEmbeddedDir("embedded/client-vue", projectDir, replacements); err != nil {
return fmt.Errorf("error copying client overlay: %w", err)
+4 -3
View File
@@ -39,7 +39,7 @@ var jobs = []syncJob{
templateName: "client-nuxt",
sourceDir: "assets/testdata/template/apps/client",
targetDir: "assets/embedded/client-nuxt",
includePrefixes: []string{"app/", "public/"},
includePrefixes: []string{"app/", "public/", "Dockerfile"},
},
{
templateName: "client-vue",
@@ -52,11 +52,12 @@ var jobs = []syncJob{
"src/stores/",
"src/composables/",
"src/lib/api-client.ts",
"src/components/AppBrand.vue",
"src/components/AppLayout.vue",
"src/components/",
"src/views/",
"src/shared/",
".env.example",
"Dockerfile",
"nginx.conf.template",
},
},
}