diff --git a/README.md b/README.md new file mode 100644 index 0000000..ffd9ae4 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# neuf-www + +The neuf.no website. Wagtail CMS backend (`dnscms/`) feeding a Next.js frontend (`web/`) over GraphQL. + +Tools are managed by [mise](https://mise.jdx.dev/). Run `mise install` to get python, uv, node, and prek. + +## Backend (`dnscms/`) + +```bash +cd dnscms +uv sync +uv run ./manage.py migrate +uv run ./manage.py runserver +uv run pytest +``` + +GraphQL endpoint: . + +## Frontend (`web/`) + +```bash +cd web +npm install +npm run dev # http://localhost:3000 +npm run codegen # regenerate GraphQL types (needs the backend running) +npm run build +``` + +## Pre-commit hooks + +[prek](https://github.com/j178/prek) runs ruff lint + format on `dnscms/**/*.py` plus a few sanity hooks. Hooks are configured in [prek.toml](prek.toml). + +```bash +prek install # registers the git hook +prek run --all-files # run on everything +``` diff --git a/dnscms/README.md b/dnscms/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/dnscms/pyproject.toml b/dnscms/pyproject.toml index 89d5452..be0e6fc 100644 --- a/dnscms/pyproject.toml +++ b/dnscms/pyproject.toml @@ -4,7 +4,6 @@ version = "0.1.0" description = "" authors = [{ name = "EDB", email = "edb@neuf.no" }] requires-python = ">=3.14, <3.15" -readme = "README.md" dependencies = [ "wagtail>=7.4,<8", "wagtail-grapple>=0.31.0,<0.32", diff --git a/dnscms/mise.toml b/mise.toml similarity index 57% rename from dnscms/mise.toml rename to mise.toml index 81daabc..5f2273e 100644 --- a/dnscms/mise.toml +++ b/mise.toml @@ -1,3 +1,5 @@ [tools] python = "3.14" uv = "latest" +node = "24" +prek = "latest" diff --git a/prek.toml b/prek.toml new file mode 100644 index 0000000..ed4fd25 --- /dev/null +++ b/prek.toml @@ -0,0 +1,27 @@ +[[repos]] +repo = "https://github.com/pre-commit/pre-commit-hooks" +rev = "v6.0.0" +hooks = [ + { id = "end-of-file-fixer" }, + { id = "trailing-whitespace" }, + { id = "check-yaml" }, + { id = "check-toml" }, + { id = "check-merge-conflict" }, + { id = "check-added-large-files" }, + { id = "debug-statements" }, +] + +[[repos]] +repo = "https://github.com/astral-sh/ruff-pre-commit" +rev = "v0.15.13" + +[[repos.hooks]] +id = "ruff-check" +args = ["--fix"] +files = '^dnscms/.*\.py$' +exclude = '/migrations/' + +[[repos.hooks]] +id = "ruff-format" +files = '^dnscms/.*\.py$' +exclude = '/migrations/' diff --git a/web/README.md b/web/README.md deleted file mode 100644 index 2268b98..0000000 --- a/web/README.md +++ /dev/null @@ -1,15 +0,0 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). - -## Development - -Run the development server: - -```bash -npm run dev -``` - -Update GraphQL definitions from `http://127.0.0.1:8000/api/graphql/`: - -```bash -npm run codegen -``` \ No newline at end of file diff --git a/web/mise.toml b/web/mise.toml deleted file mode 100644 index 6ea5a7e..0000000 --- a/web/mise.toml +++ /dev/null @@ -1,2 +0,0 @@ -[tools] -node = "24"