From c6295b48a53a7c0af8e6472ad5f8f187fc22ed36 Mon Sep 17 00:00:00 2001 From: Chris Coutinho Date: Thu, 15 Jan 2026 08:59:31 +0100 Subject: [PATCH] fix(astrolabe): define appName and appVersion for @nextcloud/vue The @nextcloud/vue library (v9.x) requires appName and appVersion to be defined as global constants at build time. Without these, the library logs an error: "The '@nextcloud/vue' library was used without setting / replacing the 'appName'." This fix reads the app ID and version from appinfo/info.xml and injects them via Vite's define option, matching how @nextcloud/webpack-vue-config handles this for webpack-based apps. Co-Authored-By: Claude Opus 4.5 --- third_party/astrolabe/vite.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/third_party/astrolabe/vite.config.js b/third_party/astrolabe/vite.config.js index 0320b0e..e8f1239 100644 --- a/third_party/astrolabe/vite.config.js +++ b/third_party/astrolabe/vite.config.js @@ -1,9 +1,19 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { resolve } from 'path' +import { readFileSync } from 'fs' + +// Read app info from info.xml for @nextcloud/vue +const infoXml = readFileSync(resolve(__dirname, 'appinfo/info.xml'), 'utf-8') +const appName = infoXml.match(/([^<]+)<\/id>/)?.[1] || 'astrolabe' +const appVersion = infoXml.match(/([^<]+)<\/version>/)?.[1] || '' export default defineConfig({ plugins: [vue()], + define: { + appName: JSON.stringify(appName), + appVersion: JSON.stringify(appVersion), + }, build: { outDir: '.', emptyOutDir: false,