- Notifications
You must be signed in to change notification settings - Fork 152
feat(@schematics/angular): Update app schematic #21
Conversation
hansl left a comment
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.
A good start.
| import * as stringUtils from '../strings'; | ||
| import {Rule, apply, mergeWith, move, template, url} from '@angular-devkit/schematics'; | ||
| import { | ||
| Rule, |
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.
sort in ASCII order (capitals first, a-z)
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.
Resolved
| apply(url('./files'), [ | ||
| template({ utils: stringUtils, ...options }) | ||
| ])), | ||
| schematic('module', { name: 'app' }), |
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 don't think that schematics exist in this PR... Is this in another PR?
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.
It is already merged into master
| | ||
| import * as ts from 'typescript'; | ||
| import 'rxjs/add/operator/merge'; | ||
| import findModule, { buildRelativePath } from '../utility/find-module'; |
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.
Avoid the mix of default and non-default exports/imports.
| | ||
| const recorder = host.beginUpdate(modulePath); | ||
| for (const change of changes) { | ||
| if (change instanceof InsertChange) { |
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.
Do we have anything else than InsertChange anymore?
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.
No but if we remove this check then the typings are off. For now I suggest we leave it. And if the change is necessary a separate refactor PR is the right place for it.
| const toParts = to.split('/'); | ||
| | ||
| // Remove file names (preserving destination) | ||
| fromParts.splice(-1); |
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.
splice(-1) => pop()?
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.
It could be used, except this provides consistency/readability with the following line.
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 following line could be pop() as well.
dae129a to 0078839 Compare | template, | ||
| url | ||
| } from '@angular-devkit/schematics'; | ||
| import {addImportToModule, addBootstrapToModule} from '../utility/ast-utils'; |
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.
Same for inline ones. I'll see if I can make a linting rule.
hansl left a comment
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.
1 more nit then good to merge.
Utilize module schematic for app module Utilize component schematic for app root component
Utilize module schematic for app module
Utilize component schematic for app root component