Skip to content

Give error if global activated package depends on hooks #4612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sigurdm
Copy link
Contributor

@sigurdm sigurdm commented Jun 23, 2025

Fixes #4609

More refactoring could be used here. But this seems good enough for now.

@sigurdm sigurdm force-pushed the global_error_on_hooks2 branch from 9aa919e to 30eb18c Compare June 23, 2025 12:36
@sigurdm
Copy link
Contributor Author

sigurdm commented Jun 23, 2025

@dcharkes The error message here is quite imprecise and unhelpful. Do we want to give details (which dependency is using hooks?) Do we want to point the user to some documentation?
Is there any alternative we can suggest?

@sigurdm sigurdm requested a review from szakarias June 23, 2025 13:02
@dcharkes
Copy link
Contributor

Thanks @sigurdm! 🙏

@dcharkes The error message here is quite imprecise and unhelpful. Do we want to give details (which dependency is using hooks?)

If it's easy, we can name the package that's using hooks.

Do we want to point the user to some documentation? Is there any alternative we can suggest?

We should add some info that we're not intending to support hooks in dart pub global activate and that dart install will have support when it is introduced. They can track dart install at dart-lang/sdk#60889.

@sigurdm sigurdm changed the title Give error if globall activated package depends on hooks Give error if global activated package depends on hooks Jun 23, 2025
@sigurdm sigurdm requested a review from dcharkes June 27, 2025 13:08
@sigurdm
Copy link
Contributor Author

sigurdm commented Jun 27, 2025

@dcharkes If you are happy could you approve?

Copy link
Contributor

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

() async {
final server = await servePackages();
server.serve(
'hooks',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a different name for this, as this https://pub.dev/packages/hooks/versions/0.19.5 should never contain a hook.

},
);

test('activating a hosted package gives error if package uses hooks in any'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name needs to be updated. A hook in a dev dep is fine.

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.

dart pub global activate should error if there are build hooks
2 participants