-
Notifications
You must be signed in to change notification settings - Fork 236
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
[WORLDSERVICE-464] Remove sw.js for Public Services #12566
base: latest
Are you sure you want to change the base?
Conversation
…-for-public-service-simorgh
shouldMatchValidRoutes(validRoutes, articleSwPath); | ||
|
||
const invalidRoutes = [ | ||
'/news/sw.js', | ||
'/news/articles/sw.js', |
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.
I am wondering whether to add examples of all sw paths which are now invalid, for all Public Services? Especially if we have excluded them explictly from the regex.
So this would be:
- /sport/articles/sw.js
- /newsround/articles/sw.js
- /archive/articles/sw.js
- /scotland/articles/sw.js
- /naidheachdan/sgeulachdan/sw.js
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.
Good point, updated
]; | ||
|
||
return services.filter(service => !publicServices.includes(service)); | ||
}; | ||
|
||
export const getArticleSwRegex = services => { | ||
const serviceRegex = getServiceRegex(getWorldServices(services)); | ||
return `/:service(${serviceRegex})/:local(${articleLocalRegex})/sw.js`; |
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.
Given that the articleLocalRegex
was for the public services, does it now make sense to remove this, and hardcode articles
instead...?
return `/:service(${serviceRegex})/:local(${articleLocalRegex})/sw.js`; | |
return `/:service(${serviceRegex})/articles/sw.js`; |
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.
Good idea. Updated
export const getArticleManifestRegex = services => { | ||
const serviceRegex = getServiceRegex(getWorldServices(services)); | ||
return `/:service(${serviceRegex})/:local(${articleLocalRegex})/manifest.json`; |
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.
This is potentially out of scope (or is it? - Let's get a second opinion!) Let's do this while we're here: per my comment above anything that uses getWorldServices
no longer needs articleLocalRegex
. If we did change it, we would also need to update some tests.
(Note that this we recently removed manifest paths from Public Services, and we just missed this.
export const getArticleManifestRegex = services => { | |
const serviceRegex = getServiceRegex(getWorldServices(services)); | |
return `/:service(${serviceRegex})/:local(${articleLocalRegex})/manifest.json`; | |
export const getArticleManifestRegex = services => { | |
const serviceRegex = getServiceRegex(getWorldServices(services)); | |
return `/:service(${serviceRegex})/articles/manifest.json`; |
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.
That makes sense. Updated
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.
Looks good - one thing I noticed is we have some e2e tests which mention service worker in cypress/e2e/application/index.js. Will these be impacted? I'm taking a look to understand when we run these...
Ohhh that's a good shout, I had forgotten about that. I think we might not need to do anything, as these tests had already been removed for Public Services. I would have expected the Cypress tests to fail if we deleted something & didn't clean up the tests accordingly. |
…-for-public-service-simorgh
…-for-public-service-simorgh
Resolves JIRA: https://jira.dev.bbc.co.uk/browse/WORLDSERVICE-464
Summary
Removes sw.js for remaining Public Services
Code changes
swPath
fromarchive
andscotland
configsgetWorldServices
util to includescotland
in thepublicServices
listgetArticleSwRegex
andgetSwRegex
to only use WSDeveloper Checklist
Testing
Ready-For-Test, Local
)Ready-For-Test, Test
)Ready-For-Test, Preview
)Ready-For-Test, Live
)Additional Testing Steps
Useful Links