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

Not detecting shrinkwrap #10

Closed
alexpineda opened this issue Aug 14, 2017 · 9 comments
Closed

Not detecting shrinkwrap #10

alexpineda opened this issue Aug 14, 2017 · 9 comments

Comments

@alexpineda
Copy link

I'm receiving an error that it's not finding package-lock.json or yarn.lock however I am using shrinkwrap. Any suggestions?

@ds300
Copy link
Owner

ds300 commented Aug 14, 2017

patch-package doesn't support shrinkwrap at the moment. It shouldn't be difficult to add support, although it's not a priority for me. Happy to accept PRs though!

@ds300
Copy link
Owner

ds300 commented Aug 14, 2017

I'm also happy to provide guidance for anyone wanting to give this a go. Probably the first places to look are makePatch.ts and detectPackageManager.ts. It might be best to treat npm shrinkwrap as a third package manager.

@rhys-e
Copy link

rhys-e commented Sep 11, 2017

Why does patch-package need to access the package-lock.json/npm-shrinkwrap.json at all? I kind of assumed it was only creating and applying diffs - not sure where the lock-file comes in?

@ds300
Copy link
Owner

ds300 commented Sep 11, 2017

patch-package uses the lock files to build a 'clean' version of your node_modules folder when creating patches. I decided to err on the side of reproducible builds for safety.

@rhys-e
Copy link

rhys-e commented Sep 12, 2017

Is that not just a case then of checking for the existence of a package-lock.json and then doing an npm install? In which case, could you not just check for the existence of a package-lock.json or an npm-shrinkwrap.json and then do an npm install given that if they're present, they'll be used automatically by npm? Am I missing some subtlety?

@ds300
Copy link
Owner

ds300 commented Sep 12, 2017 via email

@rhys-e
Copy link

rhys-e commented Sep 12, 2017 via email

@ds300
Copy link
Owner

ds300 commented Sep 12, 2017

Ah I see. Sorry I was a bit distracted when I read your previous reply.

Yes, to support shrinkwrap we'd need to check whether the json file exists and then copy it to the temporary directory that is used for generating the 'clean' node modules. That happens in makePatch.ts. I have some free time tonight to take a look at it.

@ds300
Copy link
Owner

ds300 commented Sep 12, 2017

Just about to publish a fix for this. Feel free to reopen if you still have issues.

@ds300 ds300 closed this as completed in 5497fdf Sep 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants