Skip to content

Commit

Permalink
💚 Remove monads dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Sstark97 committed Oct 30, 2024
1 parent a5a4c37 commit 61e03c9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 25 deletions.
3 changes: 1 addition & 2 deletions components/ui/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as React from "react"

import { cn } from "@/lib/utils"

export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>

const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"test": "vitest"
},
"dependencies": {
"@leanmind/monads": "^1.2.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0",
Expand Down
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/backend/gitRepositoryManager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {RepositoryManager} from "@/src/backend/repositoryManager";
import simpleGit from "simple-git";
import {Octokit} from "octokit";
import {Option} from "@leanmind/monads";

export class GitRepositoryManager implements RepositoryManager {
async clone(url: string, path: string): Promise<void> {
Expand All @@ -20,10 +19,10 @@ export class GitRepositoryManager implements RepositoryManager {
description: 'Descripción del repositorio',
});
console.log('Repositorio creado con éxito:', response.data);
return Option.of(response.data.clone_url);
return response.data.clone_url;
} catch (error) {
console.error('Error al crear el repositorio:', error);
return Option.of(null);
throw error;
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/backend/repositoryManager.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {Option} from "@leanmind/monads";

export interface RepositoryManager {
clone(url: string, path: string): Promise<void>;
push(repoPath: string, newRepoUrl: string): Promise<void>;
createInRemote(repoName: string): Promise<Option<string | null>>;
createInRemote(repoName: string): Promise<string>;
}
13 changes: 5 additions & 8 deletions src/backend/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,11 @@ export async function execute(repos: string[], repositoryManager: RepositoryMana
await cloneRepository(repoPath, repoName, repoUrl, repositoryManager);
makeRepositoryAnonymous(repoPath, repoName);

const optionNewRepoUrl = await repositoryManager.createInRemote(`${repoName}-${uuidv4()}`);
if (optionNewRepoUrl.isSome()) {
const newRepoUrl = optionNewRepoUrl.getOrElse("") as string;
await repositoryManager.push(repoPath, newRepoUrl);
const newRepoDevUrl = createCodeSharingUrl(newRepoUrl);
console.log(`Redirigiendo a: ${newRepoDevUrl}`);
redirect(newRepoDevUrl);
}
const newRepoUrl = await repositoryManager.createInRemote(`${repoName}-${uuidv4()}`);
await repositoryManager.push(repoPath, newRepoUrl);
const newRepoDevUrl = createCodeSharingUrl(newRepoUrl);
console.log(`Redirigiendo a: ${newRepoDevUrl}`);
redirect(newRepoDevUrl);
}

async function cloneRepository(repoPath: string, repoName: string, repoUrl: string, repoCloner: RepositoryManager) {
Expand Down

0 comments on commit 61e03c9

Please sign in to comment.