create-wervt 0.2.17 → 0.2.19
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/package.json
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: preview
|
|
2
|
+
|
|
3
|
+
# Deploys every pull request to its own preview, <app>--pr-<number>, and deletes it once the pull
|
|
4
|
+
# request is closed or merged. Uses the same WERVT_TOKEN and WERVT_URL as deploy.yml. A preview
|
|
5
|
+
# starts with an empty database, lets in who the app lets in and gets the app's env, with the
|
|
6
|
+
# preview env on top (`wervt env <app> --preview --set KEY=value`, or Preview variables in the
|
|
7
|
+
# dashboard). The pull request shows the preview's URL under Deployments.
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
pull_request:
|
|
11
|
+
types: [opened, reopened, synchronize, closed]
|
|
12
|
+
|
|
13
|
+
# One run per pull request; a newer push or the close replaces a deploy still running.
|
|
14
|
+
concurrency:
|
|
15
|
+
group: preview-${{ github.event.pull_request.number }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
deploy:
|
|
23
|
+
# Pull requests from forks get no secrets, and their code shouldn't get the app's env anyway.
|
|
24
|
+
if: github.event.action != 'closed' && github.event.pull_request.head.repo.full_name == github.repository
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
environment:
|
|
27
|
+
name: preview
|
|
28
|
+
url: ${{ steps.deploy.outputs.url }}
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
31
|
+
|
|
32
|
+
# The pnpm version comes from packageManager in package.json.
|
|
33
|
+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
34
|
+
|
|
35
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
36
|
+
with:
|
|
37
|
+
node-version: 24
|
|
38
|
+
cache: pnpm
|
|
39
|
+
|
|
40
|
+
- run: pnpm install --frozen-lockfile
|
|
41
|
+
|
|
42
|
+
- id: deploy
|
|
43
|
+
run: pnpm exec wervt deploy --preview pr-${{ github.event.pull_request.number }}
|
|
44
|
+
env:
|
|
45
|
+
WERVT_URL: ${{ vars.WERVT_URL }}
|
|
46
|
+
WERVT_TOKEN: ${{ secrets.WERVT_TOKEN }}
|
|
47
|
+
|
|
48
|
+
remove:
|
|
49
|
+
if: github.event.action == 'closed' && github.event.pull_request.head.repo.full_name == github.repository
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
steps:
|
|
52
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
53
|
+
|
|
54
|
+
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
55
|
+
|
|
56
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
57
|
+
with:
|
|
58
|
+
node-version: 24
|
|
59
|
+
cache: pnpm
|
|
60
|
+
|
|
61
|
+
- run: pnpm install --frozen-lockfile
|
|
62
|
+
|
|
63
|
+
# Drops the preview's database and files too. A preview that never deployed is fine.
|
|
64
|
+
- run: pnpm exec wervt delete --preview pr-${{ github.event.pull_request.number }} --yes || true
|
|
65
|
+
env:
|
|
66
|
+
WERVT_URL: ${{ vars.WERVT_URL }}
|
|
67
|
+
WERVT_TOKEN: ${{ secrets.WERVT_TOKEN }}
|
package/template/AGENTS.md
CHANGED
|
@@ -118,6 +118,9 @@ const rows = await useDb().select().from(todos).where(eq(todos.done, false))
|
|
|
118
118
|
- For relational queries (`db.query.rooms.findFirst({ with: … })`), define relations with
|
|
119
119
|
`defineRelations` in `server/db/relations.ts` and use `useDb({ relations })`.
|
|
120
120
|
- No raw SQL against other schemas, `public`, or system catalogs: the role can't access them.
|
|
121
|
+
- `vector` (pgvector: `vector({ dimensions })` columns, `cosineDistance`), `pg_trgm`, `unaccent`
|
|
122
|
+
and `citext` are installed for every app. Use their types and functions unqualified; never write
|
|
123
|
+
`CREATE EXTENSION` into a migration.
|
|
121
124
|
|
|
122
125
|
### Seeding
|
|
123
126
|
|
|
@@ -186,6 +189,9 @@ version polling. For a banner in the app's own design, set `wervt: { updates: 'm
|
|
|
186
189
|
auto-imported) give the signed-in wervt user or nothing. Private apps always have one; public
|
|
187
190
|
apps only when the visitor signed in. It works with `ssr: false` too (no own `/api/me` needed). Link to `wervtLoginUrl(path)` / `wervtLogoutUrl(path)` as
|
|
188
191
|
external links. Never build your own login or OAuth.
|
|
192
|
+
- Name, picture and email change on wervt's account page: link to `wervtAccountUrl(path)`
|
|
193
|
+
(external), which shows it in the app's look and comes back. Don't build forms that change
|
|
194
|
+
them; keep app-only profile data (bio, display name) in the app's tables under `user.id`.
|
|
189
195
|
- Users are one row per wervt account: key them by `user.id`, not by email (addresses change).
|
|
190
196
|
When an admin merges two accounts of the same person, wervt runs the task
|
|
191
197
|
`wervt:account-merged` (`server/tasks/wervt/account-merged.ts`) with
|
|
@@ -220,6 +226,11 @@ own bucket and `@wervt/nuxt` connects it; don't configure a provider or S3 crede
|
|
|
220
226
|
three routes plus `useDirectUpload()` on the page, so browsers upload straight to the bucket;
|
|
221
227
|
serve them with `signedUrl(file)`, a presigned link to the bucket.
|
|
222
228
|
- No tus uploads and no `transform` / sharp: they need a disk and native modules.
|
|
229
|
+
- Images: never resize in the app. `imageUrl(file, { width: 800 })` from `@wervt/nuxt/server`
|
|
230
|
+
returns a URL on the app's own host where wervt serves that size (`fit: 'fill'`, `gravity`,
|
|
231
|
+
`crop`, `rotate`, `format`, `quality`, `keepMetadata`, `download`, `expiresIn`); HEIC works as a
|
|
232
|
+
source. Build the URLs in a route after checking access: whoever has one can load that image.
|
|
233
|
+
`fetchImage(file, options)` loads such a version on the server (pixels, a converted copy).
|
|
223
234
|
- Check access in the route before serving a file.
|
|
224
235
|
|
|
225
236
|
## Real-world things
|
|
@@ -473,6 +484,12 @@ Queries are LogsQL. Logs may contain user data: quote only what's needed.
|
|
|
473
484
|
- Deploys: pushing to `main` deploys through `.github/workflows/deploy.yml`.
|
|
474
485
|
`pnpm exec wervt releases <app>` lists releases with their commits. Don't deploy, roll back or
|
|
475
486
|
create deploy tokens unless asked.
|
|
487
|
+
- Pull requests get a preview at `https://<app>--pr-<number>.wervt.app`
|
|
488
|
+
(`.github/workflows/preview.yml`), deleted when the pull request closes. It has its own empty
|
|
489
|
+
database (seed it with `pnpm exec wervt tasks <app>--pr-<number> --run db:seed`), the app's
|
|
490
|
+
access rules and env, with preview-only values on top:
|
|
491
|
+
`pnpm exec wervt env <app> --preview --set NUXT_<KEY>=…` (from the previews' next deploy).
|
|
492
|
+
Test changes on a preview instead of deploying them to production.
|
|
476
493
|
|
|
477
494
|
## Checking the deployed app
|
|
478
495
|
|
package/template/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"postinstall": "nuxt prepare"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@wervt/nuxt": "^0.3.
|
|
13
|
+
"@wervt/nuxt": "^0.3.20",
|
|
14
14
|
"drizzle-orm": "1.0.0-rc.5",
|
|
15
15
|
"nuxt": "npm:nuxt-nightly@5x",
|
|
16
16
|
"valibot": "^1.5.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@golar/vue": "^0.1.11",
|
|
21
|
-
"@wervt/cli": "^0.2.
|
|
21
|
+
"@wervt/cli": "^0.2.27",
|
|
22
22
|
"drizzle-kit": "1.0.0-rc.5",
|
|
23
23
|
"golar": "^0.1.11",
|
|
24
24
|
"vite-plus": "^1.3.0"
|
|
@@ -6,3 +6,7 @@ allowBuilds:
|
|
|
6
6
|
minimumReleaseAgeExclude:
|
|
7
7
|
# wervt's own packages, so a new app gets the release that was just published.
|
|
8
8
|
- '@wervt/*'
|
|
9
|
+
overrides:
|
|
10
|
+
# A module names `nuxt` as its peer. A package manager that does not take the aliased nightly
|
|
11
|
+
# for it installs stable Nuxt next to it, and its devtools with it.
|
|
12
|
+
nuxt: npm:nuxt-nightly@5x
|