create-snagset 0.0.2 → 0.0.4
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 +18 -6
- package/dist/index.js +8 -6
- package/dist/template/README.md +25 -12
- package/dist/template/_env.example +2 -1
- package/package.json +1 -1
- package/dist/template/compose.yml +0 -40
package/README.md
CHANGED
|
@@ -4,14 +4,27 @@ Scaffold a self-hosted **[Snagset](https://github.com/snagset/snagset)** instanc
|
|
|
4
4
|
— click-to-comment review for your clients' live sites.
|
|
5
5
|
|
|
6
6
|
```bash
|
|
7
|
-
|
|
7
|
+
pnpm create snagset my-review
|
|
8
8
|
cd my-review
|
|
9
|
-
|
|
9
|
+
pnpm install && pnpm start
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
<details>
|
|
13
|
+
<summary>npm · yarn · bun</summary>
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm create snagset@latest my-review # then: npm install && npm start
|
|
17
|
+
yarn create snagset my-review # then: yarn install && yarn start
|
|
18
|
+
bun create snagset my-review # then: bun install && bun start
|
|
19
|
+
```
|
|
20
|
+
</details>
|
|
21
|
+
|
|
22
|
+
Bring a Postgres URL — a free Neon or Supabase branch, or a local install — and
|
|
23
|
+
put it in `.env` as `DATABASE_URL`. Open `http://localhost:8080` and follow the
|
|
24
|
+
claim URL in the logs.
|
|
25
|
+
|
|
26
|
+
**No Docker, on purpose.** No Dockerfile, no compose file, nothing to build:
|
|
27
|
+
Snagset is a Node process and a Postgres URL.
|
|
15
28
|
|
|
16
29
|
## What you get
|
|
17
30
|
|
|
@@ -19,7 +32,6 @@ A directory with everything an instance needs and nothing it does not:
|
|
|
19
32
|
|
|
20
33
|
| | |
|
|
21
34
|
|---|---|
|
|
22
|
-
| `compose.yml` | The server and a Postgres, for `docker compose up` |
|
|
23
35
|
| `.env` | Configuration. **`DATABASE_URL` is the only required variable** — a signing key is generated into it for you |
|
|
24
36
|
| `package.json` | `@snagset/server` as a dependency, with `start`, `migrate` and `env` scripts |
|
|
25
37
|
| `vercel.json` + `api/index.js` | Deploy to Vercel instead, if you would rather not run anything |
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,9 @@ import { scaffold } from "./scaffold.js";
|
|
|
7
7
|
*/
|
|
8
8
|
const target = process.argv[2];
|
|
9
9
|
if (!target || target.startsWith("-")) {
|
|
10
|
-
process.stderr.write("usage:
|
|
11
|
-
"
|
|
12
|
-
" cd my-review &&
|
|
10
|
+
process.stderr.write("usage: create-snagset <directory>\n\n" +
|
|
11
|
+
" pnpm create snagset my-review\n" +
|
|
12
|
+
" cd my-review && pnpm install && pnpm start\n");
|
|
13
13
|
process.exit(2);
|
|
14
14
|
}
|
|
15
15
|
try {
|
|
@@ -21,9 +21,11 @@ catch (e) {
|
|
|
21
21
|
}
|
|
22
22
|
const name = target.split("/").pop() || "snagset";
|
|
23
23
|
process.stdout.write(`\n ✓ ${name}\n\n` +
|
|
24
|
+
` 1. Put a Postgres URL in .env as DATABASE_URL.\n` +
|
|
25
|
+
` A free Neon or Supabase branch works, so does a local install.\n\n` +
|
|
24
26
|
` cd ${target}\n` +
|
|
25
|
-
`
|
|
26
|
-
`
|
|
27
|
-
`
|
|
27
|
+
` pnpm install && pnpm start\n\n` +
|
|
28
|
+
` (npm, yarn and bun work the same way.)\n\n` +
|
|
29
|
+
` Then open http://localhost:8080 and follow the claim URL in the logs.\n\n` +
|
|
28
30
|
` A signing key was generated into .env. Back it up — without it every\n` +
|
|
29
31
|
` session and stored credential is unrecoverable.\n\n`);
|
package/dist/template/README.md
CHANGED
|
@@ -5,19 +5,32 @@ review for your clients' live sites.
|
|
|
5
5
|
|
|
6
6
|
## Run it
|
|
7
7
|
|
|
8
|
+
You need a Postgres and its connection string. A free
|
|
9
|
+
[Neon](https://neon.tech) or [Supabase](https://supabase.com) branch takes a
|
|
10
|
+
minute and works from anywhere; a local `postgres` install is just as good.
|
|
11
|
+
|
|
12
|
+
Put the URL in `.env` as `DATABASE_URL`, then:
|
|
13
|
+
|
|
8
14
|
```bash
|
|
9
|
-
|
|
15
|
+
pnpm install
|
|
16
|
+
pnpm start
|
|
10
17
|
```
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
**Already have a database?** Put its URL in `.env`, then:
|
|
19
|
+
<details>
|
|
20
|
+
<summary>npm · yarn · bun</summary>
|
|
16
21
|
|
|
17
22
|
```bash
|
|
18
|
-
npm install
|
|
19
|
-
|
|
23
|
+
npm install && npm start
|
|
24
|
+
yarn install && yarn start
|
|
25
|
+
bun install && bun start
|
|
20
26
|
```
|
|
27
|
+
</details>
|
|
28
|
+
|
|
29
|
+
Open http://localhost:8080 and follow the claim URL printed in the logs.
|
|
30
|
+
|
|
31
|
+
**No Docker anywhere in this project, deliberately.** One less thing to
|
|
32
|
+
install, and one less thing between you and a database you can also reach from
|
|
33
|
+
your laptop, your CI and your deploy.
|
|
21
34
|
|
|
22
35
|
## Add a site
|
|
23
36
|
|
|
@@ -28,7 +41,7 @@ Sign in, open **Sites**, and add one. You get a script tag:
|
|
|
28
41
|
```
|
|
29
42
|
|
|
30
43
|
Paste it into the site you want reviewed, before `</body>`. Or install the npm
|
|
31
|
-
package — `
|
|
44
|
+
package — `pnpm add snagset` — and `snagset.init({ host, site })`, or one of the
|
|
32
45
|
framework subpaths: `snagset/react`, `snagset/vue`, `snagset/next`,
|
|
33
46
|
`snagset/vite` (which also covers Nuxt and SvelteKit), `snagset/astro`. They
|
|
34
47
|
all write the same tag.
|
|
@@ -42,8 +55,8 @@ ignored, which is the hardest failure here to spot from the outside.
|
|
|
42
55
|
`.env`. Only `DATABASE_URL` is required.
|
|
43
56
|
|
|
44
57
|
```bash
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
pnpm env # every variable this build accepts, with its default
|
|
59
|
+
pnpm env MAIL # just the ones matching MAIL
|
|
47
60
|
```
|
|
48
61
|
|
|
49
62
|
Screenshots need an S3-compatible bucket (R2, Spaces, MinIO, AWS).
|
|
@@ -63,13 +76,13 @@ nothing would decrypt), and add a release command:
|
|
|
63
76
|
npx snagset migrate
|
|
64
77
|
```
|
|
65
78
|
|
|
66
|
-
**Anything that runs Node.** `
|
|
79
|
+
**Anything that runs Node.** `pnpm start`. It serves the API, the dashboard and
|
|
67
80
|
the widget on one port.
|
|
68
81
|
|
|
69
82
|
## Upgrading
|
|
70
83
|
|
|
71
84
|
```bash
|
|
72
|
-
|
|
85
|
+
pnpm update @snagset/server
|
|
73
86
|
```
|
|
74
87
|
|
|
75
88
|
Migrations run on boot. There is no build step to redo.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# ── Required ───────────────────────────────────────────────────────────
|
|
2
|
-
# Any Postgres 14
|
|
2
|
+
# Any Postgres 14+ — a free Neon or Supabase branch, or a local install.
|
|
3
|
+
# Use the POOLED connection string where your provider offers one.
|
|
3
4
|
DATABASE_URL=postgres://snagset:snagset@localhost:5432/snagset
|
|
4
5
|
|
|
5
6
|
# ── Strongly recommended ───────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# One command: `docker compose up`.
|
|
2
|
-
#
|
|
3
|
-
# Postgres is included so there is nothing to provision before the first run.
|
|
4
|
-
# Point DATABASE_URL at a managed database instead — Neon, Supabase, RDS — and
|
|
5
|
-
# delete the `db` service; nothing else changes.
|
|
6
|
-
services:
|
|
7
|
-
db:
|
|
8
|
-
image: postgres:18-alpine
|
|
9
|
-
environment:
|
|
10
|
-
POSTGRES_USER: snagset
|
|
11
|
-
POSTGRES_PASSWORD: snagset
|
|
12
|
-
POSTGRES_DB: snagset
|
|
13
|
-
ports: ["5432:5432"]
|
|
14
|
-
volumes: ["snagset-db:/var/lib/postgresql/data"]
|
|
15
|
-
healthcheck:
|
|
16
|
-
# The server migrates on boot, so it must not start against a database
|
|
17
|
-
# that is still initialising — the advisory lock would be taken against
|
|
18
|
-
# a socket that is not accepting connections yet.
|
|
19
|
-
test: ["CMD-SHELL", "pg_isready -U snagset"]
|
|
20
|
-
interval: 2s
|
|
21
|
-
timeout: 3s
|
|
22
|
-
retries: 20
|
|
23
|
-
|
|
24
|
-
snagset:
|
|
25
|
-
image: node:22-alpine
|
|
26
|
-
working_dir: /app
|
|
27
|
-
volumes: ["./:/app"]
|
|
28
|
-
command: sh -c "npm install --omit=dev && npm start"
|
|
29
|
-
env_file: [.env]
|
|
30
|
-
environment:
|
|
31
|
-
# Inside the compose network the database is `db`, not `localhost` —
|
|
32
|
-
# overridden here so the same .env works for `npm start` on the host.
|
|
33
|
-
DATABASE_URL: postgres://snagset:snagset@db:5432/snagset
|
|
34
|
-
SNAGSET_BIND_ADDRESS: 0.0.0.0
|
|
35
|
-
ports: ["8080:8080"]
|
|
36
|
-
depends_on:
|
|
37
|
-
db: { condition: service_healthy }
|
|
38
|
-
|
|
39
|
-
volumes:
|
|
40
|
-
snagset-db:
|