Angular-cli: Can't select project when doing ng update

Created on 19 May 2019  路  13Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


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

Description

When running ng update --all --force is will only update the package.json in the root of the Angular project, but will skip your projects in the projects folder. There is no way to specify the project on the command line. Having a few larges libraries it's convenient to update projects too.

angulacli can be closed? feature

All 13 comments

We usually go through all projects and update them, but I think that in the specific case of libraries we don't have any migration for 9 right now. @clydin @alan-agius4 can you confirm?

Migrations run against all projects in a workspace. They will run on libraries and applications, if the migration schematic is designed to do so. For version 8 we don't have any migration that effects a library.

However from the request above, I am assuming that the user (@farlock85) is using some sort of workspace concept maybe with yarn. Ie having multiple package.json in various projects. At the moment, this is not supported by the CLI and we only update dependencies in the root package.json.

@alan-agius4 It's been a while I worked with libraries (hence the upgrade) so not sure if I'm doing anything special.

I found this random stackblitz: https://stackblitz.com/github/tobi-or-not-tobi/lipstick-css?file=package.json

If I download it and run ng update --all --force it will update the main package.json correctly, but leaves the projectssample-componentspackage.json untouched.

@rogerfar, what do you expect to be changed in the library package.json? The peerDependencies?

@alan-agius4 , Even I am facing the same issue. My library has peer dependencies. Want to know whether ng update(angular 7 to 8) updates any library related files or do we need to manually update library files?

@kishore5a8, libraries projects will also be updated when running ng update.

@alan-agius4 yeah I'm not sure.. We use libraries only internally to separate larger pieces of codebase, makes it easier to maintain and unit test, so updating the peer dependencies at that time would be nice.

Thank you @alan-agius4 for your quick response. I came to know that ng update from angular 8 to 9 updates library projects. Below link says that this was introduced in angular 9. Tried the same for angular 7 to 8 but library project is not updated.

https://angular.io/guide/migration-renderer#im-a-library-author-should-i-run-this-migration
https://indepth.dev/exciting-times-ahead-be-ready-for-angular-9/#apply-schematics-to-libraries

@rogerfar , still peer dependencies in library's package.json are not getting updated. so do you suggest to update these peer dependencies manually after the upgradation?

Hi all,

Yeah, peerDependencies need to be updated manually one of the reason is that it鈥檚 up to the library author to decide the support strategy of their library.

Tried the same for angular 7 to 8 but library project is not updated.

What did you expect to see updated in the library when you updated from version 7 to 8?

Prior to version 9, ng update did update library projects as well.

I expect that ng update to angular 8 should update library related files like .ts and tsconfig.json and etc.,

May be my library does not have any code that needs to be updated.

The libraries tsconfig only needs to be updated when updating from Angular 8 to 9.

Closing this issue as it seems there is no bug here.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

delasteve picture delasteve  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

donaldallen picture donaldallen  路  3Comments