From 728a214988e022ec0c4c3255d5bdf7ec8505d2ae Mon Sep 17 00:00:00 2001 From: Gorniaky Date: Thu, 18 Jun 2026 22:55:22 -0300 Subject: [PATCH 1/2] bump deps --- lib/cli/context.dart | 4 ++-- lib/cli/printer/console_printer.dart | 9 +++++---- lib/cli/printer/debug_console_printer.dart | 2 +- lib/commands/init.dart | 4 ++-- lib/utils/bytes.dart | 11 +++++++++++ modules/glob_zipper/lib/src/exception.dart | 4 +++- modules/glob_zipper/lib/src/glob_zipper.dart | 16 +++++++++------- modules/glob_zipper/lib/src/isolated.dart | 4 ++-- modules/glob_zipper/pubspec.yaml | 2 +- modules/interact/lib/interact.dart | 2 +- modules/interact/pubspec.yaml | 2 +- .../local_store/lib/src/json_local_store.dart | 4 +--- modules/local_store/pubspec.yaml | 2 +- modules/nested_map/pubspec.yaml | 2 +- pubspec.yaml | 2 +- scripts/upgrade_pubspec_sdk.dart | 2 ++ 16 files changed, 44 insertions(+), 28 deletions(-) diff --git a/lib/cli/context.dart b/lib/cli/context.dart index b8cbcfe..f50dc31 100644 --- a/lib/cli/context.dart +++ b/lib/cli/context.dart @@ -4,7 +4,7 @@ import "dart:io"; import "package:discloud/cli/disposable.dart"; import "package:discloud/cli/printer/console_printer.dart"; import "package:discloud/cli/printer/iprinter.dart"; -import "package:discloud/cli/spin/cli_spin.dart"; +import "package:discloud/cli/spin/ispin.dart"; import "package:discloud/extensions/duration.dart"; import "package:discloud/extensions/list.dart"; import "package:discloud/services/discloud/api_client.dart"; @@ -64,7 +64,7 @@ class CliContext implements Disposable { final bool debug; final DiscloudApiClient api; final LocalStore store; - final IPrinter printer; + final IPrinter printer; String get locale => localeName; diff --git a/lib/cli/printer/console_printer.dart b/lib/cli/printer/console_printer.dart index 06fc848..376d27b 100644 --- a/lib/cli/printer/console_printer.dart +++ b/lib/cli/printer/console_printer.dart @@ -2,17 +2,18 @@ import "dart:io"; import "package:discloud/cli/printer/iprinter.dart"; import "package:discloud/cli/spin/cli_spin.dart"; +import "package:discloud/cli/spin/ispin.dart"; part "debug_console_printer.dart"; -class ConsolePrinter implements IPrinter { +class ConsolePrinter implements IPrinter { factory ConsolePrinter._debug() = _DebugConsolePrinter; factory ConsolePrinter({bool isDebug = false}) => isDebug ? ._debug() : ._(); ConsolePrinter._(); - CLISpin? _spin; + ISpin? _spin; @override void dispose() { @@ -20,8 +21,8 @@ class ConsolePrinter implements IPrinter { } @override - CLISpin spin({String? text, bool start = true, bool showDuration = true}) { - final spin = _spin ??= .new(text: text, showDuration: showDuration); + ISpin spin({String? text, bool start = true, bool showDuration = true}) { + final spin = _spin ??= CLISpin(text: text, showDuration: showDuration); if (start) spin.start(); return spin; } diff --git a/lib/cli/printer/debug_console_printer.dart b/lib/cli/printer/debug_console_printer.dart index 29d1880..bbf479a 100644 --- a/lib/cli/printer/debug_console_printer.dart +++ b/lib/cli/printer/debug_console_printer.dart @@ -3,7 +3,7 @@ part of "console_printer.dart"; class _DebugConsolePrinter extends ConsolePrinter { _DebugConsolePrinter() : super._(); - void _debugSpin(CLISpin spin, Object? object) { + void _debugSpin(ISpin spin, Object? object) { spin.stop(); stderr.writeln(object); spin.start(); diff --git a/lib/commands/init.dart b/lib/commands/init.dart index b1e76d2..d2d9766 100644 --- a/lib/commands/init.dart +++ b/lib/commands/init.dart @@ -45,9 +45,9 @@ final class InitCommand extends Command { @override Future run() async { - final file = File(DiscloudConfig.filename); + final File file = .new(DiscloudConfig.filename); - final args = _InitArgs(argResults); + final _InitArgs args = .new(argResults); if (!args.force && await file.exists()) { throw Exception("${DiscloudConfig.filename} already exists!"); diff --git a/lib/utils/bytes.dart b/lib/utils/bytes.dart index 0e68876..f1cf4e3 100644 --- a/lib/utils/bytes.dart +++ b/lib/utils/bytes.dart @@ -55,6 +55,7 @@ class Bytes { Bytes operator +(Object? other) { return switch (other) { + final _Bits other => .new(other.n / 8 + n), final Bytes other => .new(other.n + n), final num other => .new(other + n), _ => this, @@ -63,6 +64,7 @@ class Bytes { Bytes operator -(Object? other) { return switch (other) { + final _Bits other => .new(other.n / 8 - n), final Bytes other => .new(other.n - n), final num other => .new(other - n), _ => this, @@ -71,6 +73,7 @@ class Bytes { Bytes operator *(Object? other) { return switch (other) { + final _Bits other => .new(other.n / 8 * n), final Bytes other => .new(other.n * n), final num other => .new(other * n), _ => this, @@ -79,6 +82,7 @@ class Bytes { Bytes operator /(Object? other) { return switch (other) { + final _Bits other => .new(other.n / 8 / n), final Bytes other => .new(other.n / n), final num other => .new(other / n), _ => this, @@ -87,6 +91,7 @@ class Bytes { Bytes operator ~/(Object? other) { return switch (other) { + final _Bits other => .new(other.n / 8 ~/ n), final Bytes other => .new(other.n ~/ n), final num other => .new(other ~/ n), _ => this, @@ -95,6 +100,7 @@ class Bytes { Bytes operator %(Object? other) { return switch (other) { + final _Bits other => .new(other.n / 8 % n), final Bytes other => .new(other.n % n), final num other => .new(other % n), _ => this, @@ -103,6 +109,7 @@ class Bytes { bool operator >(Object? other) { return switch (other) { + final _Bits other => other.n / 8 > n, final Bytes other => other.n > n, final num other => other > n, _ => false, @@ -111,6 +118,7 @@ class Bytes { bool operator >=(Object? other) { return switch (other) { + final _Bits other => other.n / 8 >= n, final Bytes other => other.n >= n, final num other => other >= n, _ => false, @@ -119,6 +127,7 @@ class Bytes { bool operator <(Object? other) { return switch (other) { + final _Bits other => other.n / 8 < n, final Bytes other => other.n < n, final num other => other < n, _ => false, @@ -127,6 +136,7 @@ class Bytes { bool operator <=(Object? other) { return switch (other) { + final _Bits other => other.n / 8 <= n, final Bytes other => other.n <= n, final num other => other <= n, _ => false, @@ -136,6 +146,7 @@ class Bytes { @override bool operator ==(other) { return switch (other) { + final _Bits other => other.n / 8 == n, final Bytes other => other.n == n, final num other => other == n, _ => false, diff --git a/modules/glob_zipper/lib/src/exception.dart b/modules/glob_zipper/lib/src/exception.dart index fc15946..54657de 100644 --- a/modules/glob_zipper/lib/src/exception.dart +++ b/modules/glob_zipper/lib/src/exception.dart @@ -1,3 +1,5 @@ part of "glob_zipper.dart"; -class ZipException implements Exception {} +class ZipException implements Exception { + const ZipException(); +} diff --git a/modules/glob_zipper/lib/src/glob_zipper.dart b/modules/glob_zipper/lib/src/glob_zipper.dart index fe10d4b..9d721e6 100644 --- a/modules/glob_zipper/lib/src/glob_zipper.dart +++ b/modules/glob_zipper/lib/src/glob_zipper.dart @@ -99,8 +99,9 @@ class GlobZipper { Stream Function() fileStreamFactory, [ OnErrorCallback? onError, ]) async { - onError ??= _noop; - await for (final file in fileStreamFactory().handleError(onError)) { + await for (final file in fileStreamFactory().handleError( + onError ?? _noop, + )) { final aFile = await _toArchiveFile(file, root: directory); encoder.addArchiveFile(aFile); @@ -113,16 +114,17 @@ class GlobZipper { ZipCallback onData, [ OnErrorCallback? onError, ]) async { - onError ??= _noop; - int processed = 0, i = 1; - await for (final file in fileStreamFactory().handleError(onError)) { + int processed = 0, i = 0; + await for (final file in fileStreamFactory().handleError( + onError ?? _noop, + )) { final stat = await file.stat(); onData( .new( file: file, stat: stat, - current: i++, + current: ++i, processed: processed, compressed: await zipfile.length(), ), @@ -145,7 +147,7 @@ class GlobZipper { final filename = relative(file.path, from: root.path); - final fileStream = InputFileStream(file.path); + final InputFileStream fileStream = .new(file.path); return .stream(filename, fileStream) ..compressionLevel = level diff --git a/modules/glob_zipper/lib/src/isolated.dart b/modules/glob_zipper/lib/src/isolated.dart index 463ef3a..d909aab 100644 --- a/modules/glob_zipper/lib/src/isolated.dart +++ b/modules/glob_zipper/lib/src/isolated.dart @@ -13,7 +13,7 @@ Future _zipInIsolate({ ZipCallback? onData, OnErrorCallback? onError, }) async { - final mainPort = ReceivePort(); + final ReceivePort mainPort = .new(); final mainPortBroadcast = mainPort.asBroadcastStream(); @@ -58,7 +58,7 @@ Future _zipInIsolate({ } Future _isolatedZip(SendPort mainSendPort) async { - final isolatedPort = ReceivePort(); + final ReceivePort isolatedPort = .new(); final isolatePortBroadcast = isolatedPort.asBroadcastStream(); diff --git a/modules/glob_zipper/pubspec.yaml b/modules/glob_zipper/pubspec.yaml index 9b30df4..6525d43 100644 --- a/modules/glob_zipper/pubspec.yaml +++ b/modules/glob_zipper/pubspec.yaml @@ -3,7 +3,7 @@ description: A starting point for Dart libraries or applications. version: 1.0.0 environment: - sdk: ^3.11.5 + sdk: ^3.12.2 dependencies: archive: any diff --git a/modules/interact/lib/interact.dart b/modules/interact/lib/interact.dart index b7c88e6..63655c3 100644 --- a/modules/interact/lib/interact.dart +++ b/modules/interact/lib/interact.dart @@ -16,4 +16,4 @@ export "src/spinner.dart"; export "src/theme/theme.dart"; /// Resets the Terminal to default values. -void Function() reset = Context.reset; +const void Function() reset = Context.reset; diff --git a/modules/interact/pubspec.yaml b/modules/interact/pubspec.yaml index e15ecde..becec69 100644 --- a/modules/interact/pubspec.yaml +++ b/modules/interact/pubspec.yaml @@ -4,7 +4,7 @@ version: 2.2.0 publish_to: none environment: - sdk: ^3.11.5 + sdk: ^3.12.2 dependencies: dart_console: any diff --git a/modules/local_store/lib/src/json_local_store.dart b/modules/local_store/lib/src/json_local_store.dart index 3093fe4..b4a6639 100644 --- a/modules/local_store/lib/src/json_local_store.dart +++ b/modules/local_store/lib/src/json_local_store.dart @@ -11,9 +11,7 @@ class _JSONLocalStore implements LocalStore { .fuse(base64.encoder) .fuse(utf8.encoder); - _JSONLocalStore(this.path) : _cache = .new(), _file = .new(path); - - final String path; + _JSONLocalStore(String path) : _cache = .new(), _file = .new(path); final Map _cache; final File _file; diff --git a/modules/local_store/pubspec.yaml b/modules/local_store/pubspec.yaml index 9631e89..0961676 100644 --- a/modules/local_store/pubspec.yaml +++ b/modules/local_store/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.11.5 + sdk: ^3.12.2 dependencies: nested_map: diff --git a/modules/nested_map/pubspec.yaml b/modules/nested_map/pubspec.yaml index a3c149e..6b3f58d 100644 --- a/modules/nested_map/pubspec.yaml +++ b/modules/nested_map/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: none environment: - sdk: ^3.11.5 + sdk: ^3.12.2 dev_dependencies: lints: any diff --git a/pubspec.yaml b/pubspec.yaml index 16b505c..6ed8ac2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: none repository: https://github.com/discloud/cli-dart environment: - sdk: ^3.12.0 + sdk: ^3.12.2 dependencies: glob_zipper: diff --git a/scripts/upgrade_pubspec_sdk.dart b/scripts/upgrade_pubspec_sdk.dart index 1b60f42..fb94b6b 100644 --- a/scripts/upgrade_pubspec_sdk.dart +++ b/scripts/upgrade_pubspec_sdk.dart @@ -1,3 +1,5 @@ +// dart scripts/upgrade_pubspec_sdk.dart + import "dart:io"; import "package:path/path.dart"; From 0d5fb1975696467c5d6a5de89d0c904f7775f052 Mon Sep 17 00:00:00 2001 From: Gorniaky Date: Thu, 18 Jun 2026 22:59:20 -0300 Subject: [PATCH 2/2] refactor: simplify script execution in workflows and update README examples --- .github/workflows/build_linux_macos.yml | 8 ++++---- .github/workflows/build_windows.yml | 6 +++--- .github/workflows/update_docs.yml | 2 +- README.md | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_linux_macos.yml b/.github/workflows/build_linux_macos.yml index 2dae7ab..4a773a6 100644 --- a/.github/workflows/build_linux_macos.yml +++ b/.github/workflows/build_linux_macos.yml @@ -43,13 +43,13 @@ jobs: run: dart pub get - name: Prepare pubspec - run: dart run scripts/prepare_pubspec.dart --version ${{ env.version }} + run: dart scripts/prepare_pubspec.dart --version ${{ env.version }} - name: Run build runner run: dart run build_runner build -r -v --low-resources-mode - name: Generate docs - run: dart run scripts/docs/generate.dart + run: dart scripts/docs/generate.dart - name: Dart format run: | @@ -99,13 +99,13 @@ jobs: run: dart pub get - name: Prepare pubspec - run: dart run scripts/prepare_pubspec.dart --version ${{ env.version }} + run: dart scripts/prepare_pubspec.dart --version ${{ env.version }} - name: Run build runner run: dart run build_runner build -r -v --low-resources-mode - name: Generate docs - run: dart run scripts/docs/generate.dart + run: dart scripts/docs/generate.dart - name: Dart format run: | diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index ffb0b91..c6b2ce3 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -63,7 +63,7 @@ jobs: run: dart pub get - name: Prepare pubspec - run: dart run scripts/prepare_pubspec.dart --version ${{ env.version }} + run: dart scripts/prepare_pubspec.dart --version ${{ env.version }} - name: Run build runner run: dart run build_runner build -r -v --low-resources-mode @@ -102,10 +102,10 @@ jobs: run: dart pub get - name: Prepare inno setup - run: dart run scripts/prepare_inno_setup.dart --version ${{ env.version }} + run: dart scripts/prepare_inno_setup.dart --version ${{ env.version }} - name: Generate docs - run: dart run scripts/docs/generate.dart + run: dart scripts/docs/generate.dart - name: Get artifacts uses: actions/download-artifact@v8 diff --git a/.github/workflows/update_docs.yml b/.github/workflows/update_docs.yml index 272fcf5..4b54bcb 100644 --- a/.github/workflows/update_docs.yml +++ b/.github/workflows/update_docs.yml @@ -35,7 +35,7 @@ jobs: run: dart run build_runner build -r -v --low-resources-mode - name: Generate docs - run: dart run scripts/docs/generate.dart + run: dart scripts/docs/generate.dart - name: Git config run: | diff --git a/README.md b/README.md index 2e7fd6c..679e956 100644 --- a/README.md +++ b/README.md @@ -118,13 +118,13 @@ For details see [CONTRIBUTING.md](CONTRIBUTING.md). - You can perform the test manually by running the command below. ```sh - dart run lib/main.dart + dart lib/main.dart ``` - Try adding arguments. ```sh - dart run lib/main.dart --version + dart lib/main.dart --version ``` ## LICENSE