-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NgAdd Library Schematic #298
Comments
Hello 👋 @enzeart |
For Angular 16 use 16.x version
|
@pavankjadda I don't think we're on the same page. My goal for this feature request is to streamline the process of installing this library in automation.
I know that I can manually install a specific version, but that doesn't provide a solution for a generalized project template script. Ideally someone could type |
Is your feature request related to a problem? Please describe
I have a project template that attempts to install the package with a script. The installation fails due to incompatible dependencies. Here's a snippet from the error logs:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"^16.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^17.0.0" from [email protected]
npm ERR! node_modules/ngx-cookie-service
npm ERR! ngx-cookie-service@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/enseart/.npm/_logs/2023-12-27T20_50_09_949Z-eresolve-report.txt
Describe the solution you'd like
An ng-add schematic that will install the latest compatible version of the package. I could also optionally add the CookieService provider to a specified module, but that would just be a nice-to-have.
I think this would involve creating a schematic that parses the current package.json, extracts the major version of a core angular dependency (e.g. @angular/core), generates a compatible version spec based on the ngx-cookie-service's versioning scheme, writes the calculated dependency to package.json, and runs the install process.
Support for adding the CookieService provider can be handled by a call to
addProviderToModule
from @schematics/angular/utility/ast-utils.Describe alternatives you've considered
I tried the --legacy-peer-deps during installation, but I don't know that ignoring the incompatible peer dependencies is a safe thing to do.
I tried messing around with version ranges, but couldn't get that to work either.
Ultimately, I'd like my project script to make the correct decision about what to install without me have to code explicit versions that won't take into account the angular version the user may currently be using.
Additional context
No response
The text was updated successfully, but these errors were encountered: