Added build plugin

This commit is contained in:
Taylor AI 2026-01-08 22:51:35 +05:00
parent 0fb69ae14a
commit 2f073235d7

View File

@ -4,36 +4,37 @@ import { Axios } from "axios";
import { promises as fs } from "fs"; import { promises as fs } from "fs";
import { z } from "zod"; import { z } from "zod";
const { vmOrchestrationStatusUpdateUrl } = z // const { vmOrchestrationStatusUpdateUrl } = z
.object({ // .object({
vmOrchestrationStatusUpdateUrl: z.string(), // vmOrchestrationStatusUpdateUrl: z.string(),
}) // })
.parse({ // .parse({
vmOrchestrationStatusUpdateUrl: // vmOrchestrationStatusUpdateUrl:
process.env.TAYLORDB_VM_ORCHESTRATION_STATUS_UPDATE_URL, // process.env.TAYLORDB_VM_ORCHESTRATION_STATUS_UPDATE_URL,
}); // });
const axios = new Axios({ // const axios = new Axios({
baseURL: vmOrchestrationStatusUpdateUrl, // baseURL: vmOrchestrationStatusUpdateUrl,
}); // });
const updateAppStatus = async (status: "Errored" | "Active" | "Pending") => { const updateAppStatus = async (status: "Errored" | "Active" | "Pending") => {
await axios.put( console.log(status);
"/", // await axios.put(
JSON.stringify({ // "/",
status, // JSON.stringify({
}), // status,
{ // }),
headers: { // {
"Content-Type": "application/json", // headers: {
}, // "Content-Type": "application/json",
} // },
); // }
// );
}; };
const sessionRetries: Record<string, number> = {}; const sessionRetries: Record<string, number> = {};
export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => { export const BuildPlugin: Plugin = async ({ client, $ }) => {
return { return {
event: async ({ event }) => { event: async ({ event }) => {
const isMessagedDone = const isMessagedDone =
@ -52,6 +53,8 @@ export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => {
(await $`git status --porcelain`.quiet()).stdout.toString().trim() !== (await $`git status --porcelain`.quiet()).stdout.toString().trim() !==
""; "";
console.log({ isAnyChange });
if (!isAnyChange || isAbortionError) { if (!isAnyChange || isAbortionError) {
await updateAppStatus("Active"); await updateAppStatus("Active");
@ -136,6 +139,7 @@ export const DevServerHMRPlugin: Plugin = async ({ client, $ }) => {
JSON.stringify(packageJson, null, 2) JSON.stringify(packageJson, null, 2)
); );
console.log("Pushing");
await $`git add .`.quiet(); await $`git add .`.quiet();
await $`GIT_AUTHOR_NAME="Taylor AI" GIT_AUTHOR_EMAIL="ai@taylordb.io" GIT_COMMITTER_NAME="Taylor AI" GIT_COMMITTER_EMAIL="ai@taylordb.io" git commit -m ${commitMessage}`.quiet(); await $`GIT_AUTHOR_NAME="Taylor AI" GIT_AUTHOR_EMAIL="ai@taylordb.io" GIT_COMMITTER_NAME="Taylor AI" GIT_COMMITTER_EMAIL="ai@taylordb.io" git commit -m ${commitMessage}`.quiet();
await $`git tag v${newVersion}`.quiet(); await $`git tag v${newVersion}`.quiet();