Skip to content

Commit

Permalink
feat(build): Update build and deployment process, and improve documen…
Browse files Browse the repository at this point in the history
…tation

- Updated `commitlint.config.js` to include new linting rules for deployment related code.
- Revised `README.md` to better document the new deployment process and integrate changed processes.
- Modified `src/modules/build/build-and-deploy.ts` to implement the new build and deployment logic based on the improvements detailed in the README.

This change improves the overall documentation and process of building the project. The new deployment process is more robust and easier to understand.
  • Loading branch information
mrgoonie committed Nov 25, 2024
1 parent 2690357 commit 7ee4b34
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
ignores: [(message) => /chore/m.test(message)],
rules: {
'body-max-line-length': [0, 'always', 100],
"subject-case": [0, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
},
};
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,4 @@ Thank you!
- [ReadTube.me](https://readtube.me) - Write blog articles based on Youtube videos
- [BoostTogether.com](https://boosttogether.com) - The Power of WE in Advertising
- [AIVN.Site](https://aivn.site) - Face Swap, Remove BG, Photo Editor,…
- [GetViral.Now](https://getviral.now) - KOL booking better together!
- [DxUp.dev](https://dxup.dev) - Developer-focused platform for app deployment & centralized cloud resource management.
9 changes: 6 additions & 3 deletions src/modules/build/build-and-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import humanizeDuration from "humanize-duration";

import { IsTest } from "@/app.config";
import type { IWorkspace } from "@/entities";
import { Logger, wait } from "@/plugins";
import { wait } from "@/plugins";
import { uploadFileBuffer } from "@/plugins/cloud-storage";
import { MongoDB } from "@/plugins/mongodb";
import { socketIO } from "@/server";
Expand All @@ -21,8 +21,10 @@ import { sendLog } from "./send-log-message";
export const buildAndDeploy = async (buildParams: StartBuildParams, deployParams: DeployBuildV2Options) => {
// import services
const { AppService } = await import("@/services");
const { BuildService } = await import("@/services");
const { ReleaseService } = await import("@/services");
const appSvc = new AppService();
const buildSvc = new BuildService();
const releaseSvc = new ReleaseService();

// [1] Build container image
Expand All @@ -42,15 +44,16 @@ export const buildAndDeploy = async (buildParams: StartBuildParams, deployParams
sendLog({ SOCKET_ROOM, type: "error", message: `Build error: ${e.stack}` });

// AI analysis: get latest 100 lines of container logs
const fullLogs = Logger.getLogs(SOCKET_ROOM);
const build = await buildSvc.findOne({ slug: SOCKET_ROOM });
const fullLogs = build?.logs;
const latestLogs = fullLogs ? fullLogs.split("\n").slice(-100).join("\n") : undefined;
const workspace = app.workspace as IWorkspace;
const owner = buildParams.user;
console.log("buildAndDeploy() > latestLogs :>> ", latestLogs);
console.log("buildAndDeploy() > workspace :>> ", workspace);
console.log("buildAndDeploy() > owner :>> ", owner);
let aiAnalysis = "\n---- AI ANALYSIS ----\n";
if (workspace.settings?.ai?.enabled && latestLogs) {
if (workspace.settings?.ai?.enabled && latestLogs && build) {
const { AIService } = await import("@/services/AIService");
const aiService = new AIService({ owner, workspace });
try {
Expand Down

0 comments on commit 7ee4b34

Please # to comment.