Pakete, Repositories und App-Kategorien suchen

GitHub-Repositorymatthewnitschke/pubspec_lock_parse

pubspec_lock_parse

Einfaches Paket zum Parsen von pubspec.lock-Dateien mit einer typensicheren API und umfassender Fehlerberichterstattung.

Projektcover von pubspec_lock_parse
Sterne
5
Forks
2
Letzter Push (UTC)
15.10.2022
Projektstatus
Aktiv

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf 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-Autor

Matthew ↗

Dedicated to overengineering solutions to problems no one has

SprachenDart

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 9 Einträge

Wie wähle ich ein passendes Repository?

Nach Anwendungsfall filtern, Aktivität vergleichen und vor der Nutzung das Originalprojekt prüfen.

  1. Nach Name, Autor oder Beschreibung suchen und nach Thema eingrenzen.
  2. Sterne, Forks und letzte Pushes vergleichen. Sterne zeigen Interesse, garantieren aber keine Qualität.
  3. Vor der Nutzung README, Lizenz und Issues auf GitHub prüfen.

Quellen und Pflege

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

GitHub Docs — About repositories ↗