From 9469f86f65579a2c7edb030867882d428b47c24f Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 23 Aug 2021 10:09:56 +0200 Subject: [PATCH] web: improve api client versioning Signed-off-by: Jens Langhammer --- Makefile | 4 ++-- scripts/npm_version.py | 6 ++++++ web/package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 scripts/npm_version.py diff --git a/Makefile b/Makefile index f48fa0f31..c93abdf14 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PWD = $(shell pwd) UID = $(shell id -u) GID = $(shell id -g) -TIMESTAMP = $(shell date "+%s") +NPM_VERSION = $(shell python -m scripts.npm_version) all: lint-fix lint test gen @@ -43,7 +43,7 @@ gen-web: -i /local/schema.yml \ -g typescript-fetch \ -o /local/web-api \ - --additional-properties=typescriptThreePlus=true,supportsES6=true,npmName=@goauthentik/api,npmVersion=${TIMESTAMP}.0.0 + --additional-properties=typescriptThreePlus=true,supportsES6=true,npmName=@goauthentik/api,npmVersion=${NPM_VERSION} gen-outpost: docker run \ diff --git a/scripts/npm_version.py b/scripts/npm_version.py new file mode 100644 index 000000000..2c0d3a9e2 --- /dev/null +++ b/scripts/npm_version.py @@ -0,0 +1,6 @@ +"""Helper script to generate an NPM Version""" +from time import time + +from authentik import __version__ + +print("%s-%d" % (__version__, time())) diff --git a/web/package.json b/web/package.json index e260d7e59..e57620c7c 100644 --- a/web/package.json +++ b/web/package.json @@ -46,7 +46,7 @@ "@babel/preset-env": "^7.15.0", "@babel/preset-typescript": "^7.15.0", "@fortawesome/fontawesome-free": "^5.15.4", - "@goauthentik/api": "^1629704636.0.0", + "@goauthentik/api": "^2021.8.1-rc1+1629705955", "@lingui/cli": "^3.10.2", "@lingui/core": "^3.10.4", "@lingui/macro": "^3.10.2",