govuk-frontend icon indicating copy to clipboard operation
govuk-frontend copied to clipboard

Use async file operations for helpers

Open colinrotherham opened this issue 1 year ago • 1 comments

This PR aims to remove IO blocking readFileSync() calls (including component directory listings)

Puppeteer tests are running super quickly 😊

https://user-images.githubusercontent.com/415517/191203826-04de51dc-f34f-431e-8042-ab45bf0effeb.mp4

colinrotherham avatar Sep 20 '22 08:09 colinrotherham

Converting to draft whilst I look at the various timeouts. Unblocking IO may have made Jest or Puppeteer trip over

colinrotherham avatar Sep 20 '22 08:09 colinrotherham

Thanks for splitting the commits and going through all these changes. The move to async looks good to me, I like how it feels more parallel-y with the Promise.all 🙌🏻 .

Only concern I have in that PR is the naming move from componentData to component that:

  • looses the separation between the data about the component and the component itself
  • makes it weird with the types of a lot of component variables being ComponentData

It feels a bit nitpicky and I'm not holding strongly to going back to componentData, but thought I'd mention it 😄

romaricpascal avatar Oct 05 '22 17:10 romaricpascal

Ha, that's fine

Consistency wise, I'm more than happy to make everything componentData

Consistency was the aim, not the name 🙌

Or rename the @typedef to Component?

colinrotherham avatar Oct 05 '22 17:10 colinrotherham

Making everything componentData makes more sense to me, as we keep the distinction from the component itself (in case we ever have tests that need to reference both).

romaricpascal avatar Oct 05 '22 17:10 romaricpascal

Making everything componentData makes more sense to me, as we keep the distinction from the component itself (in case we ever have tests that need to reference both).

@romaricpascal All sorted, now using componentData instead 🎉

colinrotherham avatar Oct 06 '22 07:10 colinrotherham