@typed-assistant/builder 0.0.38 → 0.0.40
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 +1 -1
- package/src/appProcess.tsx +3 -3
- package/src/setupWebhook.tsx +19 -0
- package/src/setupWebserver.tsx +13 -1
- package/src/webserver/Logs.tsx +3 -3
package/package.json
CHANGED
package/src/appProcess.tsx
CHANGED
|
@@ -32,9 +32,6 @@ export async function setup({
|
|
|
32
32
|
const directoryToWatch = join(process.cwd(), "./src")
|
|
33
33
|
const addonUrl = `${slug}/ingress`
|
|
34
34
|
|
|
35
|
-
checkProcesses(entryFile, { addonUrl, onProcessError })
|
|
36
|
-
await setupGitSync()
|
|
37
|
-
|
|
38
35
|
let subprocesses = await buildAndStartAppProcess(entryFile, {
|
|
39
36
|
mdiPaths: mdiPaths,
|
|
40
37
|
})
|
|
@@ -53,6 +50,9 @@ export async function setup({
|
|
|
53
50
|
getSubprocesses: () => subprocesses,
|
|
54
51
|
})
|
|
55
52
|
|
|
53
|
+
checkProcesses(entryFile, { addonUrl, onProcessError })
|
|
54
|
+
await setupGitSync()
|
|
55
|
+
|
|
56
56
|
return subprocesses
|
|
57
57
|
}
|
|
58
58
|
|
package/src/setupWebhook.tsx
CHANGED
|
@@ -13,6 +13,23 @@ const commonOptions = {
|
|
|
13
13
|
},
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
const webhookIsSetup = async () => {
|
|
17
|
+
const { error } = await fetch(webhookUrl, {
|
|
18
|
+
...commonOptions,
|
|
19
|
+
body: JSON.stringify({ check: "true" }),
|
|
20
|
+
})
|
|
21
|
+
.then(handleFetchError)
|
|
22
|
+
.then((d) => d.json())
|
|
23
|
+
|
|
24
|
+
if (error) {
|
|
25
|
+
logger.error("🚨 Failed to reach webhook", error.message)
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
logger.info("🪝 Webhook reached successfully: ")
|
|
30
|
+
return true
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
const listRepoWebhooks = async () =>
|
|
17
34
|
withErrorHandling(() =>
|
|
18
35
|
fetch(
|
|
@@ -125,6 +142,8 @@ export const setupWebhook = async (): Promise<void> => {
|
|
|
125
142
|
return
|
|
126
143
|
}
|
|
127
144
|
|
|
145
|
+
await webhookIsSetup()
|
|
146
|
+
|
|
128
147
|
const { data: webhook, error: createError } = await createRepoWebhook()
|
|
129
148
|
|
|
130
149
|
if (createError) {
|
package/src/setupWebserver.tsx
CHANGED
|
@@ -110,6 +110,18 @@ export const startWebappServer = async ({
|
|
|
110
110
|
restartAddon()
|
|
111
111
|
return { message: "Restarting addon..." }
|
|
112
112
|
})
|
|
113
|
+
.get(
|
|
114
|
+
"/webhook",
|
|
115
|
+
async ({ query }) => {
|
|
116
|
+
if (query.check === "true") return { message: "Set up successfully" }
|
|
117
|
+
return { message: "Restarting addon..." }
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
query: t.Object({
|
|
121
|
+
check: t.Optional(t.Literal("true")),
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
)
|
|
113
125
|
.get("/addon-info", async () => {
|
|
114
126
|
const { data, error } = await getAddonInfo()
|
|
115
127
|
|
|
@@ -228,7 +240,7 @@ const getLogsFromFile = async (limit?: string) => {
|
|
|
228
240
|
try {
|
|
229
241
|
const lines = (await Bun.file("./log.txt").text()).split("\n")
|
|
230
242
|
const logFile = limit
|
|
231
|
-
? lines.slice(lines.length - Number(limit), lines.length - 1)
|
|
243
|
+
? lines.slice(lines.length - 1 - Number(limit), lines.length - 1)
|
|
232
244
|
: lines
|
|
233
245
|
return { logs: logFile }
|
|
234
246
|
} catch (e) {
|
package/src/webserver/Logs.tsx
CHANGED
|
@@ -18,7 +18,7 @@ const LogSchema = z.object({
|
|
|
18
18
|
type LogSchema = z.infer<typeof LogSchema>
|
|
19
19
|
|
|
20
20
|
export const Logs = () => {
|
|
21
|
-
const [limit, setLimit] = useState(
|
|
21
|
+
const [limit, setLimit] = useState(200)
|
|
22
22
|
const [level, setLevel] = useState<
|
|
23
23
|
"trace" | "debug" | "info" | "warn" | "error" | "fatal"
|
|
24
24
|
>("trace")
|
|
@@ -82,7 +82,7 @@ export const Logs = () => {
|
|
|
82
82
|
<option value="fatal">Fatal</option>
|
|
83
83
|
</select>
|
|
84
84
|
</div>
|
|
85
|
-
<div className="flex gap-2">
|
|
85
|
+
{/* <div className="flex gap-2">
|
|
86
86
|
<label htmlFor="limit">Limit</label>
|
|
87
87
|
<input
|
|
88
88
|
className="border border-gray-300 rounded-md text-slate-800 px-2"
|
|
@@ -91,7 +91,7 @@ export const Logs = () => {
|
|
|
91
91
|
size={8}
|
|
92
92
|
value={limit}
|
|
93
93
|
/>
|
|
94
|
-
</div>
|
|
94
|
+
</div> */}
|
|
95
95
|
</div>
|
|
96
96
|
</>
|
|
97
97
|
)}
|