Skip to content

Commit

Permalink
fix(core): fix resolving projects for imports to '..' (#3846)
Browse files Browse the repository at this point in the history
* fix(core): fix resolving projects for imports to '..'

* fix(core): fix formatting

Co-authored-by: Jason Jean <[email protected]>
  • Loading branch information
x87 and FrozenPandaz committed Oct 9, 2020
1 parent 8c85bf9 commit 439d5d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/workspace/src/utils/fileutils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe('fileutils', () => {
expect(isRelativePath('./file')).toEqual(true);
});
it('should return true for upper imports', () => {
expect(isRelativePath('..')).toEqual(true);
expect(isRelativePath('../file')).toEqual(true);
});
it('should return false for absolute imports', () => {
Expand Down
7 changes: 6 additions & 1 deletion packages/workspace/src/utils/fileutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,10 @@ export function renameSync(
}

export function isRelativePath(path: string): boolean {
return path === '.' || path.startsWith('./') || path.startsWith('../');
return (
path === '.' ||
path === '..' ||
path.startsWith('./') ||
path.startsWith('../')
);
}

0 comments on commit 439d5d8

Please sign in to comment.