chore: enforce package.json consistency across the workspace#252
Conversation
…chore/package-structure-yeom
🦋 Changeset detectedLatest commit: 9573e3c The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| return policySchema.parse(parsed); | ||
| } | ||
|
|
||
| function isAllowlisted(allowlist: Allowlist, packageName: string, rule: string, fieldPath?: string): boolean { |
There was a problem hiding this comment.
checkPackage()는 allowlist 항목을 "소비"할 때만 참조하고, 반대로 "한 번도 사용되지 않은 항목"은 감지하지 못합니다.
예를 들어 @sipe-team/tokens에 나중에 test 스크립트가 추가되면 allowlist의 scripts.test 항목은 dead entry가 되지만 checker는 이를 알 수 없습니다.
There was a problem hiding this comment.
오 정확한 지적입니다.
Allowlist가 20개+로 커지거나 dead entry가 여러 번 실제 문제로 드러나면 별도 PR로 진행하겠습니다! 지금 당장 넣는건 오버엔지니어링 같습니당
추후 운영에는 해당 CI 로직을 제거하는게 최종 goal입니다~~
| @@ -0,0 +1,78 @@ | |||
| { | |||
| "$schema": "./package-policy.schema.json", | |||
There was a problem hiding this comment.
There was a problem hiding this comment.
처음엔 mantine에서 syncpack을 쓰길래 요걸로 셋업했었는데, catelog:, workspace까지만 잡아주길래 살짝 아쉬워서 찾아보니 @manypkg/cli도 있는데 요것도 아쉬워서
직접 package를 순회하면서 제가 설정한 셋업에 깐깐하게 맞추고 싶어서 스크립트를 만들기 위해 선언했습니다!
많은 라이브러리들은 이렇게 깐깐하게 관리는 안합니다만, 초반에 package cleansing과 같이 package sync하는 번거로움을 덜기위해 만들었습니다 -> 솔직히 나중에 운영관점에서는 제거하는 방향으로 가는게 최종 goal 입니다
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Changes
packages/*/package.json이 PR마다 조금씩 달라지는 문제를 막기 위한 논블로킹 일관성 시스템 도입.Storybook 스크립트를 root로 통합(18개 패키지)
package-policy.json+ zod 기반scripts/checkPackageConsistency.ts+ 매 PR CI(consistency.yaml)에서 Step Summary에 리포트.continue-on-error로 merge 차단 안 함.(allowlist는reason필수.)Visuals
N/A — 메타데이터/툴링.
Checklist
All 21 packages pass.Additional Discussion Points
chip-normalize,package-json-divergence-cleanup)로 충분. tooling/CI/docs/storybookscript 제거는 소비자 runtime 영향 없음.
@manypkg/cli의check도 고려했으나 빌트인 룰(license/repository/engines/internal dep) 만으로는 부족. scripts 값정확 일치,
publishConfig.registry존재,sideEffects값 enum, catalog 참조 강제, allowlistreason필수 같은 더 빡빡한 규칙이 필요해 커스컴 checker를 작성(w/ cluade!!).