-
Notifications
You must be signed in to change notification settings - Fork 507
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
(fix): --name shouldn't change output filenames #669
base: master
Are you sure you want to change the base?
(fix): --name shouldn't change output filenames #669
Conversation
This is somewhere in between a bug fix and a behavior change/feature, because the docs and the help dialog say it's only for UMD names, but apparently it's used for the output filename in the source code too. I didn't realize that either and have touched all of this code (though these pieces weren't written by me), good catch! I'll have to look at the history and possibly In any case, this is a breaking change as there might be folks who use this undocumented behavior. |
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.
Instead of changing it to outputName
everywhere, should leave name
as appPackageJson.name
and add umdName
as opts.name
.
That requires less changes and is more explicit too. Would need to change Rollup's output.name
accordingly
@agilgur5 Do you have any update on this? |
So I did some investigation and this indeed some likes an unintentional bug that That being said, because this is unfortunately a breaking change, this won't be able to go out soon. In the meantime, if you need this, I'd recommend using Also in the meantime, I'll still make some review comments and I'll give credit to you with |
@allcontributors please add @kotarella1110 for bug, code |
I've put up a pull request to add @kotarella1110! 🎉 |
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 still need to think a bit about this as it's a different change than I expected but might actually make more sense than what I was thinking. This is definitely better in any case, thanks for the iteration.
We should ideally add a regression test for this to ensure that setting --name
doesn't change the actual filename. If you'd like to dive into the weeds of the test set-up you can do that yourself, but otherwise I'll do it myself eventually because we have to add a new test suite/file for passing options (test/e2e/tsdx-build-options.test.ts
) and that's a lot more involved than just adding a test.
Fixed output file name after build to use the name of
package.json
instead of the passed name if the--name
option is passed.Currently, the output file name use the name passed with the
--name
option, as follows:npx tsdx create my-lib
--name
option:yarn build --name MyLib --format esm,cjs,umd
dist
dir:tree dist/
I think the output file name should use the name of
package.json
instead of the name passed with the--name
option, as follows:In fact, in ReactDOM, it is
react-dom.development.js
, notreactdom.development.js
.