#2517 only fetch plugin package info from NPM when needed#2518
#2517 only fetch plugin package info from NPM when needed#251836degrees merged 3 commits intoalphagov:mainfrom
Conversation
|
Thanks for looking into this @RichardBradley. I'm hoping we'll have a chance to review this properly next week. The 'Tests (Heroku)' failures are unrelated to the changes in this PR – the Heroku tests install the latest version of The linting failures do look related to the changes – do you have capacity to address them? Hopefully |
|
Thanks I have run standard and pushed a new version |
|
@RichardBradley thanks for doing that! The Heroku tests are now passing on Would you be happy to do that? I can do it for you if you prefer, but you'll need to remember to sync your local branch up if you make any further changes. |
1b4d419 to
2e6fcba
Compare
|
Sure, I have rebased against current I'm happy for you to rebase if needed again |
romaricpascal
left a comment
There was a problem hiding this comment.
That's brilliant @RichardBradley, thanks for fixing this and apologies for missing that the way we originally implemented it meant regular hits to npm over the network. 🙌🏻
This'll need a second review from @alphagov/design-system-developers before we can merge it, but looks all good to me 😊
2e6fcba to
adafbd8
Compare
|
I've rebased against main and added a commit to add this to the changelog (required a force-push because of the rebase) |
Fixes #2517
Changes
1; The "
pluginVersionSatisfies" function, which is called a lot, doesn't need to make a network fetch to NPM, it can be satisfied from the localpackage.jsondata. (This does mean that it will return true for non-plugin packages, but I can't see why that would do any harm)This saves some dev startup time (see deleted
pluginCacheMiddleware)2: The plugin cache can be made fetch-on-demand, instead of polling every 36 seconds.
I wonder if the 36 second config was a typo for 10 hours:
36000millis vs36000seconds.I have set the stale time to 1 minute, now that it's not polling all the time.
See deleted
startPackageTrackerTesting
All unit tests pass
I have ran a new prototype locally and it starts ok and looks good to me.
The plugins page looks good to me.
The plugin data is fetched from NPM only when the plugins page is viewed.
The prototype will start with no internet (before it refused to even start).
Please let me know if you have any questions