-
Notifications
You must be signed in to change notification settings - Fork 11.9k
feat: add support for watch
when building a library
#11358
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
Changes from all commits
059b82a
710f075
30eafd6
1e5d74a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"$schema": "<%= relativePathToWorkspaceRoot %>/node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "<%= relativePathToWorkspaceRoot %>/<%= distRoot %>", | ||
"deleteDestPath": false, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to understand the motivation to remove this preset better. Does this option not play well with watch mode? I originally added it to enable users to re-run build in dev mode without breaking watched files. But now with watch mode existing, this usage might be different. I guess ideally we'd want a single But that does beg the question: if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regardless of the final semantics of watch mode, I do agree on doing away with the dev/prod configs if their only difference is watch mode support. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It’s not the it doesn’t play well. It’s that with watch mode it”s kinda redundant. The reason behing the original implementation of deleteDestPath was for users to create their own watch, and due to the fact that in webpack 3 when a file got deleted from disk webpack would crash with a fatal error. Now this is super seeded with the watch mode. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's also important to remove the dist dir overall though. If you don't, artifacts that aren't there in subsequent builds will still be present because of previous builds. With apps this is especially relevant because of assets, but less relevant for libraries. Still, the correct thing to do on a fresh, non-watch build is to clean (delete) the outpath before re-generating artifacts. That was why we had it on on the production builds, and not the development ones. The production builds were the 'correct' ones, while the dev builds made that concession for a makeshift watch mode. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I wasn't aware of that! Then removing the option makes perfect sense. |
||
"lib": { | ||
"entryFile": "src/<%= entryFile %>.ts" | ||
} | ||
|
This file was deleted.
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.
Since ng-packagr
build()
usesbuildAsObservable()
internally why not remove theif
and thenew Observable
statement and doreturn ngPkgProject..withOptions({ watch: options.watch })buildAsObservable().pipe(map(() => {return { success: true };}))
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.
The reason being is that angular cli still needs to support ng-package v2 and v3. And this method is only available in ng-packagr v4
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.
Never mind, I see, for backwards compatibility with ng-packagr 3.x when not using watch, right?
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.
Yes