Skip to content

Commit

Permalink
fix(exposed): uses core.cwd() instead of core.paths() to determine cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 28, 2019
1 parent bd05d45 commit dd02f9c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/exposed/file/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ function json(
fn: (json: IOfType<any>) => IOfType<any> | void | Promise<IOfType<any> | void>
): () => Promise<void> {
return async () => {
const paths = await core.paths();
file = absolute({ path: file, cwd: paths.directory });
file = absolute({ path: file, cwd: await core.cwd() });

await exists(file, { fail: true });
const json = await fs.readJSON(file).catch(rejects);
Expand Down
4 changes: 1 addition & 3 deletions src/exposed/tags/ensure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ function ensure(
*/
function ensure(...args: any[]): () => Promise<void> {
return async () => {
// TODO fix core.paths() -> core.cwd()
const paths = await core.paths();
const directory = absolute({
path: asTag(args.shift(), ...args),
cwd: paths.directory
cwd: await core.cwd()
});

await fs.ensureDir(directory).catch(rejects);
Expand Down
3 changes: 1 addition & 2 deletions src/exposed/tags/exists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ function exists(
*/
function exists(...args: any[]): () => Promise<void> {
return async () => {
const paths = await core.paths();
const file = absolute({
path: asTag(args.shift(), ...args),
cwd: paths.directory
cwd: await core.cwd()
});

await _exists(file, { fail: true });
Expand Down

0 comments on commit dd02f9c

Please sign in to comment.