Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

remove @cap/tasks (#1327)

Brendan Allan0feba070e9b2
diff --git a/CLAUDE.md b/CLAUDE.md
index 47d58dbf0..7617ae509 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -17,7 +17,6 @@ Cap is the open source alternative to Loom. It's a Turborepo monorepo with a Tau
### Core Applications
- `apps/web/` — Next.js web application (sharing, management, dashboard)
- `apps/desktop/` — Tauri desktop app (recording, editing)
-- `apps/tasks/` — Background job processing service
- `apps/discord-bot/` — Discord integration bot
- `apps/storybook/` — UI component documentation
diff --git a/apps/tasks/.dockerignore b/apps/tasks/.dockerignore
deleted file mode 100644
index 7c22185ea..000000000
--- a/apps/tasks/.dockerignore
+++ /dev/null
@@ -1,18 +0,0 @@
-# Ignore node_modules directory
-node_modules/
-
-# Ignore .git directory
-.git/
-
-# Ignore .env file which might contain sensitive information
-.env
-
-# Ignore dist directory if you're building your app inside the Docker container
-dist/
-
-# Ignore logs
-*.log
-
-# Ignore OS generated files
-.DS_Store
-Thumbs.db
\ No newline at end of file
diff --git a/apps/tasks/.gitignore b/apps/tasks/.gitignore
deleted file mode 100644
index 6a04e814c..000000000
--- a/apps/tasks/.gitignore
+++ /dev/null
@@ -1,77 +0,0 @@
-# Logs
-logs
-*.log
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-
-# Runtime data
-pids
-*.pid
-*.seed
-*.pid.lock
-
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
-
-# Coverage directory used by tools like istanbul
-coverage
-
-# nyc test coverage
-.nyc_output
-
-# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
-
-# Bower dependency directory (https://bower.io/)
-bower_components
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (https://nodejs.org/api/addons.html)
-build/Release
-
-# Dependency directories
-node_modules/
-jspm_packages/
-
-# TypeScript v1 declaration files
-typings/
-
-# Optional npm cache directory
-.npm
-
-# Optional eslint cache
-.eslintcache
-
-# Optional REPL history
-.node_repl_history
-
-# Output of 'npm pack'
-*.tgz
-
-# Yarn Integrity file
-.yarn-integrity
-
-# dotenv environment variables file
-.env
-
-# parcel-bundler cache (https://parceljs.org/)
-.cache
-
-# next.js build output
-.next
-
-# nuxt.js build output
-.nuxt
-
-# vuepress build output
-.vuepress/dist
-
-# Serverless directories
-.serverless
-
-dist
-
-output
\ No newline at end of file
diff --git a/apps/tasks/Dockerfile b/apps/tasks/Dockerfile
deleted file mode 100644
index d69529eaa..000000000
--- a/apps/tasks/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-# Use an official Node runtime as the base image
-FROM node:20
-
-# Declaring env
-ENV NODE_ENV=production
-
-# Set the working directory in the container to /app
-WORKDIR /app
-
-# Copy all the files from the project’s root to the working directory in the container
-COPY . .
-
-# Install all the dependencies
-RUN npm install
-
-# Build the app
-RUN npm run build
-
-# Install ffmpeg
-RUN apt-get update && apt-get install -y ffmpeg
-
-# Start the app
-CMD ["npm", "start"]
\ No newline at end of file
diff --git a/apps/tasks/README.md b/apps/tasks/README.md
deleted file mode 100644
index 9836e35aa..000000000
--- a/apps/tasks/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Cap Tasks Server
-
-This is a simple Node.js Express server for handling various types of tasks.
diff --git a/apps/tasks/jest.config.js b/apps/tasks/jest.config.js
deleted file mode 100644
index 537b86410..000000000
--- a/apps/tasks/jest.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
-module.exports = {
- preset: "ts-jest",
- testEnvironment: "node",
- modulePathIgnorePatterns: ["<rootDir>/dist/"],
-};
diff --git a/apps/tasks/package.json b/apps/tasks/package.json
deleted file mode 100644
index 2010d3489..000000000
--- a/apps/tasks/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "@cap/tasks",
- "version": "0.3.1",
- "private": true,
- "main": "src/index.ts",
- "scripts": {
- "start": "node dist/src/index.js",
- "build": "tsc",
- "start:dist": "node dist/src/index.js",
- "test": "jest",
- "typecheck": "tsc --noEmit"
- },
- "dependencies": {
- "@types/cors": "^2.8.17",
- "@types/express": "^4.17.21",
- "@types/fluent-ffmpeg": "^2.1.24",
- "@types/jest": "^29.5.12",
- "@types/morgan": "^1.9.9",
- "@types/node": "^20.12.6",
- "@types/supertest": "^6.0.2",
- "cors": "^2.8.5",
- "dotenv": "^16.4.5",
- "express": "^4.19.2",
- "fluent-ffmpeg": "^2.1.3",
- "helmet": "^7.1.0",
- "morgan": "^1.10.0",
- "ts-node": "^10.9.2",
- "typescript": "^5.8.3",
- "zod": "^3"
- },
- "devDependencies": {
- "@typescript-eslint/eslint-plugin": "^7.6.0",
- "@typescript-eslint/parser": "^7.6.0",
- "eslint": "^8.57.0",
- "eslint-config-airbnb-typescript": "^18.0.0",
- "eslint-import-resolver-typescript": "^3.6.1",
- "eslint-plugin-import": "^2.29.1",
- "jest": "^29.7.0",
- "nodemon": "^3.1.0",
- "supertest": "^6.3.4",
- "ts-jest": "^29.1.2"
- },
- "engines": {
- "node": "20"
- }
-}
diff --git a/apps/tasks/src/api/index.ts b/apps/tasks/src/api/index.ts
deleted file mode 100644
index 6382d6655..000000000
--- a/apps/tasks/src/api/index.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import express from "express";
-
-import type MessageResponse from "../interfaces/MessageResponse";
-import mergeAudioSegments from "./mergeAudioSegments";
-
-const router = express.Router();
-
-router.get<{}, MessageResponse>("/", (req, res) => {
- res.json({
- message: "OK",
- });
-});
-
-router.use("/merge-audio-segments", mergeAudioSegments);
-
-export default router;
diff --git a/apps/tasks/src/api/mergeAudioSegments.ts b/apps/tasks/src/api/mergeAudioSegments.ts
deleted file mode 100644
index 20ecacfdf..000000000
--- a/apps/tasks/src/api/mergeAudioSegments.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import express from "express";
-import ffmpeg from "fluent-ffmpeg";
-import fs from "fs";
-
-const router = express.Router();
-
-router.post<{}>("/", async (req, res) => {
- const body = req.body;
-
- if (
- !body.segments ||
- body.segments.length === 0 ||
- !body.uploadUrl ||
- !body.videoId
- ) {
- res.status(400).json({ response: "FAILED" });
- return;
- }
-
- const outputDir = "./output";
- if (!fs.existsSync(outputDir)) {
- fs.mkdirSync(outputDir);
- }
-
- const command = ffmpeg();
- const filePath = `./output/merged_${body.videoId}.mp3`;
-
- for (const url of body.segments) {
- command.input(url);
- }
-
- command
- .audioCodec("libmp3lame")
- .on("error", (err: any) => {
- console.log("An error occurred: " + err.message);
- })
- .on("end", async () => {
- console.log("Merging finished!");
-
- const buffer = fs.readFileSync(filePath);
-
- const uploadResponse = await fetch(body.uploadUrl, {
- method: "PUT",
- body: buffer,
- headers: {
- "Content-Type": "audio/mpeg",
- },
- });
-
- fs.unlinkSync(filePath);
-
- if (!uploadResponse.ok) {
- console.error("Upload failed: ", await uploadResponse.text());
- res.status(500).json({ response: "FAILED" });
- return;
- }
-
- res.status(200).json({ response: "COMPLETE" });
- })
- .mergeToFile(filePath, "./");
-});
-
-export default router;
diff --git a/apps/tasks/src/app.ts b/apps/tasks/src/app.ts
deleted file mode 100644
index b3b7f4f86..000000000
--- a/apps/tasks/src/app.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import cors from "cors";
-import express from "express";
-import helmet from "helmet";
-import morgan from "morgan";
-import api from "./api";
-import type MessageResponse from "./interfaces/MessageResponse";
-import * as middlewares from "./middlewares";
-
-require("dotenv").config();
-
-const app = express();
-
-app.use(morgan("dev"));
-app.use(helmet());
-app.use(cors());
-app.use(express.json());
-
-app.get<{}, MessageResponse>("/", (req, res) => {
- res.json({
- message: "OK",
- });
-});
-
-app.use("/api/v1", api);
-app.use(middlewares.notFound);
-app.use(middlewares.errorHandler);
-
-export default app;
diff --git a/apps/tasks/src/index.ts b/apps/tasks/src/index.ts
deleted file mode 100644
index d09060628..000000000
--- a/apps/tasks/src/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import app from "./app";
-
-const port = Number(process.env.PORT) || 3002;
-
-app.listen(port, "0.0.0.0", () => {
- console.log(`Listening: http://localhost:${port}`);
-});
diff --git a/apps/tasks/src/interfaces/ErrorResponse.ts b/apps/tasks/src/interfaces/ErrorResponse.ts
deleted file mode 100644
index 55258994a..000000000
--- a/apps/tasks/src/interfaces/ErrorResponse.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type MessageResponse from "./MessageResponse";
-
-export default interface ErrorResponse extends MessageResponse {
- stack?: string;
-}
diff --git a/apps/tasks/src/interfaces/MessageResponse.ts b/apps/tasks/src/interfaces/MessageResponse.ts
deleted file mode 100644
index 8afb24ea2..000000000
--- a/apps/tasks/src/interfaces/MessageResponse.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export default interface MessageResponse {
- message: string;
-}
diff --git a/apps/tasks/src/middlewares.ts b/apps/tasks/src/middlewares.ts
deleted file mode 100644
index ad8556ddc..000000000
--- a/apps/tasks/src/middlewares.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import type { NextFunction, Request, Response } from "express";
-
-import type ErrorResponse from "./interfaces/ErrorResponse";
-
-export function notFound(req: Request, res: Response, next: NextFunction) {
- res.status(404);
- const error = new Error(`🔍 - Not Found - ${req.originalUrl}`);
- next(error);
-}
-
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-export function errorHandler(
- err: Error,
- req: Request,
- res: Response<ErrorResponse>,
- next: NextFunction,
-) {
- const statusCode = res.statusCode !== 200 ? res.statusCode : 500;
- res.status(statusCode);
- res.json({
- message: err.message,
- stack: process.env.NODE_ENV === "production" ? "🥞" : err.stack,
- });
-}
diff --git a/apps/tasks/test/api.test.ts b/apps/tasks/test/api.test.ts
deleted file mode 100644
index 6b50b9a96..000000000
--- a/apps/tasks/test/api.test.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import request from "supertest";
-
-import app from "../src/app";
-
-describe("GET /api/v1", () => {
- it("responds with a json message", (done) => {
- request(app)
- .get("/api/v1")
- .set("Accept", "application/json")
- .expect("Content-Type", /json/)
- .expect(
- 200,
- {
- message: "OK",
- },
- done,
- );
- });
-});
diff --git a/apps/tasks/test/app.test.ts b/apps/tasks/test/app.test.ts
deleted file mode 100644
index 16cc7cdec..000000000
--- a/apps/tasks/test/app.test.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import request from "supertest";
-
-import app from "../src/app";
-
-describe("app", () => {
- it("responds with a not found message", (done) => {
- request(app)
- .get("/what-is-this-even")
- .set("Accept", "application/json")
- .expect("Content-Type", /json/)
- .expect(404, done);
- });
-});
-
-describe("GET /", () => {
- it("responds with a json message", (done) => {
- request(app)
- .get("/")
- .set("Accept", "application/json")
- .expect("Content-Type", /json/)
- .expect(
- 200,
- {
- message: "OK",
- },
- done,
- );
- });
-});
diff --git a/apps/tasks/tsconfig.json b/apps/tasks/tsconfig.json
deleted file mode 100644
index 519b48040..000000000
--- a/apps/tasks/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "compilerOptions": {
- "outDir": "dist",
- "sourceMap": true,
- "target": "esnext",
- "module": "commonjs",
- "esModuleInterop": true,
- "forceConsistentCasingInFileNames": true,
- "noImplicitAny": true,
- "strict": true,
- "skipLibCheck": true
- },
- "include": ["./*.js", "src/**/*.ts", "test/**/*.ts"]
-}