Skip to content

Change chart.js to a peer dependency #54

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Change chart.js to a peer dependency #54

wants to merge 2 commits into from

Conversation

kiprasmel
Copy link

@kiprasmel kiprasmel commented Jun 25, 2019

This allows the user to install the preferred chart.js version

For example, I needed some bugfixes from upstream.

The user would obviously need to install chart.js himself, so this probably is a breaking change?


Edit:

It doesn't seem like this is going to be fixed.

For anyone looking for a work-around - I've started using yarn over npm, because it can do something like this, called dependency resolution:

package.json

{
    "dependencies": {
		"angular2-chartjs": "^0.5.1"
	},
    "resolutions": {
        "angular2-chartjs/chart.js": "^2.8.0"
    }
}

as you can see - you can modify deep dependencies' versions and such.

Once again - check the documentation.

Also, I'm aware that npm has a package npm-force-resolutions, but this feature is not natively supported by npm itself. And yarn turned out pretty cool for me, so I didn't mind the switch.

P.S. - I've even tried generating patches for the deep dependencies' package.json, but it turns out that npm adds a lot of junk that makes the patches unusable, since the changed content differs everytime you re-install dependencies, like after cloning the project. See ds300/patch-package#150 for reference.

(
I've even tried making a custom postinstall script for npm to run, but turns out
that npm only applies the modifications to package-lock.json file only AFTER the whole installation, including the postinstall script, has finished, effectively meaning that's it's either impossible or really hard/complicated/not worth to do.
)

This allows the user to install the preferred chart.js version

For example, I needed some bugfixes from upstream.
Though that this might be more appropriate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant