Conversation
Exclude node_modules Only commit file updates when there are changes
| } | ||
|
|
||
| export function commitChanges(tree: Tree, path: string, changes: Change[]) { | ||
| if (changes.length === 0) { |
There was a problem hiding this comment.
Only commit the file when there are changes, I forgot this in some of the v8 migrations making them slow (plus there was a information message on every file changes, even node_modules, which might confuse people).
|
|
||
| if (sourceFile.isDeclarationFile) { | ||
| return; | ||
| function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> { |
There was a problem hiding this comment.
Don't use tree.visit for more flexibility (like ignore node_modules).
Inspiration from https://github.com/angular/angular-cli/blob/576119f2cab6a53f0bc67026b723fffbe8407258/packages/schematics/angular/migrations/update-8/update-lazy-module-paths.ts. I like this solution the most as we break out the node_modules folder as fast as possible.
Another option is to use the ignore package, like the nx workspace does - https://github.com/nrwl/nx/blob/3af31f1cd996db2f225773eb1888bd109efb9f76/packages/schematics/migrations/update-8-0-0/update-8-0-0.ts#L176
Or to simple check if node_modules is in the path.
| "emitDecoratorMetadata": true, | ||
| "experimentalDecorators": true, | ||
| "strictPropertyInitialization": false, | ||
| "downlevelIteration": true, |
There was a problem hiding this comment.
Needed for yield* visit(directory.dir(path));
|
Preview docs changes for 889d9de at https://previews.ngrx.io/pr1925-889d9de/ |
Exclude node_modules
Only commit file updates when there are changes
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #
What is the new behavior?
Does this PR introduce a breaking change?
This PR modifies the v8 migrations.
While running the
ng updateschematics, I noticed these were taking a long time.Initially I thought this was because we did not exclude
node_modules, but the main reason was that we committed changes on every ts file.That's why I extracted the common logic into schematics-core, so we don't have this problem in the future.