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

패키지 상세v0.14.0

gql_build

GraphQL SDL 및 문서용 유용한 빌더입니다. package:gql_code_builder 및 package:build 기반

AndroidiOSmacOSWindowsLinux
30일 다운로드
1.4만
좋아요
15
Pub 점수
160

패키지 설치

flutter pub add gql_build

패키지 개요

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

gql_build는 GraphQL용 코드 생성 패키지로, GraphQL SDL(스키마 정의 언어) 및 문서를 처리하기 위한 빌더를 제공합니다. gql_code_builder와 빌드 시스템의 기능을 활용하여 GraphQL 스키마 및 쿼리에서 Dart 코드를 생성함으로써 GraphQL API와의 타입 안전한 상호작용을 가능하게 합니다. Flutter 또는 Dart 애플리케이션에서 GraphQL을 사용하는 개발자를 위해 설계되었으며, 코드 생성을 자동화함으로써 스키마 및 쿼리 관리를 간소화합니다. 이 패키지는 Android, iOS, macOS, Windows, Linux 등 여러 플랫폼을 지원합니다.

사용 사례

  • 타입 안전한 GraphQL 클라이언트 생성
  • 스키마 및 쿼리 코드 생성 자동화
  • Flutter 앱에 GraphQL 통합하기
  • 스키마 진화 간소화
  • GraphQL 쿼리의 컴파일 시 검증 활성화
  • 대규모 GraphQL 프로젝트 지원

주요 기능

  • GraphQL SDL에서 Dart 클래스 생성
  • 쿼리, 변동 및 구독에 대한 코드 생성을 지원합니다
  • 빌드 시스템 위에 구축되어 원활한 통합을 가능하게 함
  • GraphQL 작업에 강력한 타이핑을 제공합니다
  • 사용자 정의 빌더를 통해 확장성 제공
  • 다양한 플랫폼 간 호환성을 보장합니다

적합한 대상

  • GraphQL를 사용하는 Flutter 개발자
  • 복잡한 GraphQL 스키마를 관리하는 팀
  • GraphQL 사용에서 타입 안전성이 필요한 프로젝트
  • 자동 코드 생성 워크플로우를 찾는 개발자
  • 강력한 GraphQL 클라이언트 통합이 필요한 애플리케이션

고려 사항

  • 빌드 시스템에 대한 지식이 필요합니다
  • 큰 스키마를 사용할 경우 빌드 시간이 증가할 수 있습니다
  • build_runner의 올바른 설정에 의존합니다
  • pubspec.yaml에 올바른 구성이 필요합니다
  • GraphQL 스키마 및 문서와의 사용에 제한됨
  • 런타임 GraphQL 파싱에 적합하지 않습니다

원본 README

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

gql-dart/gql

MIT License PRs Welcome Watch on GitHub Star on GitHub Watch on GitHub Discord

This is an effort to advance the Dart GraphQL ecosystem.

It consists of multiple packages and libraries centered around GraphQL AST.

Packages

Core

The core of this project is the GraphQL parser which parses GraphQL strings into an AST. The parsed AST can then be transformed, visited and printed back to GraphQL string.

Pub Package Library Description
version package:gql ast.dart GraphQL AST implementation with Visitor pattern and AST transformer
version package:gql language.dart GraphQL source parser and printer. Recognizes both operations and SDL
version package:gql document.dart Document and schema validation
Code generation

GraphQL language enables code generation to speed up development and move document processing to build-time.

We provide code builders to generate Dart source code and file builders which easily plug into standard Dart code generation pipeline.

Ideas for future work:

  • Typed resolvers for field resolution on the client or server
Pub Package Library Description
version package:gql_code_builder Various builders
version package:gql_build File builders
Client

To enable development of GraphQL clients, we provide type definitions used to execute GraphQL operations. They include AST-based operation, request with per operation context, and response. These types are used by the Links.

Link is the current client implementation. Link is GraphQL AST-aware request/response middleware. They can be used to build a pipeline to deduplicate requests, conditionally transform requests and responses (including the context), and eventually send the requests to the server.

Ideas for future work:

  • websocket link for subscriptions
  • batched request HTTP link
  • retry link to handle network issues transparently
  • link for client-side request resolution
