Skip to content

Commit

Permalink
refactor: move get-option(s) out of transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
moontai0724 committed Oct 8, 2024
1 parent 9a3443c commit 88e49fd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
12 changes: 7 additions & 5 deletions src/transformers/get-option.spec.ts → src/get-option.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const getStringOption = vi.fn().mockReturnValue({ type: "mocked" });
let component: typeof import("./get-option");

beforeAll(async () => {
vi.doMock("./array", () => ({ getArrayOption }));
vi.doMock("./boolean", () => ({ getBooleanOption }));
vi.doMock("./choice", () => ({ getChoiceOption }));
vi.doMock("./number", () => ({ getNumberOption }));
vi.doMock("./string", () => ({ getStringOption }));
vi.doMock("./transformers", () => ({
getArrayOption,
getBooleanOption,
getChoiceOption,
getNumberOption,
getStringOption,
}));
component = await import("./get-option");
});

Expand Down
12 changes: 7 additions & 5 deletions src/transformers/get-option.ts → src/get-option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import {
} from "@sinclair/typebox";
import type { Options } from "yargs";

import { getArrayOption } from "./array";
import { getBooleanOption } from "./boolean";
import { getChoiceOption } from "./choice";
import { getNumberOption } from "./number";
import { getStringOption } from "./string";
import {
getArrayOption,
getBooleanOption,
getChoiceOption,
getNumberOption,
getStringOption,
} from "./transformers";

export function getOption<T extends TSchema, O extends Options = object>(
schema: T,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from "./get-option";
export * from "./get-options";
export * from "./transformers";
2 changes: 0 additions & 2 deletions src/transformers/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
export * from "./array";
export * from "./boolean";
export * from "./choice";
export * from "./get-option";
export * from "./get-options";
export * from "./number";
export * from "./string";

0 comments on commit 88e49fd

Please sign in to comment.