Skip to content
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

is it normal that the patch is huge ? #117

Closed
vesper8 opened this issue Jan 29, 2019 · 6 comments
Closed

is it normal that the patch is huge ? #117

vesper8 opened this issue Jan 29, 2019 · 6 comments

Comments

@vesper8
Copy link

vesper8 commented Jan 29, 2019

I just used this for the first time.
I cloned a copy of https://github.com/vuex-orm/plugin-axios
applied the changes from this PR: vuex-orm/plugin-axios#8

and then created a patch

It works wonderfully well, however the patch it created is 80mb in size!! It's huge.. specially considering I need to commit it to the repository. It's like 20x bigger than the size of the rest of the committed code

Is this normal? Is there no way around this?

Thanks!

@ds300
Copy link
Owner

ds300 commented Jan 29, 2019

Hi! 👋

👀 no that's not normal. Can you provide a more detailed description of how you modified the contents of your node_modules/@vuex-orm/plugin-axios folder?

@ds300
Copy link
Owner

ds300 commented Jan 29, 2019

Also note that you can be more targeted when making a patch, see the readme section on --include and --exclude

@vesper8
Copy link
Author

vesper8 commented Jan 29, 2019

Sure thing! I hope this explanation can help me understand how to create a small patch and what I might have done wrong.

To create the above patch I installed the package normally

    "@vuex-orm/core": "^0.31.2",
    "@vuex-orm/plugin-axios": "^0.2.2",

Then I cloned the fork from another author which includes the PR I wanted to apply:

https://github.com/Akhail/plugin-axios.git

From that folder I grabbed the src folder and package.json file and copied it over to the installed package inside ./node_modules/@vuex-orm/plugin-axios

Since this "PR" includes modifications to the package.json, I then cd'd inside the folder cd node_modules/@vuex-orm/plugin-axios, and ran yarn, followed by yarn build

I then cd'd back the root of my project and ran

yarn patch-package @vuex-orm/plugin-axios

and that created the 78mb patch file, which works as intended aside from being huge

hope that helps!

@ds300
Copy link
Owner

ds300 commented Jan 31, 2019

Ah, that's not a good way to do it!

You're probably adding a bunch of source files and node_modules and build artefacts into the patch file!

You should delete the patch file, run yarn/npm, copy the dist/index.js from that PR into the one in your node_modules then run patch-package again.

@vesper8
Copy link
Author

vesper8 commented Jan 31, 2019

ahh! thanks a lot for explaining

I just did a do-over, and this time I cd'd into my working folder by using the full path instead of using my dev symlinks that I use all the time

this time I only copied the index.js from the dist folder of the PR

It created a tiny patch of 328KB instead of one of 78MB

I'm also now able to use the latest v6

Perhaps the instructions could be improved to mention that in most cases a user should only modify files inside the dist folder. And the --exclude explanation could include a sample where node_modules is excluded.. just a thought

@ds300
Copy link
Owner

ds300 commented Jan 31, 2019

thanks for the idea! Maybe I'll do that if other people have similar issues. For now it doesn't seem to be a common problem.

Cheers!

@ds300 ds300 closed this as completed Jan 31, 2019
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

No branches or pull requests

2 participants