パッケージ、リポジトリ、アプリカテゴリを検索

GitHub リポジトリmatthewnitschke/pubspec_lock_parse

pubspec_lock_parse

pubspec.lock ファイルをパースするためのシンプルなパッケージで、タイプセーフな API と豊富なエラー報告を提供します。

pubspec_lock_parse のプロジェクト画像
スター
5
フォーク
2
最終プッシュ(UTC)
2022/10/15
プロジェクト状態
公開中

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

Dart pub package

Supports parsing pubspec.lock files with robust error reporting

Designed around the pubspec_parse package, and mirrors its implementation and interface

Usage

import 'dart:io';
import 'package:pubspec_lock_parse/pubspec_lock_parse.dart';

void main() {
    final lockStr = File('path/to/pubspec.lock').readAsStringSync();
    final lockfile = PubspecLock.parse(lockStr);
}

You can find more about the PubspecLock object in the documentation here

toJson() methods

pubspec_lock_parse includes .toJson() methods on each object to allow for easy re-generation/mutation of pubspec files

This can be combined with yaml_writer to re-generate yaml output

void main() {
    final pubspec = PubspecLock(
        packages: {
            'somePackage': Package(
                dependency: 'transitive',
                description: PathPackageDescription(
                    path: '../somePackage',
                    relative: true,
                )
            )
        },
        sdks: {
            'dart': VersionConstraint.parse(">=2.17.0 <3.0.0"),
        }
    );

    final jsonPubspec = pubspec.toJson(); // outputs Map<String, dynamic>
    final yamlPubspec = YamlWriter().write(jsonPubspec); // outputs String
}

toJson can also be run on any individual object

// outputs: { path: '../somePackage', relative: true }
print(PathPackageDescription(
    path: '../somePackage',
    relative: true,
).toJson());
Matthew GitHub avatar
GitHub 作者

Matthew ↗

Dedicated to overengineering solutions to problems no one has

言語Dart

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 9 件

プロジェクトに合うリポジトリを選ぶには?

用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。

  1. 名前・作者・説明で検索し、技術トピックで絞り込みます。
  2. スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
  3. 利用前に GitHub で README、ライセンス、Issues を確認します。

情報源と管理

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