From 28ba4af8144cb90bd5bc0d662d56635f35b07c2f Mon Sep 17 00:00:00 2001 From: Michal Gold Date: Tue, 15 Oct 2024 10:58:39 +0300 Subject: [PATCH] Makefile: add Makefile for building and installing cockpit plugin Add some targets to the Makefile so we can install the on-prem frontend as a cockpit plugin. based on starter-kit project --- .gitignore | 6 ++++++ Makefile | 17 +++++++++++++++++ package.json | 1 + 3 files changed, 24 insertions(+) diff --git a/.gitignore b/.gitignore index 48409d40..08f685b5 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,13 @@ yarn-error.log* coverage *~ +*.swp bots # madge graph of dependencies generated by `npm run circular:graph` deps.png + +# build directories +cockpit/public/vendor* +cockpit/public/src_* +cockpit/public/main* diff --git a/Makefile b/Makefile index 34bba831..2e02ea55 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ FISTBOOT_SERVICE := $(shell base64 -w0 < aux/custom-first-boot.service) +INSTALL_DIR := ~/.local/share/cockpit/image-builder-frontend help: @cat Makefiles @@ -14,3 +15,19 @@ install: start: prep npm start +cockpit/all: devel-uninstall devel-install build + +devel-install: + mkdir -p ~/.local/share/cockpit + ln -s $(shell pwd)/cockpit/public $(INSTALL_DIR) + +build: + npm run build:cockpit + +devel-uninstall: + rm -rf $(INSTALL_DIR) + rm cockpit/public/*.css + rm cockpit/public/*.js + +.PHONY: cockpit/all devel-install build devel-uninstall + diff --git a/package.json b/package.json index 5b158b5d..ed9b76df 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "test:watch": "TZ=UTC vitest", "test:coverage": "TZ=UTC vitest run --coverage", "build": "fec build", + "build:cockpit": "webpack --config cockpit/webpack.config.ts", "api": "npm-run-all api:pull api:generate", "api:generate": "bash api/codegen.sh", "api:pull": "bash api/pull.sh",