Skip to content

Version Compatibility check should only be checked within Angular related builders #14266

Closed
@FrozenPandaz

Description

@FrozenPandaz

🐞 Bug report

Command (mark with an x)

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

All Architect Commands in @angular/cli

Is this a regression?

Nope

Description

The Version compatibility check is called for every single architect command at this line here:

Version.assertCompatibleAngularVersion(this.workspace.root);
. The architect command in question might have nothing to do with Angular. For example, it could be a custom webpack build or a tslint check. This compatibility check should be moved to the following builders:

  • @angular-dekvit/build-angular:browser
  • @angular-devkit/build-angular:dev-server
  • @angular-devkit/build-angular:server
  • @angular-devkit/build-angular:app-shell
  • .etc

The following builders do not require this check:

  • @angular-devkit/build-angular:karma
  • @angular-devkit/build-angular:tslint
  • @angular-devkit/build-angular:protractor
  • @angular-devkit/build-angular:karma

🔬 Minimal Reproduction

Create a custom builder and try to use it with the @angular/cli in a project which does not have @angular/core installed.

https://github.com/FrozenPandaz/reacttest/tree/versionbug

🔥 Exception or Error


Jasons-MacBook-Pro:empty-ws jason$ ng build app1
You seem to not be depending on "@angular/core" and/or "rxjs". This is an error.

🌍 Your Environment


Jasons-MacBook-Pro:empty-ws jason$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 7.3.1
Node: 10.12.0
OS: darwin x64
Angular: undefined
... 

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.8
@angular-devkit/build-angular     0.13.8
@angular-devkit/build-optimizer   0.13.8
@angular-devkit/build-webpack     0.13.8
@angular-devkit/core              7.3.8
@angular-devkit/schematics        7.3.1
@angular/cli                      7.3.1
@ngtools/webpack                  7.3.8
@schematics/angular               7.3.1
@schematics/update                0.13.1
rxjs                              6.3.3
typescript                        3.2.2
webpack                           4.29.0

Anything else relevant?
This is needed to improve non-angular support in @nrwl/nx. 🙏

cc @alexeagle

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions