Skip to content

Commit

Permalink
feat: support sources as single string
Browse files Browse the repository at this point in the history
  • Loading branch information
yarastqt committed Jun 4, 2020
1 parent e3b2860 commit b3cd2aa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core-v2/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ function resolveRootDir(filePath: string): string {
: filePath
}

export async function loadThemes(sources: string[]): Promise<Themes> {
export async function loadThemes(sources: string | string[]): Promise<Themes> {
const result: Themes = { mappers: [], sources: [], whitepaper: {} }
for (const sourcePath of sources) {
const normalizedSources = Array.isArray(sources) ? sources : [sources]
for (const sourcePath of normalizedSources) {
const { mappers = [], sources = [], whitepaper }: Themes = await readJSON(sourcePath)
result.mappers.push(...mappers.map(resolveRootDir))
result.sources.push(...sources.map(resolveRootDir))
Expand Down

0 comments on commit b3cd2aa

Please sign in to comment.