Skip to content

Commit

Permalink
chore: move web cli utils to its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
thomvaill committed Dec 14, 2024
1 parent 1c2fc56 commit 9446079
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/web/src/cli/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getLog4brainsInstance } from "../../lib/core-api";
import { getNextJsDir } from "../../lib/next";
import { Search } from "../../lib/search";
import { toAdrLight } from "../../types";
import { execNext } from "../../lib/console";
import { execNext } from "../utils";

type Deps = {
appConsole: AppConsole;
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/cli/commands/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import open from "open";
import type { AppConsole } from "@log4brains/cli-common";
import { getLog4brainsInstance } from "../../lib/core-api";
import { getNextJsDir } from "../../lib/next";
import { execNext } from "../../lib/console";
import { execNext } from "../utils";

type Deps = {
appConsole: AppConsole;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import chalk from "chalk";
import { ConsoleCapturer } from "@log4brains/cli-common";

Expand All @@ -15,6 +13,7 @@ export async function execNext(fn: () => Promise<void>): Promise<void> {
const capturer = new ConsoleCapturer();
capturer.onLog = (method, args, stream) => {
if (stream === "stderr" || debug) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
capturer.doPrintln(...["[Next] ", ...args].map((a) => chalk.dim(a)));
}
};
Expand Down
7 changes: 0 additions & 7 deletions packages/web/src/lib/adr-utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { Adr, AdrLight } from "../types";

export function getAdrBySlug(
slug: string,
adrs: AdrLight[]
): AdrLight | undefined {
return adrs.filter((a) => a.slug === slug).pop();
}

export function buildAdrUrl(adr: AdrLight | Adr): string {
return `/adr/${adr.slug}`;
}

0 comments on commit 9446079

Please sign in to comment.