Skip to content

refactor: use async fs calls in src/utils/proxy.js #1275

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

Closed
JCMais opened this issue Sep 23, 2020 · 7 comments
Closed

refactor: use async fs calls in src/utils/proxy.js #1275

JCMais opened this issue Sep 23, 2020 · 7 comments
Assignees
Labels
area: command: dev good first issue type: chore work needed to keep the product and development running smoothly

Comments

@JCMais
Copy link
Contributor

JCMais commented Sep 23, 2020

Describe the bug

This file could easily use the async versions of the fs functions instead of the sync ones.

Additional context

See: #1271 (comment)

@JCMais JCMais added the type: bug code to address defects in shipped code label Sep 23, 2020
@erezrokah erezrokah added area: command: dev type: chore work needed to keep the product and development running smoothly good first issue and removed type: bug code to address defects in shipped code labels Sep 23, 2020
@mugi111
Copy link
Contributor

mugi111 commented Oct 6, 2020

If you don't mind, I want to challenge to fix this issue !

@erezrokah
Copy link
Contributor

Thanks @mugi111, I assigned you to the issue. Please let me know if there is anything you need.

@mugi111
Copy link
Contributor

mugi111 commented Oct 7, 2020

headersFiles.filter(fs.existsSync).map(p => path.relative(projectDir, p))

Let me ask for advice on how to fix this.
Is it correct to filter the headersFiles with fs.stat() and isFiles() once and then use map() for that array?

@erezrokah
Copy link
Contributor

You could use https://github.com/sindresorhus/p-filter to filter promises, then run map in the result.
You can use

const fileExistsAsync = async filePath => {
for the filter

@mugi111
Copy link
Contributor

mugi111 commented Oct 7, 2020

Thank you. It was helpful.
I'll deal with it that way.

@iChenLei
Copy link

iChenLei commented Sep 6, 2021

This issue looks like solved, why still opened ?

@ehmicky
Copy link
Contributor

ehmicky commented Sep 6, 2021

Yes, this is solved, thanks for raising this @iChenLei 👍

@ehmicky ehmicky closed this as completed Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: command: dev good first issue type: chore work needed to keep the product and development running smoothly
Projects
None yet
Development

No branches or pull requests

5 participants