Skip to content

feat: add workspace support for packages check licenses#1540

Open
realmeylisdev wants to merge 8 commits intoVeryGoodOpenSource:mainfrom
realmeylisdev:feat/workspace-license-support
Open

feat: add workspace support for packages check licenses#1540
realmeylisdev wants to merge 8 commits intoVeryGoodOpenSource:mainfrom
realmeylisdev:feat/workspace-license-support

Conversation

@realmeylisdev
Copy link
Contributor

Summary

This PR adds workspace support to the packages check licenses command, enabling license checking in monorepo projects that use Dart's pub workspace feature.

Reopens #1444 (branch was restored per request).
Closes #1273

Changes

New Files

  • lib/src/pubspec/pubspec.dart - Pubspec parser for detecting workspace configurations
  • test/src/pubspec/pubspec_test.dart - 19 tests for the Pubspec parser

Modified Files

  • lib/src/commands/packages/commands/check/commands/licenses.dart - Added workspace detection and dependency collection
  • test/src/commands/packages/commands/check/commands/licenses_test.dart - Added 3 workspace support tests

How It Works

  1. Auto-detection: When pubspec.yaml contains a workspace property, it's detected as a workspace root
  2. Dependency collection: Dependencies are collected from all workspace members' pubspec.yaml files
  3. Glob pattern support: Workspace paths like packages/* are supported (Dart 3.11+)
  4. Nested workspaces: Recursively handles nested workspaces
  5. Backwards compatible: Non-workspace projects work exactly as before

Test plan

  • All existing license tests pass (42 tests)
  • New workspace support tests pass (3 tests)
  • New Pubspec parser tests pass (19 tests)
  • Static analysis passes with no issues

realmeylisdev and others added 7 commits December 30, 2025 00:24
When a pubspec.yaml declares a workspace property, the command now
recursively collects dependencies from all workspace members and
checks their licenses using the root pubspec.lock.

This enables license checking in monorepo projects that use Dart's
pub workspace feature.

Closes VeryGoodOpenSource#1273
@samitsv
Copy link

samitsv commented Mar 18, 2026

@realmeylisdev seems like there are some conflicts that needs to be resolved

Keep both workspace license support functions and ReporterOutputFormat
enum from main.
@realmeylisdev
Copy link
Contributor Author

now done.

@samitsv
Copy link

samitsv commented Mar 18, 2026

@marcossevilla could we get this PR reviewed which was de-prioritized last time ? #1444 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Support packages check licenses with workspaces

2 participants