Skip to content
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

fix(core): migration error if program contains files outside of the project #39790

Closed

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Nov 20, 2020

Currently all of our migrations are set up to find the tsconfig paths within a project, create a Program out of each and migrate the files inside of the Program. The problem is that the Program can include files outside of the project and the CLI APIs that we use to interact with the file system assume that all files are within the project.

These changes consolidate the logic, that determines whether a file can be migrated, in a single place and add an extra check to exclude files outside of the root.

Fixes #39778.

Note: I wasn't able to reproduce this in a test, because it has to run in an actual CLI project.

@google-cla google-cla bot added the cla: yes label Nov 20, 2020
@@ -13,9 +13,7 @@ import {UpdateRecorder} from './update_recorder';
export class InitialNavigationTransform {
private printer = ts.createPrinter();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this file aren't required for the fix, they just remove unused code.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer area: migrations Issues related to `ng update` migrations target: patch This PR is targeted for the next patch release labels Nov 20, 2020
@ngbot ngbot bot modified the milestone: needsTriage Nov 20, 2020
@crisbeto crisbeto marked this pull request as ready for review November 20, 2020 19:59
…roject

Currently all of our migrations are set up to find the tsconfig paths within a project,
create a `Program` out of each and migrate the files inside of the `Program`. The
problem is that the `Program` can include files outside of the project and the CLI
APIs that we use to interact with the file system assume that all files are within
the project.

These changes consolidate the logic, that determines whether a file can be migrated,
in a single place and add an extra check to exclude files outside of the root.

Fixes angular#39778.
@crisbeto crisbeto force-pushed the 39778/migrations-outside-file-error branch from af761e8 to 001d49a Compare November 20, 2020 20:01
@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 20, 2020
AndrewKushnir pushed a commit that referenced this pull request Nov 20, 2020
…roject (#39790)

Currently all of our migrations are set up to find the tsconfig paths within a project,
create a `Program` out of each and migrate the files inside of the `Program`. The
problem is that the `Program` can include files outside of the project and the CLI
APIs that we use to interact with the file system assume that all files are within
the project.

These changes consolidate the logic, that determines whether a file can be migrated,
in a single place and add an extra check to exclude files outside of the root.

Fixes #39778.

PR Close #39790
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: migrations Issues related to `ng update` migrations cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import from parent directory breaks migration from 10 to 11
2 participants