Skip to content

Conversation

@pja9362
Copy link
Contributor

@pja9362 pja9362 commented Jan 5, 2026

Related Issue

Describe your changes

변경 사항

@naverpay/code-style-cli 패키지를 추가합니다.

pnpm v10+에서 postinstall 스크립트가 기본적으로 실행되지 않는 문제에 대응하여, 패키지 설치와 설정 파일 생성을 한 번에 처리하는 CLI 도구입니다.

npx @naverpay/code-style-cli

기능

  • 패키지 매니저 자동 감지 (npm, yarn, pnpm)
  • 패키지 선택 UI
  • 선택한 패키지 설치
  • 설정 파일 자동 생성
  • oxfmt 지원 추가 (extends 미지원으로 별도 config 패키지 없이 CLI에서 직접 권장 설정 생성)

지원 패키지

패키지 설정 파일
@naverpay/prettier-config .prettierrc
@naverpay/stylelint-config stylelint.config.mjs
@naverpay/markdown-lint .markdownlint.jsonc
@naverpay/editorconfig .editorconfig
@naverpay/oxlint-config .oxlintrc.json
@naverpay/biome-config biome.json
oxfmt .oxfmtrc.json

eslint-config, eslint-plugin은 프로젝트 환경에 따라 설정이 다양하여 설정 파일을 자동 생성하지 않습니다.

동작흐름

npx @naverpay/code-style-cli
         │
         ▼
1. package.json 존재 확인
   └─ 없으면 → 에러 후 종료
         │
         ▼
2. 패키지 매니저 감지
   └─ pnpm-lock.yaml → pnpm
   └─ yarn.lock → yarn
   └─ 기본값 → npm
         │
         ▼
3. 패키지 선택 UI (checkbox)
   └─ 선택 없으면 → 종료
         │
         ▼
4. 선택된 모든 패키지 설치
   └─ pnpm add -D pkg1 pkg2 pkg3 ...
         │
         ▼
5. 각 도구별로:
   └─ configFile 정의됨?
      └─ Yes → 설정 파일 이미 존재?
               └─ Yes → 덮어쓰기 확인
                        └─ Yes → 덮어쓰기
                        └─ No → 스킵
               └─ No → 생성
      └─ No → 아무것도 안 함

         ▼
완료!

사용 예시

  • 설치할 패키지 선택
스크린샷 2026-01-05 오후 2 35 41
  • 선택한 패키지 설치 및 기본 설정 파일 생성
스크린샷 2026-01-05 오후 2 36 06

기타

prompt 라이브러리 선택

라이브러리 상태
prompts 마지막 업데이트 2021년 10월, 유지보수가 잘 안됨
@clack/prompts 아직 0.x 버전이라 비교적 불안정
@inquirer/prompts 오래되고 성숙한 생태계, 꾸준히 유지보수 ✅

@pja9362 pja9362 self-assigned this Jan 5, 2026
@npayfebot
Copy link
Contributor

npayfebot commented Jan 5, 2026

✅ Changeset detected

Latest commit: 8f6112c

@naverpay/code-style-cli package have detected changes.

If no version change is needed, please add skip-detect-change to the label.

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@naverpay/code-style-cli ✨ Minor
powered by: naverpay changeset detect-add actions

@pja9362
Copy link
Contributor Author

pja9362 commented Jan 6, 2026

신규 패키지 첫 배포는 로컬에서 직접해야 한다고 말씀해주셨던 것 같아서, changeset은 추가하지 않았습니다!
혹시 필요하다면 말씀 부탁드립니다 🙇‍♀️

@pja9362 pja9362 marked this pull request as ready for review January 6, 2026 03:01
@pja9362 pja9362 requested a review from a team as a code owner January 6, 2026 03:01

if (packagesToInstall.length > 0) {
console.log('\n📥 패키지 설치 중...')
execSync(`${INSTALL_CMD[pm]} ${packagesToInstall.join(' ')}`, {stdio: 'inherit'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요런거 설치 실패시 try catch 로 감싸주세용

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다! 반영했습니당: 6e7dcf3


const BIOME_CONTENT = JSON.stringify(
{
$schema: 'https://biomejs.dev/schemas/2.2.6/schema.json',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요고 biome 버전이랑 연동은 안되나여? 설치한거랑 스키마 버전이 다른가

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 기존 코드에서는 실제 설치된 버전이랑 스키마 버전이 다를 수가 있겠군요.
패키지 설치 후 package.json의 biome 버전을 읽어 스키마 URL을 동적으로 생성하도록 수정했습니다! e5b30f9

@yceffort-naver
Copy link
Contributor

로컬 publish 한번 해드릴까요?

Comment on lines 103 to 107
export const INSTALL_CMD = {
npm: 'npm install -D',
yarn: 'yarn add -D',
pnpm: 'pnpm add -D',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

패키지 매니저 관련 내용이 흩어져 있어서 조금 보기 힘든 느낌쓰

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다!
INSTALL_CMD와 lockfile 감지 로직을 PACKAGE_MANAGERS 객체로 통합해서 관리하도록 수정했습니다 : 07c88ec

@yceffort-naver
Copy link
Contributor

설치할 패키지 설치시 설치가 되어 있으면 어떻게 되나여? 설치 후 업데이트? 아니면 abort? 규칙덮어쓰나용?

설치된 @biomejs/biome 버전에 맞춰 biome.json의 $schema URL을 자동으로 설정합니다.
PACKAGE_MANAGERS 객체로 lock 파일과 install 명령어를 한 곳에서 관리합니다.
@pja9362
Copy link
Contributor Author

pja9362 commented Jan 6, 2026

설치할 패키지 설치시 설치가 되어 있으면 어떻게 되나여? 설치 후 업데이트? 아니면 abort? 규칙덮어쓰나용?

@yceffort-naver 님,

기존에는 설치 여부와 관계없이 그냥 재설치되고, 설정 파일이 존재하면 설정 파일 생성을 스킵했습니다. (덮어쓰기 X)

조금 더 고민해본 결과,

  • 패키지 선택 목록 보여줄 때, 이미 설치된 패키지 명시 & 업데이트 안내
스크린샷 2026-01-06 오후 3 15 15
  • 설정 파일 존재하는 경우, 덮어쓰기 선택 가능하도록 개선
스크린샷 2026-01-06 오후 3 16 19

위와 같이 수정하였습니다! 4e6d55e

@yceffort-naver
Copy link
Contributor

@pja9362 님, changeset 배포도 될거예여 제가 연동함 (아마도)

@pja9362
Copy link
Contributor Author

pja9362 commented Jan 6, 2026

@yceffort-naver 님 감사합니다!

배포해주신 버전으로 테스트 해봤는데 정상 동작하는 것 같습니다 🥳🥳
스크린샷 2026-01-06 오후 3 41 19
스크린샷 2026-01-06 오후 3 42 44

@yceffort-naver
Copy link
Contributor

changeset 만 추가하시죠!

Added CLI tool for installing and configuring the code-style-cli package.
@pja9362
Copy link
Contributor Author

pja9362 commented Jan 6, 2026

changeset 만 추가하시죠!

@yceffort-naver 님, 추가했습니다! 감사합니다 🙇‍♀️

Copy link
Contributor

@yceffort-naver yceffort-naver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다!

@pja9362 pja9362 merged commit 2f4b091 into main Jan 6, 2026
3 checks passed
@pja9362 pja9362 deleted the feature/cli branch January 6, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants