From f33870ba852e9e582f66d51626a9c746ddd8e0ec Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Sat, 15 Feb 2025 12:56:59 +0100 Subject: [PATCH] move the large commands for generating api docs to separate shell script --- Makefile | 8 +------- genapidoc.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100755 genapidoc.sh diff --git a/Makefile b/Makefile index 1ce69a3..8e04613 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,7 @@ build0: CGO_ENABLED=0 go build CGO_ENABLED=0 go vet ./... ./gendoc.sh - # we rewrite some dmarcprt and tlsrpt enums into untyped strings: real-world - # reports have invalid values, and our loose Go typed strings accept all values, - # but we don't want the typescript runtime checker to fail on those unrecognized - # values. - (cd webadmin && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none -rename 'config Domain ConfigDomain,dmarc Policy DMARCPolicy,mtasts MX STSMX,tlsrptdb Record TLSReportRecord,tlsrptdb SuppressAddress TLSRPTSuppressAddress,dmarcrpt DKIMResult string,dmarcrpt SPFResult string,dmarcrpt SPFDomainScope string,dmarcrpt DMARCResult string,dmarcrpt PolicyOverride string,dmarcrpt Alignment string,dmarcrpt Disposition string,tlsrpt PolicyType string,tlsrpt ResultType string' Admin) >webadmin/api.json - (cd webaccount && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none Account) >webaccount/api.json - (cd webmail && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none Webmail) >webmail/api.json + ./genapidoc.sh ./gents.sh webadmin/api.json webadmin/api.ts ./gents.sh webaccount/api.json webaccount/api.ts ./gents.sh webmail/api.json webmail/api.ts diff --git a/genapidoc.sh b/genapidoc.sh new file mode 100755 index 0000000..548efe3 --- /dev/null +++ b/genapidoc.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -eu + +# we rewrite some dmarcprt and tlsrpt enums into untyped strings: real-world +# reports have invalid values, and our loose Go typed strings accept all values, +# but we don't want the typescript runtime checker to fail on those unrecognized +# values. +(cd webadmin && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none -rename 'config Domain ConfigDomain,dmarc Policy DMARCPolicy,mtasts MX STSMX,tlsrptdb Record TLSReportRecord,tlsrptdb SuppressAddress TLSRPTSuppressAddress,dmarcrpt DKIMResult string,dmarcrpt SPFResult string,dmarcrpt SPFDomainScope string,dmarcrpt DMARCResult string,dmarcrpt PolicyOverride string,dmarcrpt Alignment string,dmarcrpt Disposition string,tlsrpt PolicyType string,tlsrpt ResultType string' Admin) >webadmin/api.json +(cd webaccount && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none Account) >webaccount/api.json +(cd webmail && CGO_ENABLED=0 go run ../vendor/github.com/mjl-/sherpadoc/cmd/sherpadoc/*.go -adjust-function-names none Webmail) >webmail/api.json