Pub Package Library Description
version package:gql_exec gql_exec.dart Implementation of types for GraphQL requests and responses
version package:gql_link link.dart Base for modular GraphQL execution interface
version package:gql_http_link gql_http_link.dart Link to execute GraphQL requests via HTTP
version package:gql_dedupe_link gql_dedupe_link.dart De-duplicating Link to avoid execution of identical requests
version package:gql_transform_link gql_transform_link.dart GQL Link to transform Requests and Responses. May be used to update context, document, variables, data, errors, etc.
version package:gql_websocket_link gql_websocket_link.dart GQL Link for subscriptions using websocket.
version package:gql_dio_link gql_dio_link.dart Similar to gql_http_link, A GQL Terminating Link to execute requests via Dio using JSON.
Other
Pub Package Library Description
version package:gql_pedantic Lint rules used by all gql-dart/gql packages
Examples
Pub Package Library Description
version package:gql_example_cli Example usage in a CLI environment
version package:gql_example_flutter Example usage in a Flutter environment

Users

Project Description
artemis Build dart types from GraphQL schemas and queries (using Introspection Query).
graphql A stand-alone GraphQL client for Dart, bringing all the features from a modern GraphQL client to one easy to use package.
graphql_flutter A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
normalize Normalization and denormalization of GraphQL responses in Dart
ferry GraphQL Client for Dart
Your project? Open a PR to add it to this readme!

Contributing

The goal of this project is to expand Dart GraphQL ecosystem and to build a community around this vendor-neutral implementation.

Community contributions are welcome.

Release Process

This repository uses Melos to manage the monorepo and handle releases. The release process is partially automated through GitHub Actions.

Repository Structure

The repository is organized into several package categories:

  • Core packages:

    • gql: Core GraphQL package
    • gql_tristate_value
    • gql_code_builder_serializers
    • gql_code_builder
  • Execution packages:

    • gql_exec
    • gql_link
  • Link implementations:

    • gql_http_link
    • gql_dio_link
    • gql_websocket_link
    • gql_dedupe_link
    • gql_error_link
    • gql_transform_link
  • Build packages:

    • gql_build

Local Development

To get started with local development:

  1. Install Melos:

    dart pub global activate melos && dart pub get
    
  2. Bootstrap the workspace:

    melos bootstrap
    
  3. Run tests:

    melos test
    

Release Process

Automated Publishing

The publish workflow is automated via GitHub Actions and triggers when:

  • Changes are pushed to the master or release branches AND include changes to any pubspec.yaml file
  • Manually triggered through GitHub Actions UI

The automated process:

  1. Validates all packages (formatting, analysis, and tests)
  2. Publishes packages in dependency order:
    • Core packages first
    • Execution packages second
    • Link implementation packages third
    • Build packages last
Manual Release Steps

To create a new release manually:

  1. Ensure you're on the branch you want to release from (master or release)

  2. Version the packages using one of the following commands:

    # For a patch release
    melos run bump-patch
    
    # For a minor release
    melos run bump-minor
    
    # For a major release
    melos run bump-major
    
    # For an alpha release
    melos run bump-alpha
    
    # To graduate from prerelease(alpha) to stable
    melos run graduate
    
  3. Push the changes and tags:

    git push && git push --tags
    
  4. The GitHub Action will automatically handle publishing to pub.dev if changes include pubspec.yaml files

Versioning Rules
  • Use bump-patch for backward-compatible bug fixes
  • Use bump-minor for backward-compatible features
  • Use bump-major for breaking changes
  • Use bump-alpha for prerelease versions
  • Use graduate to promote prerelease versions to stable

Available Melos Commands

  • melos bootstrap: Set up the workspace
  • melos clean: Clean all packages
  • melos test: Run tests for all packages
  • melos format: Format all packages
  • melos analyze: Run static analysis
  • melos build: Run build_runner for all packages
  • melos publish: Publish packages to pub.dev

Troubleshooting

If the automated publish fails:

  1. Check the GitHub Actions logs for specific errors
  2. Ensure all tests are passing locally: melos test
  3. Verify that version numbers in pubspec.yaml files are correct
  4. Check that all dependencies are properly versioned

For manual publishing (if needed, requires pub dev authentication):

melos publish --no-dry-run --yes --scope="package_name"

Notes

  • The publish workflow publishes packages in a specific order to handle dependencies correctly
  • All packages are versioned together to maintain consistency
  • The workflow automatically handles pub.dev credentials through GitHub Secrets
  • Changes to pubspec.yaml files automatically trigger the publish workflow

Features and bugs

Please file feature requests and bugs at the GitHub.

카테고리

의존성

의존성 목록 15 개

소스 저장소

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

아직 데이터가 없습니다.