Running `ng version` outside an Angular project has confusing output
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- angular, typescript
- Domaine
- cli
Piste de recherche
Reproduisez les deux commandes ng version de l’issue, à l’intérieur et à l’extérieur de services/ng-frontend/, et suivez le point d’entrée de la commande de version d’Angular CLI. La modification est terminée lorsque la sortie en dehors d’un projet Angular indique clairement qu’aucun projet n’a été détecté et ne fait pas passer les versions globales pour des versions du projet.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
🐞 Bug report
Command
- update
- version
Is this a regression?
No
Description
I have a monorepo where I am adding an Angular project. As a result, it exists in a subdirectory. Since many tools (such as ng) expect the project to be the working directory, I often use the pattern (cd path/to/subproject/ && run some tool). The subshell means I'm returned back to my original directory.
This pattern does not play well with ng version and ng update. I was trying to update to version 9 prerelease and saw the following:
$ (cd services/ng-frontend/ && ng update @angular/cli @angular/core --next)
# Successful update...
$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.3.21
Node: 13.5.0
OS: linux x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.803.21
@angular-devkit/core 8.3.21
@angular-devkit/schematics 8.3.21
@schematics/angular 8.3.21
@schematics/update 0.803.21
rxjs 6.4.0
This was confusing and made me think the update failed, however the update was actually fine. My mistake here was running ng version in the root of my monorepo, rather than the Angular project. After noticing this I tried:
$ (cd services/ng-frontend/ && ng version)
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.0-rc.7
Node: 13.5.0
OS: linux x64
Angular: 9.0.0-rc.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.0-rc.7
@angular-devkit/build-angular 0.900.0-rc.7
@angular-devkit/build-optimizer 0.900.0-rc.7
@angular-devkit/build-webpack 0.900.0-rc.7
@angular-devkit/core 9.0.0-rc.7
@angular-devkit/schematics 9.0.0-rc.7
@ngtools/webpack 9.0.0-rc.7
@schematics/angular 9.0.0-rc.7
@schematics/update 0.900.0-rc.7
rxjs 6.5.4
typescript 3.6.4
webpack 4.41.2
Which is what I expected post-update.
IMHO this dichotomy is confusing. When the user is in an Angular project, it lists versions of that project. When outside an Angular project, it lists the global versions and it is very easy to look at the wrong one.
I'm not sure what the ideal solution to this problem would be. There could be two different commands, such as an ng global-version and ng project-version, but this might add too much additional complexity to be worth it. Maybe the output could simply be updated to be more clear? Such as having some big red text saying "No Angular project detected at $PWD"?
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 17 h 25 min
- PR mergées (30 j)
- 183
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Ouvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
angular/angular-cli#33055 · 1 commentaire · 3 réactions ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 1 personne assignée ·
Toutes les issues de angular/angular-cli
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
bug v2
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
modelcontextprotocol/inspector#2458 · 1 commentaire ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
carbon-design-system/ibm-products#9907 ·