Skip to content

Commit

Permalink
feat(state): adds paths
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 22, 2019
1 parent 2f91553 commit 96fd89b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/state/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { IOptions } from '~/types';
import { DEFAULT_LOG_LEVEL } from '~/constants';
import { setLevel } from '~/utils/logger';
import { lazy } from 'promist';
import up from 'find-up';

export interface IConfig {
load: ILoad;
paths: string[];
}

export const states = {
Expand Down Expand Up @@ -41,6 +43,9 @@ export default {
},
load(): Promise<ILoad> {
return config.then((x) => x.load);
},
paths(): Promise<string[]> {
return config.then((x) => x.paths);
}
};

Expand All @@ -59,6 +64,10 @@ async function getConfig(): Promise<IConfig> {
});

return {
load: res
load: res,
// TODO add root path
paths: [await up('node_modules/.bin', { cwd: res.directory })].filter(
(path, i, arr) => path && arr.indexOf(path) === i
) as string[]
};
}

0 comments on commit 96fd89b

Please sign in to comment.