From fd9f3509d4de6f91fe8fa187318df83a1275d950 Mon Sep 17 00:00:00 2001 From: Rody Davis Date: Wed, 14 Jan 2026 00:33:42 -0800 Subject: [PATCH] add signals package --- README.md | 10 ++++- packages/signals | 2 +- scripts/update_readme.dart | 82 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 scripts/update_readme.dart diff --git a/README.md b/README.md index 691527c..431c4c2 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,11 @@ A collection of Flutter packages maintained by @rodydavis. | Package | Description | Version | Pub | | :--- | :--- | :--- | :--- | -| [flutter_sms](./packages/flutter_sms) | Flutter Plugin for sending SMS and MMS on Android and iOS. | 3.0.0 | [![pub package](https://img.shields.io/pub/v/flutter_sms.svg)](https://pub.dev/packages/flutter_sms) | -| [flutter_vibrate](./packages/flutter_vibrate) | A Haptic Feedback and Vibration plugin. | 1.4.0 | [![pub package](https://img.shields.io/pub/v/flutter_vibrate.svg)](https://pub.dev/packages/flutter_vibrate) | +| [flutter_sms](./packages/flutter_sms) | A Flutter plugin to send SMS and MMS on iOS and Android. | [![Pub](https://img.shields.io/pub/v/flutter_sms.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/flutter_sms.svg)](https://pub.dev/packages/flutter_sms) | +| [flutter_vibrate](./packages/flutter_vibrate) | A Haptic Feedback and Vibration plugin. | [![Pub](https://img.shields.io/pub/v/flutter_vibrate.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/flutter_vibrate.svg)](https://pub.dev/packages/flutter_vibrate) | +| [preact_signals](./packages/signals/packages/preact_signals) | Dart port of Preact.js Signals | [![Pub](https://img.shields.io/pub/v/preact_signals.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/preact_signals.svg)](https://pub.dev/packages/preact_signals) | +| [signals](./packages/signals/packages/signals) | Reactivity made simple. Do more by doing less. Supports Flutter and any Dart project including HTML/JS, CLI, Shelf Server, VM and more. | [![Pub](https://img.shields.io/pub/v/signals.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/signals.svg)](https://pub.dev/packages/signals) | +| [signals_core](./packages/signals/packages/signals_core) | The signals library exposes four core functions which are the building blocks to model any business logic you can think of. | [![Pub](https://img.shields.io/pub/v/signals_core.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/signals_core.svg)](https://pub.dev/packages/signals_core) | +| [signals_flutter](./packages/signals/packages/signals_flutter) | The signals library exposes four core functions which are the building blocks to model any business logic you can think of. | [![Pub](https://img.shields.io/pub/v/signals_flutter.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/signals_flutter.svg)](https://pub.dev/packages/signals_flutter) | +| [signals_hooks](./packages/signals/packages/signals_hooks) | flutter_hooks bindings for signals | [![Pub](https://img.shields.io/pub/v/signals_hooks.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/signals_hooks.svg)](https://pub.dev/packages/signals_hooks) | +| [signals_lint](./packages/signals/packages/signals_lint) | linter and developer tool for signals | [![Pub](https://img.shields.io/pub/v/signals_lint.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/signals_lint.svg)](https://pub.dev/packages/signals_lint) | diff --git a/packages/signals b/packages/signals index ad01646..3f05f49 160000 --- a/packages/signals +++ b/packages/signals @@ -1 +1 @@ -Subproject commit ad01646b69b5821f66f52cd73966a798b0c0629f +Subproject commit 3f05f498362cc7ed855764602419a07998afea8d diff --git a/scripts/update_readme.dart b/scripts/update_readme.dart new file mode 100644 index 0000000..ce392fa --- /dev/null +++ b/scripts/update_readme.dart @@ -0,0 +1,82 @@ +import 'dart:io'; + +void main() async { + final rootDir = Directory.current; + final packagesDir = Directory('${rootDir.path}/packages'); + final readmeFile = File('${rootDir.path}/README.md'); + + if (!packagesDir.existsSync()) { + print('Error: packages directory not found at ${packagesDir.path}'); + return; + } + + final packages = <_Package>[]; + + await for (final entity in packagesDir.list(recursive: true)) { + if (entity is File && entity.path.endsWith('pubspec.yaml')) { + // Skip if likely in a build or hidden folder (simple heuristic) + if (entity.path.contains('/.') || entity.path.contains('/build/')) { + continue; + } + + final pubspecContent = await entity.readAsString(); + final name = _getValue(pubspecContent, 'name'); + final description = _getValue(pubspecContent, 'description'); + final version = _getValue(pubspecContent, 'version'); + final publishTo = _getValue(pubspecContent, 'publish_to'); + + if (name != null && version != null && publishTo != 'none') { + // Calculate relative path from root + final relativePath = entity.parent.path.replaceFirst(rootDir.path, '.'); + + packages.add(_Package( + name: name, + description: description ?? '', + path: relativePath, + )); + } + } + } + + packages.sort((a, b) => a.name.compareTo(b.name)); + + final sb = StringBuffer(); + sb.writeln('# packages.dart'); + sb.writeln(); + sb.writeln('A collection of Flutter packages maintained by @rodydavis.'); + sb.writeln(); + sb.writeln('## Packages'); + sb.writeln(); + sb.writeln('| Package | Description | Version | Pub |'); + sb.writeln('| :--- | :--- | :--- | :--- |'); + + for (final pkg in packages) { + sb.writeln( + '| [${pkg.name}](${pkg.path}) | ${pkg.description} | [![Pub](https://img.shields.io/pub/v/${pkg.name}.svg?style=popout)] | [![pub package](https://img.shields.io/pub/v/${pkg.name}.svg)](https://pub.dev/packages/${pkg.name}) |'); + } + + await readmeFile.writeAsString(sb.toString()); + print('README.md updated with ${packages.length} packages.'); +} + +String? _getValue(String content, String key) { + final regex = RegExp('^$key:\\s*(.*)\$', multiLine: true); + final match = regex.firstMatch(content); + var value = match?.group(1)?.trim(); + if (value != null) { + if (value.startsWith("'") && value.endsWith("'")) { + value = value.substring(1, value.length - 1); + } else if (value.startsWith('"') && value.endsWith('"')) { + value = value.substring(1, value.length - 1); + } + } + return value; +} + +class _Package { + final String name; + final String description; + final String path; + + _Package({required this.name, required this.description, required this.path}); +}