✨ feat: auto-reload tibi-server on api/ changes + skill docs for project registration
This commit is contained in:
+25
-1
@@ -237,6 +237,19 @@ if (process.argv[2] == "start") {
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-read config for tibi-server API reload (used by esbuild-wrapper.js)
|
||||
let _tibiNamespace, _adminToken, _tibiReloadUrl
|
||||
try {
|
||||
const dotEnv = fs.readFileSync(__dirname + "/.env", "utf8")
|
||||
_tibiNamespace = dotEnv.match(/TIBI_NAMESPACE=(.*)/)?.[1]
|
||||
const adminEnv = fs.readFileSync(__dirname + "/api/config.yml.env", "utf8")
|
||||
_adminToken = adminEnv.match(/ADMIN_TOKEN=(.*)/)?.[1]
|
||||
// Inside Docker compose, the tibiserver container is reachable by hostname
|
||||
_tibiReloadUrl = `http://tibiserver:8080/api/v1/_/${_tibiNamespace}/_/admin/reload`
|
||||
} catch (_) {
|
||||
// Not critical — fallback: no reload capability
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sveltePlugin: sveltePlugin,
|
||||
resolvePlugin: resolvePlugin,
|
||||
@@ -244,8 +257,19 @@ module.exports = {
|
||||
options: options,
|
||||
distDir,
|
||||
watch: {
|
||||
path: [__dirname + "/" + frontendDir + "/src"],
|
||||
path: [
|
||||
__dirname + "/" + frontendDir + "/src",
|
||||
__dirname + "/api",
|
||||
],
|
||||
// buildInfo.ts is written by writeBuildInfo() on every rebuild — ignoring
|
||||
// it prevents a rebuild loop. buildInfo.js and config.yml.env (ADMIN_ASSET_VERSION)
|
||||
// are also written, but those changes are debounced into a single reload.
|
||||
ignored: [
|
||||
/\/buildInfo\.ts$/,
|
||||
],
|
||||
},
|
||||
tibiReloadUrl: _tibiReloadUrl,
|
||||
adminToken: _adminToken,
|
||||
serve: {
|
||||
onRequest(args) {
|
||||
console.log(args)
|
||||
|
||||
Reference in New Issue
Block a user