@typed-assistant/builder 0.0.63 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typed-assistant/builder",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "exports": {
5
5
  "./appProcess": "./src/appProcess.tsx",
6
6
  "./bunInstall": "./src/bunInstall.tsx",
@@ -2,21 +2,20 @@ import { logger } from "@typed-assistant/logger"
2
2
  import { generateTypes } from "@typed-assistant/types/generateTypes"
3
3
  import type { Subprocess } from "bun"
4
4
  import { $ } from "bun"
5
+ import debounce from "debounce"
5
6
  import { readFileSync, watch } from "fs"
6
7
  import ignore from "ignore"
7
8
  import { join, relative } from "path"
9
+ import { getAddonInfo as getAddonInfoAPI } from "./getAddonInfo"
8
10
  import {
9
11
  addKillListener,
10
12
  callKillListeners,
11
13
  callSoftKillListeners,
12
14
  killSubprocess,
13
15
  } from "./killProcess"
16
+ import { restartAddon } from "./restartAddon"
14
17
  import { setupGitPoller } from "./setupGitPoller"
15
- import { setupWebhook } from "./setupWebhook"
16
18
  import { startWebappServer } from "./setupWebserver"
17
- import { restartAddon } from "./restartAddon"
18
- import { getAddonInfo as getAddonInfoAPI } from "./getAddonInfo"
19
- import debounce from "debounce"
20
19
 
21
20
  export async function setup({
22
21
  entryFile,
@@ -31,7 +30,6 @@ export async function setup({
31
30
  const slug = addonInfo?.data.slug ?? ""
32
31
  const directoryToWatch = join(process.cwd(), "./src")
33
32
  const addonUrl = `${slug}/ingress`
34
- const webhookUrl = `${process.env.HASS_EXTERNAL_URL}${basePath}/webhook`
35
33
 
36
34
  let subprocesses = await buildAndStartAppProcess(entryFile, {
37
35
  mdiPaths: mdiPaths,
@@ -76,7 +74,7 @@ export async function setup({
76
74
  )
77
75
  },
78
76
  })
79
- await setupGitSync(webhookUrl)
77
+ await setupGitSync()
80
78
 
81
79
  return subprocesses
82
80
  }
@@ -166,7 +164,7 @@ const getAddonInfo = async () => {
166
164
  return data
167
165
  }
168
166
 
169
- const setupGitSync = async (webhookUrl: string) => {
167
+ const setupGitSync = async () => {
170
168
  if (
171
169
  !process.env.GITHUB_TOKEN ||
172
170
  !process.env.GITHUB_USERNAME ||
@@ -178,14 +176,8 @@ const setupGitSync = async (webhookUrl: string) => {
178
176
  )
179
177
  return { error: {} }
180
178
  }
181
- if (process.env.HASS_EXTERNAL_URL) {
182
- await setupWebhook(webhookUrl)
183
- return
184
- }
185
- logger.warn(
186
- { emoji: "⚠️" },
187
- "No HASS_EXTERNAL_URL found. Setting up git poller...",
188
- )
179
+
180
+ logger.warn({ emoji: "⬇️" }, "Setting up git poller...")
189
181
  await setupGitPoller()
190
182
  }
191
183
 
@@ -92,13 +92,13 @@ const getStats = async () => {
92
92
  ? data.data.memory_usage
93
93
  : stats.max_memory_usage,
94
94
  }
95
- logger.info(
95
+ logger.debug(
96
96
  { additionalDetails: JSON.stringify(stats, null, 2), emoji: "📊" },
97
97
  "Stats updated",
98
98
  )
99
99
  }
100
100
 
101
- setTimeout(getStats, 30 * ONE_SECOND)
101
+ setTimeout(getStats, 10 * ONE_SECOND)
102
102
  }
103
103
 
104
104
  export const startWebappServer = async ({
@@ -21,7 +21,7 @@ export const Stats = () => {
21
21
 
22
22
  const timeout = setTimeout(() => {
23
23
  setCounter((c) => c + 1)
24
- }, 30 * ONE_SECOND)
24
+ }, 10 * ONE_SECOND)
25
25
  return () => clearTimeout(timeout)
26
26
  })
27
27
  }, [counter])