패키지, 저장소 및 앱 카테고리 검색

패키지 상세v5.1.0

dependency_validator

누락된, 과소 프로모션된, 과도하게 프로모션된 및 사용되지 않은 종속성 여부를 확인합니다.

macOSWindowsLinux
30일 다운로드
32.2만
좋아요
286
Pub 점수
110

패키지 설치

flutter pub add dependency_validator

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

프로젝트 종속성을 분석하여 누락된, 부족하게 승격된, 과도하게 승격된, 사용되지 않은 종속성을 식별하는 플러터/다트 개발자 도구입니다. 빌드 실패나 패키지 크기 증가를 유발할 수 있는 문제를 표시함으로써 깨끗하고 효율적인 pubspec.yaml 파일을 유지하는 데 도움을 줍니다. 간단한 명령줄 인터페이스를 통해 개발 워크플로우에 원활하게 통합됩니다. 복잡한 종속성 트리가 있는 대규모 코드베이스를 관리하는 팀에게 특히 유용합니다. Workiva에서 개발되었으며, macOS, Windows 및 Linux 플랫폼을 지원합니다.

사용 사례

  • pubspec.yaml 정확성 보장
  • 사용되지 않는 종속성 감지
  • 부족한 종속성으로 인한 빌드 실패 방지
  • 팀 프로젝트에서 종속성 위생 유지하기
  • 잘못된 종속성 승격 수준 식별

주요 기능

  • 실시간 종속성 분석
  • 여러 플랫폼을 지원합니다
  • 간단한 CLI 통합
  • 문제 보고서 지우기
  • 오픈소스, 공개 저장소

적합한 대상

  • Flutter 개발자
  • 팀 프로젝트 유지보수자
  • CI/CD 파이프라인 통합자
  • 대규모 Dart 애플리케이션
  • 코드 품질 지지자

고려 사항

  • 수동 실행 또는 CI 설정이 필요합니다
  • 복잡한 종속성 구조에 대한 구성이 필요할 수 있습니다
  • 철저한 테스트의 대체가 아님
  • 의존성 검증만 가능
  • 정확한 pubspec.yaml 구문에 의존합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Dependency Validator

A tool to help you find missing, under-promoted, over-promoted, and unused dependencies.

Installation

dart pub global activate dependency_validator

Usage

dart pub global run dependency_validator

This will report any missing, under-promoted, over-promoted, and unused dependencies. Any package that either provides an executable or a builder that will be auto-applied via the dart build system will be considered used even if it isn't imported.

  • Missing: When a dependency is used in the package but not declared in the pubspec.yaml
  • Under-promoted: When a dependency is used within lib/, bin/, or hook/ but only declared as a dev_dependency.
  • Over-promoted: When a dependency is only used outside lib/, bin/, and hook/ but declared as a dependency.
  • Unused: When a dependency is not used in the package but declared in the pubspec.yaml.

Hook scripts in hook/ (for example, build.dart and link.dart) run at build/link time (dart build, flutter build), so their imports must be regular dependencies. To opt out, use ignore to suppress warnings for a specific package name (for example, a dev_dependency used only in hooks), or exclude: ["hook/**"] to skip scanning the hook directory entirely (which also skips missing-dependency checks in hook files).

Configuration

There may be packages that are intentionally depended on but not used, or there may be directories that need to be ignored. You can statically configure these things in a dart_dependency_validator.yaml file in the root of your package:

# dart_dependency_validator.yaml

# Set true if you allow pinned packages in your project.
allow_pins: true
# Exclude one or more paths from being scanned. Supports glob syntax.
exclude:
  - "app/**"
# Ignore one or more packages.
ignore:
  - analyzer

[!Note] Previously this configuration lived in the pubspec.yaml, but that option was deprecated because pub publish warns about unrecognized keys.

Pub Workspaces (monorepos)

This package supports Pub Workspaces, a collection of packages in one repository. Workspaces allow Pub to share dependencies between your packages. Your top-level package's pubspec.yaml should have a workspace field that indicates which sub-packages should be included, like this:

workspace:
  - pkg1
  - pkg2

and your sub-packages should have resolution: workspace in their pubspec.yamls. For more information, see the linked documentation.

Running dependency_validator will always validate the package your terminal is in. If you run the tool on the top-level workspace package, it will analyze the workspace package and its sub-packages. To just analyze a sub-package, run the tool in its folder, or pass the -C argument:

$ dart run dependency_validator -C pkg1

카테고리

의존성

의존성 목록 13 개

소스 저장소

이 패키지를 사용하는 프로젝트