Skip to content

Commit

Permalink
Tweak again.
Browse files Browse the repository at this point in the history
  • Loading branch information
matanlurey committed Oct 6, 2024
1 parent 7c4d13e commit cbd0e33
Show file tree
Hide file tree
Showing 15 changed files with 164 additions and 12 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

A wide but independent collection of Dart packages and projects.

[![Coverage Status](https://coveralls.io/repos/github/matanlurey/pub.lurey.dev/badge.svg?branch=main)](https://coveralls.io/github/matanlurey/pub.lurey.dev?branch=main)

## Packages

<!-- #region(PACKAGE_TABLE) -->

| Project | Release | Description |
|:--------|:--------|:------------|
| [`iota`](./packages/iota) | [![Pub version for package/iota](https://img.shields.io/pub/v/iota?label=%20)](https://pub.dev/packages/iota) | Minimalist file system API which is compatible with sandboxes. |
| [`jsonut`](./packages/jsonut) | [![Pub version for package/jsonut](https://img.shields.io/pub/v/jsonut?label=%20)](https://pub.dev/packages/jsonut) | A minimal utility kit for working with JSON in a typesafe manner. |
| [`lore`](./packages/lore) | [![Pub version for package/lore](https://img.shields.io/pub/v/lore?label=%20)](https://pub.dev/packages/lore) | Fast, structured, and idiomatic logging with an extensible API. |
| [`mansion`](./packages/mansion) | [![Pub version for package/mansion](https://img.shields.io/pub/v/mansion?label=%20)](https://pub.dev/packages/mansion) | A stately library for crafting and deciphering ANSI escape codes. |
| [`oath`](./packages/oath) | [![Pub version for package/oath](https://img.shields.io/pub/v/oath?label=%20)](https://pub.dev/packages/oath) | Swear a Paladin's Oath to code righteousness by enforcing lints. |
| [`proc`](./packages/proc) | [![Pub version for package/proc](https://img.shields.io/pub/v/proc?label=%20)](https://pub.dev/packages/proc) | Run and manage OS processes with an extensible and testable API. |
| [`sdk`](./packages/sdk) | Unreleased | Utilities for finding and using the Dart SDK programmatically. |
| [`webby`](./packages/webby) | [![Pub version for package/webby](https://img.shields.io/pub/v/webby?label=%20)](https://pub.dev/packages/webby) | An artisnal hand-crafted interopability library for the web platform. |
| [`iota`](./packages/iota) | [![Pub version for package/iota](https://img.shields.io/pub/v/iota?label=%20)](https://pub.dev/packages/iota) | Minimalist file system API. |
| [`jsonut`](./packages/jsonut) | [![Pub version for package/jsonut](https://img.shields.io/pub/v/jsonut?label=%20)](https://pub.dev/packages/jsonut) | Minimal JSON utilities. |
| [`lore`](./packages/lore) | [![Pub version for package/lore](https://img.shields.io/pub/v/lore?label=%20)](https://pub.dev/packages/lore) | Fast, structured, and idiomatic logging. |
| [`mansion`](./packages/mansion) | [![Pub version for package/mansion](https://img.shields.io/pub/v/mansion?label=%20)](https://pub.dev/packages/mansion) | Create and parse ANSI escape codes. |
| [`oath`](./packages/oath) | [![Pub version for package/oath](https://img.shields.io/pub/v/oath?label=%20)](https://pub.dev/packages/oath) | Strict linting for Dart packages. |
| [`proc`](./packages/proc) | [![Pub version for package/proc](https://img.shields.io/pub/v/proc?label=%20)](https://pub.dev/packages/proc) | Extensible process management. |
| [`sdk`](./packages/sdk) | _Unreleased_ | Utilities for finding and using the Dart SDK programmatically. |
| [`webby`](./packages/webby) | [![Pub version for package/webby](https://img.shields.io/pub/v/webby?label=%20)](https://pub.dev/packages/webby) | Hand-crafted interop for web apps. |

<!-- #endregion -->
15 changes: 15 additions & 0 deletions dev/lib/src/commands/coverage.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'dart:async';

import 'package:args/command_runner.dart';

/// A command that generates a LCOV coverage report.
final class CoverageCommand extends Command<void> {
@override
String get name => 'coverage';

@override
String get description => 'Generate a LCOV coverage report.';

@override
FutureOr<void> run() async {}
}
2 changes: 2 additions & 0 deletions dev/lib/src/commands/generate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ final class GenerateCommand extends Command<void> {
name: package,
isPublishable: pubspec.isPublishable,
description: pubspec.description,
shortDescription: pubspec.shortDescription,
);

// Generate the README file.
Expand Down Expand Up @@ -143,6 +144,7 @@ final class GenerateCommand extends Command<void> {
name: package,
isPublishable: yaml.isPublishable,
description: yaml.description,
shortDescription: yaml.shortDescription,
),
);
}
Expand Down
8 changes: 6 additions & 2 deletions dev/lib/src/generators/root_readme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final class Package {
required this.name,
required this.isPublishable,
required this.description,
required this.shortDescription,
});

/// Name of the package.
Expand All @@ -18,6 +19,9 @@ final class Package {

/// Description of the package.
final String description;

/// Short description of the package.
final String shortDescription;
}

/// Generates a region of the root README file.
Expand All @@ -35,10 +39,10 @@ String generateRootReadmeRegion(Iterable<Package> packages) {
if (package.isPublishable) {
buffer.write(_generatePubStatus(package.name));
} else {
buffer.write('Unreleased');
buffer.write('_Unreleased_');
}
buffer.write(' | ');
buffer.write(package.description);
buffer.write(package.shortDescription);
buffer.writeln(' |');
}

Expand Down
40 changes: 40 additions & 0 deletions dev/lib/src/parsers/pubspec_yaml.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:collection';

import 'package:yaml/yaml.dart';

/// Parses a pubspec file.
Expand Down Expand Up @@ -33,4 +35,42 @@ final class PubspecYaml {
}
return description;
}

/// Short description of the package.
///
/// If omitted, the full [description] is returned.
String get shortDescription {
final description = (_doc.contents as YamlMap)['short_description'];
if (description == null) {
return this.description;
}
if (description is! String) {
throw FormatException(
'Expected a string, got ${description.runtimeType}',
_doc.span.text,
);
}
return description;
}

/// Which packages are listed as part of the workspace.
List<String> get workspace {
final packages = (_doc.contents as YamlMap)['workspace'];
if (packages == null) {
return const [];
}
if (packages is! List) {
throw FormatException(
'Expected a list, got ${packages.runtimeType}',
_doc.span.text,
);
}
if (packages.any((e) => e is! String)) {
throw FormatException(
'Expected a list of strings, got ${packages.runtimeType}',
_doc.span.text,
);
}
return UnmodifiableListView(packages.cast());
}
}
21 changes: 21 additions & 0 deletions dev/lib/src/runner.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import 'dart:io' as io;

import 'package:args/command_runner.dart';
import 'package:dev/src/commands/check.dart';
import 'package:dev/src/commands/coverage.dart';
import 'package:dev/src/commands/generate.dart';
import 'package:dev/src/parsers/pubspec_yaml.dart';
import 'package:dev/src/utils/find_root_dir.dart';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as p;
import 'package:yaml/yaml.dart';

/// Entry point for the command-line interface.
final class Runner extends CommandRunner<void> {
/// Creates a command runner with the default commands.
factory Runner() {
return Runner._([
CheckCommand(),
CoverageCommand(),
GenerateCommand(),
]);
}
Expand All @@ -23,5 +31,18 @@ final class Runner extends CommandRunner<void> {
Iterable<Command<void>> commands,
) : super('dev', 'A tool working in the pub.lurey.dev monorepo.') {
commands.forEach(addCommand);

final workspaceYamlFile = io.File(p.join(findRootDir(), 'pubspec.yaml'));
final workspacePubspec = PubspecYaml.from(
loadYamlDocument(workspaceYamlFile.readAsStringSync()),
);
argParser.addMultiOption(
'config',
abbr: 'c',
help: ''
'Configuration to use for the command.\n\n'
'If omitted, each configuration is used.\n\nOptions:',
allowed: workspacePubspec.workspace,
);
}
}
9 changes: 9 additions & 0 deletions packages/iota/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

name: iota

# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
#
# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
description: |-
Minimalist file system API which is compatible with sandboxes.
short_description: Minimalist file system API.

version: 0.0.0

homepage: https://github.com/matanlurey/pub.lurey.dev/tree/main/packages/iota
Expand Down
10 changes: 10 additions & 0 deletions packages/jsonut/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Format: https://dart.dev/tools/pub/pubspec

name: jsonut

# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
#
# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
description: A minimal utility kit for working with JSON in a typesafe manner.
short_description: Minimal JSON utilities.

version: 0.4.1+2

homepage: https://github.com/matanlurey/pub.lurey.dev/tree/main/packages/jsonut
Expand Down
9 changes: 9 additions & 0 deletions packages/lore/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

name: lore

# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
#
# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
description: |-
Fast, structured, and idiomatic logging with an extensible API.
short_description: Fast, structured, and idiomatic logging.

version: 0.1.0-dev

resolution: workspace
Expand Down
10 changes: 10 additions & 0 deletions packages/mansion/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Format: https://dart.dev/tools/pub/pubspec

name: mansion

# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
#
# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
description: A stately library for crafting and deciphering ANSI escape codes.
short_description: Create and parse ANSI escape codes.

version: 0.1.0+1

environment:
Expand Down
10 changes: 10 additions & 0 deletions packages/oath/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
name: oath

# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
#
# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
description: Swear a Paladin's Oath to code righteousness by enforcing lints.
short_description: Strict linting for Dart packages.

version: 0.2.1+1

homepage: https://github.com/matanlurey/pub.lurey.dev/tree/main/packages/oath
Expand Down
9 changes: 9 additions & 0 deletions packages/proc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

name: proc

# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
#
# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
description: |-
Run and manage OS processes with an extensible and testable API.
short_description: Extensible process management.

version: 0.2.0+1

homepage: https://github.com/matanlurey/pub.lurey.dev/tree/main/packages/proc
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: sdk

# Pub requires at 60 chartacters or we are dinged for "too short".
# https://dart.dev/tools/pub/pubspec#description
description: Utilities for finding and using the Dart SDK programmatically.

# Not ready for publishing yet.
Expand Down
2 changes: 1 addition & 1 deletion packages/webby/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- #region(PACKAGE_README_HEADER) -->
# `webby`

An artisnal hand-crafted interopability library for the web platform.
Artisnal hand-crafted interopability library for the web platform.

| ✅ Health | 🚀 Release | 📝 Docs | ♻️ Maintenance |
|:----------|:-----------|:--------|:--------------|
Expand Down
10 changes: 9 additions & 1 deletion packages/webby/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

name: webby

# Pub requires at 60 chartacters or we are dinged for "too short".
# https://dart.dev/tools/pub/pubspec#description
#
# However, a shorter description is often better for a quick summary, so we
# store an unofficial shorter description as `short_description` which tools
# can optionally use.
description: |-
An artisnal hand-crafted interopability library for the web platform.
Artisnal hand-crafted interopability library for the web platform.
short_description: Hand-crafted interop for web apps.

version: 0.1.0-alpha

homepage: https://github.com/matanlurey/pub.lurey.dev/tree/main/packages/webby
Expand Down

0 comments on commit cbd0e33

Please sign in to comment.