-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[AssetMapper] Add outdated command #51845
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
[AssetMapper] Add outdated command #51845
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
9f64774
to
048633c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on your first PR! This is really nice work - I've left some comments below to get things started. FYI, you don't need to (you shouldn't) click to merge my suggestions. Instead, "steal" them and commit them yourself. That will keep your commits clean and all authored by you.
Thanks!
src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/PackageUpdateInfo.php
Outdated
Show resolved
Hide resolved
Thank you very much for the review and the feedback @weaverryan 🙏 . I've made changes according to your suggestions, let me know if you see anything else I could do. |
fe0882a
to
2a7d020
Compare
@maelanleborgne #51650 is merged, so you can rebase your commits to remove them from this PR. Probably THAT PR was also rebased, so this can get a little tricky - I've been doing it a lot lately 😆 |
2a7d020
to
9da7241
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 👍 - nice job rebasing - next round of comments
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/PackageUpdateInfo.php
Outdated
Show resolved
Hide resolved
{ | ||
$io = new SymfonyStyle($input, $output); | ||
$packages = $input->getArgument('packages'); | ||
$packagesUpdateInfos = $this->updateChecker->getAvailableUpdates($packages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be used in the update command too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain more? Do you mean: in the update
command, we would first use this function to determine which updates are possible and then loop over and make them? If so, that's a different way than we're doing it now - but I can't think of any big difference in final behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that was the idea, but i'm not talking about "right now" ... but in a near future, as we already said :)
One more relevant PR just got merged- can you rebase? Let me know if you have any questions - hopefully that’ll simplify things, as remote packages ALWAYS have a version now. |
Is this still WIP? |
Yes I still have some work to do now that #51786 has been merged. |
9da7241
to
fd738e1
Compare
src/Symfony/Bundle/FrameworkBundle/Resources/config/asset_mapper.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor, but important tweaks. Also, don't forget to check fabbot in the CI after you push for the little phpcs details :).
src/Symfony/Component/AssetMapper/Command/ImportMapRequireCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Command/ImportMapRequireCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Tests/ImportMap/ImportMapManagerTest.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, very close now!
src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Command/ImportMapOutdatedCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/ImportMap/ImportMapUpdateChecker.php
Outdated
Show resolved
Hide resolved
4414448
to
6d3ad99
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test failures all look unrelated. 👍
version: '5.3.1', | ||
packageName: 'bootstrap', | ||
), | ||
// Css will always be considered up to date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why CSS should be always considered up-to-date? At L95 it's expected to have updateType: 'patch'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, that's a comment that should have been deleted when I made the change to allow css to be managed. Thanks
a374dde
to
4d32a35
Compare
Thank you @maelanleborgne. |
Congrats and thanks for the nice work @maelanleborgne! No expectations, but if you'd like to work on a PR to find & change the Edit: I found one issue. There are 3 places in |
…mand (Maelan LE BORGNE) This PR was merged into the 6.4 branch. Discussion ---------- [AssetMapper] [WCM] Added instruction for 'outdated' command Documentation for the command added in this PR : symfony/symfony#51845 Commits ------- ef85a01 [AssetMapper] Added instruction for 'outdated' command
@weaverryan I've checked and it seems like we need to make a change only on this occurence :
The other two are local assets that should not cause trouble. Should I open a PR for the fix or is there an already opened one that we could fit this in ? |
As suggested by @WebMamba, I added a new command for the AssetMapper component to list outdated 3rd party packages. It is inspired by the
composer outdated
command so I tried to replicate its options as much as I could.It reads the importmap.php and extract packages version to query the https://registry.npmjs.org/%package% API and read the latest version from metadata.