-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: build unbundled libraries, validate package when building (LIBS-125) #492
Conversation
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.
LGTM 🎉
Improvements in tree shaking are always nice and I really like the package validation + automatic fixes feature - which will be even more useful once we integrate validations for singleton dependencies from #491.
I don't think we need a breaking change here but @varl might disagree - will hold off on merging for a short bit to get more eyes on this. We could also merge to |
I'm going to add some documentation then go ahead and merge this, as we want to get it rolling through the ecosystem. If we find the "pseudo-break" too cumbersome we can back it out and cut a breaking change instead. |
# [5.6.0](v5.5.3...v5.6.0) (2021-02-20) ### Features * build unbundled libraries, validate package when building (LIBS-125) ([#492](#492)) ([4fb3fae](4fb3fae))
🎉 This PR is included in version 5.6.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Nice!
This removes the diverging logic between application and library builds. It no longer uses rollup, shares a single babel config, and compiles library files individually rather than bundling them into a single
lib.js
file (which is better for tree shaking)This also adds the concept of package validation to
d2-app-scripts
. This allows the build tool to show hints, offer automatic fixes, and bail on CI if the app or library being built is misconfigured. Additional validations for singleton dependencies, yarn versions, and more could be added in the future (as has been done in #491 here)The first validator added here ensures that
package.main
,package.module
andpackage.exports
are set correctly for library builds - since thelib.js
file is no longer generated, this will prevent an upgrade of@dhis2/cli-app-scripts
from silently breaking library builds (which should mean we don't need to cut a breaking change here, though we could if we want to)Example output with prompt to automatically fix the package export fields (declined here):
And another when
./build/<type>/lib.js
is incorrectly specified (prompt accepted here):