Skip to content

Commit

Permalink
drop not needed generator key in plugin config
Browse files Browse the repository at this point in the history
  • Loading branch information
krzkaczor committed Aug 28, 2018
1 parent ed20e0d commit 8b995f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/parseConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@ import { TDeps } from "./deps";
import { Dictionary } from "./stl";
import { Omit } from "./stl";

export type TPluginCfg<T = Dictionary<any>> = {
export type TRawPluginCfg<T = Dictionary<any>> = {
files: string;
generator: string;
} & T;

export interface TTsGenCfg {
export type TPluginCfg<T = Dictionary<any>> = Omit<TRawPluginCfg<T>, "generator">;

export interface TRawCfg {
cwd: string;
plugins: TPluginCfg[];
plugins: TRawPluginCfg[];
prettier?: PrettierOptions;
}

export type TCfg = Omit<TTsGenCfg, "plugins">;
export type TCfg = Omit<TRawCfg, "plugins">;

interface TArgs {
cwd: string;
configPath: string;
}

export async function parseConfigFile({ fs, prettier, logger }: TDeps, { cwd, configPath }: TArgs): Promise<TTsGenCfg> {
export async function parseConfigFile({ fs, prettier, logger }: TDeps, { cwd, configPath }: TArgs): Promise<TRawCfg> {
const config = fs.readFileSync(configPath, "utf-8");

// assume that config is correctly formatted JUST FOR NOW
Expand Down
8 changes: 4 additions & 4 deletions src/tsGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { outputTransformers } from "./outputTransformers";

export async function tsGenerator(
cfg: TCfg,
_plugins: TsGeneratorPlugin | TsGeneratorPlugin[],
_deps?: TDeps,
plugins_: TsGeneratorPlugin | TsGeneratorPlugin[],
deps_?: TDeps,
): Promise<void> {
const deps = _deps || createDeps();
const plugins = isArray(_plugins) ? _plugins : [_plugins];
const deps = deps_ || createDeps();
const plugins = isArray(plugins_) ? plugins_ : [plugins_];

const { cwd } = cfg;
const { fs, logger } = deps;
Expand Down

0 comments on commit 8b995f4

Please sign in to comment.