question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug(migrations): migration-v13 unresolved TS project for non-buildable / test target without tsconfig path projects

See original GitHub issue

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When running the migration (migration-v13), the following is printed to the console: Could not find TypeScript project for project: project-name

This appears to be the result of the logic that is being used to find the TSConfig file for the project in the angular.json. It is looking for test targets that use the @angular-devkit/build-angular:karma builder, ignoring that there might be other builders being used for the test target that contain a path to the tsconfig file.

After more investigation, I can narrow this down a bit more. it’s related to the getTargetTsconfigPath function.

Some library projects may not have a build target by default, and their test target may be using jest which does not contain a tsconfig property.

This definitely makes it more difficult to determine a tsconfig path. Especially as there may not be a standard convention for the lib’s tsconfig file name.

Reproduction

Steps to reproduce: 1. Change the test target’s builder of any project using Angular Material 2. Try run the migration

  1. Have a project in angular.json that does not have a build target, or a tsconfig property in the test target

Expected Behavior

It should run the migration with no errors / warnings.

Actual Behavior

It does not find the tsconfig for the project therefore the migration logs warnings.

Environment

  • Angular: 13.0.0
  • CDK/Material: 13.0.0
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
devversioncommented, Nov 12, 2021

yeah, I think we need some more thoughts on this. I think a first step is to stop migrating other projects/targets (as mentioned before), and then we should look for ways that allow specification of a tsconfig. I like the idea of a migrate command, but that would be something to check with the CLI team. For now I could imagine us providing a ng generate schematic entry-point. e.g. ng generate @angular/cdk:migrations-v12 --tsConfig=<..> or something around that.

0reactions
Coly010commented, Nov 12, 2021

@devversion yeah exactly, the real issue here is that the TS Program will have similar future issues during migration 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are these tsconfig paths not working? - Stack Overflow
In case anyone is using VSCode and having trouble getting the /* solution to work. Try Cmd+Shift+P > Typescript: Restart TS Server. –...
Read more >
ts-migrate: A Tool for Migrating to TypeScript at Scale - Medium
Migration at scale is a complex task, and we explored a couple of options for moving from JavaScript to TypeScript: 1) Hybrid migration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found