-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[code-infra] Fix fs-extra
removal from formattedTSDemos
script
#19132
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
[code-infra] Fix fs-extra
removal from formattedTSDemos
script
#19132
Conversation
Deploy preview: https://deploy-preview-19132--material-ui-x.netlify.app/ Bundle size report
|
fs-extra
removal from formattedTSDemos.js
fs-extra
removal from formattedTSDemos
script
Will be good to create a followup issue in |
Sounds good. I'll create the issue in a bit. |
@@ -90,7 +91,7 @@ const previewOverride = { | |||
async function transpileFile(tsxPath, program, ignoreCache = false) { | |||
const jsPath = tsxPath.replace(/\.tsx?$/, '.js'); | |||
try { | |||
if (!ignoreCache && (await fs.promises.exists(jsPath))) { | |||
if (!ignoreCache && (await fse.exists(jsPath))) { |
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.
Consider removing the exists check altogether, .stat
already does the same thing
if (!ignoreCache) {
const ignoreNotFound = (err) => err.code === 'ENOENT' ? null : Promise.reject(err);
const [jsStat, tsxStat] = await Promise.all([
fs.promises.stat(jsPath).catch(ignoreNotFound),
fs.promises.stat(tsxPath).catch(ignoreNotFound),
]);
if (jsStat && tsxStat && jsStat.mtimeMs > tsxStat.mtimeMs) {
// JavaScript version is newer, skip transpiling
return TranspileResult.Skipped;
}
}
or use Promise.allSettled
.
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.
Yeah, I'm aware. Just want to fix this regression asap and I'll take a deeper look into how we can remove fs-extra
and exists
calls.
|
fs-extra
removal from formattedTSDemos
scriptfs-extra
removal from formattedTSDemos
script
Fixes a bug I introduced in #19127.
fs.exists
is valid, butfs.promises.exists
doesn't exist sincefs.exists
is deprecated.Reverting to
fs-extra
's version for now. I'll look into removing it later.