-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[core] Use common copy-files script #14406
Conversation
This reverts commit e5653d7.
Box is internal and not documented yet
they are synomous but typings was used in core so we stick with it
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 pull request made me laugh. It's ridiculous from my part. I should have done this effort a long time ago instead of duplicating the script. Great move!
@@ -1,13 +1,16 @@ | |||
/* eslint-disable no-console */ | |||
const path = require('path'); |
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.
We were using babel-node so we could write the source with es modules. I'm curious why you want to change this point.
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.
babel-node
:
- imposes a runtime overhead
- makes debugging harder if sourcemaps are not setup properly
it enables in our case:
- es modules which don't provide any value in the node runtime
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.
My motivation was more: let's write the same code everywhere even if it's not the best tool for the job. The difference is negligeable. Simplicity first.
I didn't know about the source map issue.
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.
Let's defer this to a different PR then. I'll change to babel-node
tomorrow.
I would like to get rid of it completely. Since node 8 already has async/await
it doesn't add any value at the moment.
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.
In some way, we might always need Babel. The JavaScript language is moving. Won't we need it too if we start using TypeScript?
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.
Browser and node are two different targets. We use our node scripts only internally so requiring something like node 10 or 12 is not that big of a deal. Doing so removes the babel requirement apart from the latest es features and there is no big value gained by using those features.
Typescript for our node scripts is somewhat overkill at the moment. I think you're mixing various concepts here: babel-node
has nothing to with our components (or Ssr). It's currently only used to use es modules in our node scripts that provide no benefit in the node runtime.
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.
Tried to revert but babel-node
has some issues with transpiling code that is outside the cwd which is common in a monorepo: babel/babel#7566
This is fixable with the ignore
flag but then we have to maintain those contents for every require and TL;DR: The amount of maintenance and time this adds to enable es modules in the node runtime (which don't add anything) is not worth it. At least it hasn't been shown to me.
We can revisit this once we need to transpile this dev script at runtime.
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 have revisited a bit the implementation. Let me know what you think.
1896f8a
to
ff4ba6d
Compare
We had an issue with |
Do with the PR as you please. I can't work on this if you refuse to provide a rationale. |
ff4ba6d
to
9adc179
Compare
@eps1lon The rationale was highlighted in #14406 (comment). Now, the difference between babel-node vs using node doesn't outweigh the benefit of letting you pick what you think work best for the use case. I have reverted the changes. I have focused my attention on the logic, migrating some of the logic to the async / await syntax. I shouldn't have pushed force on your fork branch. I'm sorry. I'm happy to have looked at the code, the release script is important, better have more than one people having a close look at it. Eventually, we will release v4.0.0-alpha.0. People will report any problem. |
🙌
copy-files
is currently duplicated for every package that uses this logic with >99% overlap. This PR merges every single script into a common one. It helps refactoring build behavior (cumbersome for #13391 but will be easy with this change for e.g. #14392 if accepted) and brings some features to older packages such as:typings
field to every published package (core, docs, lab, system, utils)@material-ui/icons/utils/createSVGIcon
(includes/es
build)icons
andutils
esm index barrelEvery single one of these points was done for one
@material-ui/core
Fixes:
module
entry pointing to wrong file (caused by [core] Improve tree-shakeability #13391)