feat: 하나의 파일 변경점이 2개 이상의 워크스페이스에 매핑되면 에러를 발생시키도록 합니다#20
Open
feat: 하나의 파일 변경점이 2개 이상의 워크스페이스에 매핑되면 에러를 발생시키도록 합니다#20
Conversation
raon0211
reviewed
Apr 22, 2026
| return files | ||
| .map(file => { | ||
| return workspaces.find(workspace => file.startsWith(`${workspace}/`)); | ||
| return sortedWorkspaces.find(workspace => file.startsWith(`${workspace}/`)); |
Contributor
There was a problem hiding this comment.
Suggested change
| return sortedWorkspaces.find(workspace => file.startsWith(`${workspace}/`)); | |
| const workspaces = sortedWorkspaces.filter(workspace => file.startsWith(`${workspace}/`)); | |
| if (workspaces.length > 1) { | |
| throw new Error('Nested workspaces are not supported'); | |
| } | |
| return workspaces[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
배경
nested workspace가 존재하는 경우, 하나의 파일 변경점이 매칭된 여러 워크스페이스 경로 prefix에 매칭됩니다. 배열 순서에 따라 먼저 발견되는 워크스페이스에 매핑되어 비결정적인 결과를 주는 대신 에러를 발생시키도록 합니다.
독립적으로 빌드/릴리즈되는 패키지를 관리하는 저장소더라도
와 같은 어색한 워크스페이스 구조 대신,
와 같이 자연스러운 워크스페이스 구조를 권장합니다.
빌드 오케스트레이션 등 하위 패키지들을 대상으로 하는 관리 스크립트를 묶기 위한 상위 패키지가 존재한다면 workspace 배열에서 명시적으로 exclude해 workspace 멤버로 등록하지 않는 것을 권장합니다.
{ "workspaces": [ "packages/**", +. "!packages/root", ], }변경
matchWorkspacesByFiles.ts수정하나의 파일이 2개 이상의 워크스페이스에 매핑되면 에러를 발생시키도록 변경합니다.
getUpdatedWorkspaces.test.ts테스트 케이스 추가의존성 그래프 기반 변경 감지를 검증하는 통합 테스트 케이스를 추가했습니다.
workspace:*로 의존하는 워크스페이스가 결과에 포함된다테스트 증적