Skip to content

Commit

Permalink
feat: use mask for source instead rootDir
Browse files Browse the repository at this point in the history
  • Loading branch information
yarastqt committed Apr 24, 2020
1 parent b669d87 commit 2230e37
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/core/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import { transformTokens } from './transforms'
import { formats } from './formats'

export async function build(_options: Config): Promise<any> {
// TODO: Add mask for find files.
// TODO: Add tokens validate.
// TODO: Add avalible transforms validate.
// TODO: Add header for generated files with date/ts.
const themeLayers = await getThemeLayers(_options.rootDir, { platforms: _options.platforms, exclude: _options.exclude })
const themeLayers = await getThemeLayers(_options.src, { platforms: _options.platforms, exclude: _options.exclude })
for (const format in _options.formats) {
// @ts-ignore
const { options, transforms } = _options.formats[format]
Expand Down
3 changes: 1 addition & 2 deletions src/core/project-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { readJsonSync } from 'fs-extra'
import { Platforms } from './platforms'

export type Config = {
rootDir: string
exclude: string[]
src: string
platforms: Platforms
formats: {
[key: string]: {
Expand Down
4 changes: 2 additions & 2 deletions src/core/theme-layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export async function getThemeLayers(
): Promise<ThemeLayers> {
const result: ThemeLayers = {}
// @ts-ignore
const files = await fg('**/*.{js,ts}', { cwd: source, ignore: options.exclude })
const files = await fg(source)
for (const fileName of files) {
const fn = await importModule<ThemeTokens>(resolve(source, fileName))
const fn = await importModule<ThemeTokens>(resolve(fileName))
const maybeFn = fn()
const data = typeof maybeFn === 'function' ? maybeFn() : maybeFn
const { name: layer } = parse(fileName)
Expand Down

0 comments on commit 2230e37

Please sign in to comment.