Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Option like --check? #35

Open
anstosa opened this issue Jul 9, 2014 · 7 comments · May be fixed by #122
Open

Option like --check? #35

anstosa opened this issue Jul 9, 2014 · 7 comments · May be fixed by #122

Comments

@anstosa
Copy link

anstosa commented Jul 9, 2014

As part of my build, I would like to check to make sure that the modules match my packages.json, but my build cannot have network dependencies so npm install will not work. shrinkwrap can do this but as far as I can tell there is not flag like --check to have it just run the check and nothing else. Would you consider adding something like this? Or is there an existing method that I can use?

Thanks!

@Raynos
Copy link
Contributor

Raynos commented Jul 9, 2014

@anstosa i've been meaning to implement npm-shrinkwrap check-stale where it's like the sync algorithm except instead of syncing into node_modules it will just complain at you about the things that are stale in node_modules

I have not implemented it yet. But if you want to take a go at it, it would just be re-using the npm-shrinkwrap sync code and adding a bunch of if statements to avoid effects and just aggregate errors.

@anstosa
Copy link
Author

anstosa commented Jul 9, 2014

Cool, thanks @Raynos. I should be able to take a look at this towards the end of next week.

@Raynos
Copy link
Contributor

Raynos commented Jul 9, 2014

@anstosa i'll update you once i start working on it

@STRML
Copy link

STRML commented Sep 19, 2014

+1 for this, if nobody is going to take it anytime soon I will. I'd like to run it as a pre-commit hook so we don't commit stale shrinkwrap files (happens all the time).

@Raynos
Copy link
Contributor

Raynos commented Sep 19, 2014

We do not plan to implement this in the near future. However here is a suggestion on how to implement it.

Check

To implement --check I'd modify sync to take a --dry flag that makes install-module and purge-excess not do any side effects.

I'd also modify force-install to return a list of correct and incorrect modules, recursively.

Then the actual implementation of check() would call sync({ dry: true }) and parse the output which will be a list of correct & incorrect modules, then properly complain and error if there any incorrect modules.

@Raynos
Copy link
Contributor

Raynos commented Oct 22, 2014

cc @dfellis

@ljharb
Copy link
Contributor

ljharb commented Jul 24, 2015

This would be incredibly useful - any chance the "near future" is passed, and it's likely to be implemented again?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants