diff options
| author | Xe Iaso <me@xeiaso.net> | 2025-04-01 17:27:22 -0400 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2025-04-01 17:28:59 -0400 |
| commit | e1a5c9edf560dd3cfe05902df191d16758d37b91 (patch) | |
| tree | c6c8ca2d3543353d4df03f3cf48a937d89085f3d | |
| parent | 661d72474b8b879c5eca86c16ca5b95eaa59c101 (diff) | |
| download | anubis-e1a5c9edf560dd3cfe05902df191d16758d37b91.tar.xz anubis-e1a5c9edf560dd3cfe05902df191d16758d37b91.zip | |
add a Makefile
Based on advice from IRC, a makefile helps downstream packagers
understand how to build the software.
Signed-off-by: Xe Iaso <me@xeiaso.net>
| -rw-r--r-- | Makefile | 25 | ||||
| -rw-r--r-- | docs/docs/CHANGELOG.md | 1 | ||||
| -rw-r--r-- | docs/docs/developer/building-anubis.md | 11 | ||||
| -rw-r--r-- | package.json | 1 |
4 files changed, 34 insertions, 4 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a8124e6 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +NODE_MODULES = 'node_modules' + +.phony: assets build deps lint test + +assets: + npm run assets + +build: + ifeq ("$(wildcard $(NODE_MODULES))", "") + @echo "please run make deps" + else + npm run build + @echo "Anubis is now built to ./var/anubis" + endif + +deps: + npm ci + go mod download + +lint: + go vet ./... + staticcheck ./... + +test: + npm run test
\ No newline at end of file diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md index b7e1336..7a16d8c 100644 --- a/docs/docs/CHANGELOG.md +++ b/docs/docs/CHANGELOG.md @@ -30,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Disabled running integration tests on Windows hosts due to it's reliance on posix features (see [#133](https://github.com/TecharoHQ/anubis/pull/133#issuecomment-2764732309)). - Added support for passing the ed25519 signing key in a file with `-ed25519-private-key-hex-file` or `ED25519_PRIVATE_KEY_HEX_FILE`. - Fixed minor typos +- Added a Makefile to enable comfortable workflows for downstream packagers. ## v1.15.1 diff --git a/docs/docs/developer/building-anubis.md b/docs/docs/developer/building-anubis.md index a55b8e7..69b2404 100644 --- a/docs/docs/developer/building-anubis.md +++ b/docs/docs/developer/building-anubis.md @@ -22,20 +22,23 @@ In order to build a production-ready binary of Anubis, you need the following pa ## Install dependencies ```text -go mod download -npm ci +make deps ``` +This will download Go and NPM dependencies. + ## Building static assets ```text -npm run assets +make assets ``` +This will build all static assets (CSS, JavaScript) for distribution. + ## Building Anubis to the `./var` folder ```text -go build -o ./var/anubis ./cmd/anubis +make build ``` From this point it is up to you to make sure that `./var/anubis` ends up in the right place. You may want to consult the `./run` folder for useful files such as a systemd unit and `anubis.env.default` file. diff --git a/package.json b/package.json index e13b3b3..ca7a9fe 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "test": "npm run assets && go test ./...", "test:integration": "npm run assets && go test -v ./internal/test", "assets": "go generate ./... && ./web/build.sh && ./xess/build.sh", + "build": "npm run assets && go build -o ./var/anubis ../cmd/anubis", "dev": "npm run assets && go run ./cmd/anubis --use-remote-address", "container": "npm run assets && go run ./cmd/containerbuild" }, |
