-
Notifications
You must be signed in to change notification settings - Fork 335
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
Use async file operations for helpers #2861
Conversation
Converting to draft whilst I look at the various timeouts. Unblocking IO may have made Jest or Puppeteer trip over |
f3146cd
to
5e550d8
Compare
34569f6
to
40cd287
Compare
40cd287
to
c5ee02a
Compare
92233ac
to
3b31bfd
Compare
c5ee02a
to
859e637
Compare
0dddc0d
to
5ae1389
Compare
859e637
to
a40dcbf
Compare
a40dcbf
to
efa705e
Compare
5ae1389
to
f37d032
Compare
efa705e
to
0caac60
Compare
a5a3b6b
to
1a79ebd
Compare
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 Only concern I have in that PR is the naming move from
It feels a bit nitpicky and I'm not holding strongly to going back to |
Ha, that's fine Consistency wise, I'm more than happy to make everything Consistency was the aim, not the name 🙌 Or rename the |
Making everything |
aece8dd
to
24532e7
Compare
1a79ebd
to
77b2a14
Compare
24532e7
to
3d885e7
Compare
77b2a14
to
6742b11
Compare
@romaricpascal All sorted, now using |
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.
Ace! Looks all good to me, thanks for that extra pass on it 😄
Also adds “name” to componentData object
Includes new “all in one” `getComponents()` helper
6742b11
to
e81c650
Compare
Now cached, ensures `*.yaml` files trigger Node.js restart via nodemon
e81c650
to
7b0d2f2
Compare
This PR has now been split into two
Part 1 – #2897 Spruce up Puppeteer usage to stop timeouts, page conflicts etc
Part 2 – #2861 Use async file operations for helpers (this one)
For context, we "discover" components, examples and full page examples via directory lookups. But we also parse
*.yaml
files per component, building "component data" for Nunjucks macro options, examples, layouts and accessibility criteriaThese are all tiny operations that quickly add up
Problem areas
*.yaml
files (and directory lookups) repeatedly*.yaml
files viagetExamples()
orgetComponentData()
readdir()
orglob()
filteringChanges to file system access
All of our test helpers are now asynchronous using the promise based Node.js file system methods
readdirSync()
→readdir()
readFileSync()
→readFile()
statSync()
→stat()
Changes to test helper naming conventions
For consistency I've also ensured
component
/componentName
/exampleName
naming:Plus the JSDoc to go with it (tiny addition, but is quite helpful)