(fix): --name shouldn't change output filenames#669
(fix): --name shouldn't change output filenames#669kotarella1110 wants to merge 3 commits intojaredpalmer:masterfrom
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. |
agilgur5
left a comment
There was a problem hiding this comment.
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! 🎉 |
agilgur5
left a comment
There was a problem hiding this comment.
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.jsoninstead of the passed name if the--nameoption is passed.Currently, the output file name use the name passed with the
--nameoption, as follows:npx tsdx create my-lib--nameoption:yarn build --name MyLib --format esm,cjs,umddistdir:tree dist/I think the output file name should use the name of
package.jsoninstead of the name passed with the--nameoption, as follows:In fact, in ReactDOM, it is
react-dom.development.js, notreactdom.development.js.