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

Import from parent directory breaks migration from 10 to 11 #39778

Closed
14 tasks
frederik opened this issue Nov 20, 2020 · 2 comments
Closed
14 tasks

Import from parent directory breaks migration from 10 to 11 #39778

frederik opened this issue Nov 20, 2020 · 2 comments
Assignees
Labels
area: migrations Issues related to `ng update` migrations P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent state: confirmed state: has PR
Milestone

Comments

@frederik
Copy link

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • [ x ] update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No

Description

I am running a project where a ts file is imported from a directory outside the angular project. This runs fine but ng update from 10 to 11 throws a migration error.

I am aware that the recommended way is to include libraries and not ts files, but my hope would be that the migration does not fail on such imports.

If this is a won't fix I would greatly appreciate if the error message could somehow be easier to understand (it took me quite a while to figure out that I did not actually have a wrong import - since the build was running - but that the validation in the migration did not expect that import.

Thanks a lot of working on this great project. I absolutely love how easily updates usually go.. and I am fully aware that I need to keep my projects somewhat standard-compliant for this to keep working 🙃

🔬 Minimal Reproduction

I created a repo https://github.com/frederik/angular-10-11-migration-issue to reproduce the error (empty angular app, just one other file).

yarn  # demo app will be at version 10
ng update @angular/cli

🔥 Exception or Error

▸ ViewEncapsulation.Native has been removed as of Angular version 11.
  This migration replaces any usages with ViewEncapsulation.ShadowDom.
✖ Migration failed: Path "/../shared/index.ts" is invalid.
  See "/tmp/ng-Ci4aHk/angular-errors.log" for further details.

🌍 Your Environment


Angular CLI: 11.0.2
Node: 10.22.1
OS: linux x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.2
@angular-devkit/build-angular   0.1100.2
@angular-devkit/core            11.0.2
@angular-devkit/schematics      11.0.2
@schematics/angular             11.0.2
@schematics/update              0.1100.2
rxjs                            6.6.3
typescript                      4.0.5


@frederik frederik changed the title Import from parent project breaks Migration from 10 to 11 Import from parent directory breaks migration from 10 to 11 Nov 20, 2020
@alan-agius4 alan-agius4 transferred this issue from angular/angular-cli Nov 20, 2020
@alan-agius4 alan-agius4 added the area: migrations Issues related to `ng update` migrations label Nov 20, 2020
@ngbot ngbot bot added this to the needsTriage milestone Nov 20, 2020
@crisbeto crisbeto self-assigned this Nov 20, 2020
crisbeto added a commit to crisbeto/angular that referenced this issue Nov 20, 2020
…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 added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent state: confirmed state: has PR labels Nov 20, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Nov 20, 2020
crisbeto added a commit to crisbeto/angular that referenced this issue Nov 20, 2020
…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.
AndrewKushnir pushed a commit that referenced this issue 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
@frederik
Copy link
Author

frederik commented Dec 7, 2020

Thanks all 😄
The same migration is now working.

@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 Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: migrations Issues related to `ng update` migrations P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent state: confirmed state: has PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants