Skip to content

Conversation

@sis0k0
Copy link
Contributor

@sis0k0 sis0k0 commented Aug 7, 2019

The @nativescript/schematics package uses TypeScript utility functions from @schematics/angular. The utility functions return ASTs generated from the source code. After that these ASTs are used by other functions in @nativescript/schematics.
@nativescript/schematics depends on the version of TypeScript used in the project, whereas @schematics/angular has its own dependency on TypeScript. If the versions of the two TypeScript packages don't match, we end up comparing ASTs generated from different TS versions which usually results in an error.
This PR removes the dependency of @schematics/angular from the @nativescript/schematics. That way, the version in the user's project will be used instead. We rely on the assumption that the project will have matching versions of @schematics/angular and TypeScript.

@cla-bot cla-bot bot added the cla: yes label Aug 7, 2019
dtopuzov added a commit to NativeScript/nativescript-tooling-qa that referenced this pull request Aug 8, 2019
@sis0k0 sis0k0 marked this pull request as ready for review August 9, 2019 07:26
@sis0k0 sis0k0 merged commit 915349d into master Aug 9, 2019
@sis0k0 sis0k0 deleted the sis0k0/ng-82 branch August 9, 2019 07:36
dtopuzov added a commit to NativeScript/nativescript-tooling-qa that referenced this pull request Aug 9, 2019
@vakrilov
Copy link
Contributor

vakrilov commented Aug 12, 2019

We rely on the assumption that the project will have matching versions of @schematics/angular and TypeScript.

AFAIK the @schematics/angular will does not depend on specific typescript to be used in the project. Actually, the @schematics/angular bring its [own version of typescript`](https://github.com/angular/angular-cli/blob/master/packages/schematics/angular/utility/ast-utils.ts#L8) embedded in the package. Currently we rely on the above assumption, but it is not something that angular CLI looks after.

SUGGESTION: Let's get rid of the typescript dependency too and start using the typescript embedded in @schematics/angular:

import * as ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript'; 

This we will be sure that the typescript SourceFiles use the same version of TypeScript as @schematics/angular/utility/ast-utils

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants