From 439d5d8d359b9c709779d36bd22101432c39343e Mon Sep 17 00:00:00 2001 From: x87 Date: Fri, 2 Oct 2020 00:05:00 -0400 Subject: [PATCH] fix(core): fix resolving projects for imports to '..' (#3846) * fix(core): fix resolving projects for imports to '..' * fix(core): fix formatting Co-authored-by: Jason Jean --- packages/workspace/src/utils/fileutils.spec.ts | 1 + packages/workspace/src/utils/fileutils.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/workspace/src/utils/fileutils.spec.ts b/packages/workspace/src/utils/fileutils.spec.ts index d1d0bc000dbf1..4c8b8a02f1e86 100644 --- a/packages/workspace/src/utils/fileutils.spec.ts +++ b/packages/workspace/src/utils/fileutils.spec.ts @@ -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', () => { diff --git a/packages/workspace/src/utils/fileutils.ts b/packages/workspace/src/utils/fileutils.ts index 7a41100010c56..3c4865d362d4e 100644 --- a/packages/workspace/src/utils/fileutils.ts +++ b/packages/workspace/src/utils/fileutils.ts @@ -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('../') + ); }