-
Notifications
You must be signed in to change notification settings - Fork 3
fix(core): pm2 peer 범위 확대 및 optional 전환 #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "@naverpay/prometheus-core": minor | ||
| --- | ||
|
|
||
| fix(core): pm2 peer 범위 확대 및 optional 전환 | ||
|
|
||
| PR: [fix(core): pm2 peer 범위 확대 및 optional 전환](https://github.com/NaverPayDev/prometheus/pull/20) |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[issue]
optional: true설정만으로는 pm2 미설치 환경에서의 강제 설치/크래시 문제가 실제로 해소되지 않는 것 같습니다.packages/core/src/pm2/promisify.ts에import pm2 from 'pm2'가 top-level로 있고,src/index.ts가pm2/promisify.ts와pm2/messages.ts를 무조건 re-export하고 있습니다.@naverpay/prometheus-koa(또는 hono/next)를 import만 해도 core의index.ts를 거쳐pm2/promisify.ts가 즉시 로드되고, 그 안의import pm2 from 'pm2'가 실행됩니다.node_modules에 없으면peerDependenciesMeta.pm2.optional: true와 무관하게Cannot find module 'pm2'로 즉시 크래시됩니다.optional: true는 pnpm/npm의 peer warning만 제거해줄 뿐, 런타임 로딩 문제는 그대로인 것 같습니다.근거: PR 설명에서 목표로 삼은 "pm2 사용 안 하는 프로젝트의 강제 설치 문제 해소"가 peer 범위·optional 플래그 조정만으로는 실제로 달성되지 않고, pm2 미설치 상태로 다른 패키지를 사용하면 여전히 런타임 에러가 발생할 것으로 보입니다.
이점: pm2 관련 모듈(
pm2/promisify.ts,pm2/messages.ts)을 동적 import로 전환해pm2Connector.connect()호출 시점에만 로드하거나, subpath export로 분리하면 pm2 미사용 프로젝트에서 설치 없이도 나머지 기능을 안전하게 사용할 수 있습니다.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional 전환이 이 PR의 주요한 목적이 아니었다면 그냥 넘어가셔도 무방할 것 같아요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyungmi 님, 겸사겸사 챙긴거긴 했는데요, 설치할때 말고 import할때도 문제되지 않도록 해주는게 더 좋을 것 같아서 이번에 수정해주었습니다! 한번만 더 확인 부탁드려요!