-
Notifications
You must be signed in to change notification settings - Fork 26.6k
feat(core): add initialNavigation schematic #36926
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
Conversation
6f23cbc
to
b3cb8ef
Compare
those options by hand. Otherwise, the compiler will error if the types are sufficiently enforced. | ||
|
||
The basic migration strategy is as follows: | ||
* `legacy_disabled` || `false` => `disabled` |
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'm not sure if we can have this change as part of the migration in 10.1 since legacy_disabled
and false
work slightly differently than disabled
. We might only be able to make migrations that are exactly 1 to 1 now and then update this in v11.
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.
Yeah, I'd agree with this.
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.
@CaerusKaru now that master
is targeting v11, I think we can submit this change. Can you do a quick pass over this migration and the follow-up PR to remove the old options?
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. A few minor nits. I'm glad we decided on the more straightforward non-static-interpreter approach as that seems to capture the most common cases quite reliably.
those options by hand. Otherwise, the compiler will error if the types are sufficiently enforced. | ||
|
||
The basic migration strategy is as follows: | ||
* `legacy_disabled` || `false` => `disabled` |
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.
Yeah, I'd agree with this.
packages/core/schematics/migrations/initial-navigation/collector.ts
Outdated
Show resolved
Hide resolved
packages/core/schematics/migrations/initial-navigation/collector.ts
Outdated
Show resolved
Hide resolved
packages/core/schematics/migrations/initial-navigation/collector.ts
Outdated
Show resolved
Hide resolved
packages/core/schematics/migrations/initial-navigation/google3/tslint_update_recorder.ts
Show resolved
Hide resolved
|
||
await runMigration(); | ||
expect(tree.readContent('/index.ts')).toContain(`enabledNonBlocking`); | ||
expect(tree.readContent('/index.ts')).toContain(`disabled`); |
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.
Nit: should these assertions (and in other tests) be a little more precise? Right now options could theoretically swapped in wrong order. Might just make this a small regex checking for surrounding context.
dd42af1
to
e12d456
Compare
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 with a couple small comments
packages/core/schematics/migrations/initial-navigation/transform.ts
Outdated
Show resolved
Hide resolved
packages/core/schematics/test/google3/initial_navigation_rule_spec.ts
Outdated
Show resolved
Hide resolved
68bffa3
to
cfd6380
Compare
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.
Reviewed-for: dev-infra
@@ -0,0 +1,211 @@ | |||
/** |
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.
Nit: The _rule
part in the file name feels confusing. I think it would be more consistent without the _rule
part as well (although some other spec files have it, most don't).
@@ -20,7 +20,7 @@ export interface AnalysisFailure { | |||
message: string; | |||
} | |||
|
|||
const TODO_COMMENT = 'TODO: The following node requires a generic type for `ModuleWithProviders'; | |||
const TODO_COMMENT = 'TODO: The following node requires a generic type for `ModuleWithProviders`'; |
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.
Nit: Since this change is unrelated, consider moving it to a separate commit.
packages/core/schematics/migrations/initial-navigation/BUILD.bazel
Outdated
Show resolved
Hide resolved
packages/core/schematics/migrations/initial-navigation/collector.ts
Outdated
Show resolved
Hide resolved
packages/core/schematics/migrations/initial-navigation/collector.ts
Outdated
Show resolved
Hide resolved
packages/core/schematics/migrations/initial-navigation/collector.ts
Outdated
Show resolved
Hide resolved
return failures; | ||
|
||
/** Gets the update recorder for the specified source file. */ | ||
function getUpdateRecorder(sourceFile: ts.SourceFile): TslintUpdateRecorder { |
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.
Consider moving it into a private method or outside of applyWithProgram
so the function doesn't get re-declared on each invocation.
44c03cd
to
d384e65
Compare
Add a schematic to update users to the new v11 `initialNavigation` options for `RouterModule`. This replaces the deprecated/removed `true`, `false`, `legacy_disabled`, and `legacy_enabled` options with the newer `enabledBlocking` and `enabledNonBlocking` options.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add a schematic to update users to the new v11
initialNavigation
options for
RouterModule
. This replaces the deprecated/removedtrue
,false
,legacy_disabled
, andlegacy_enabled
optionswith the newer
enabledBlocking
andenabledNonBlocking
options.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?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Follow-up to #33128