Skip to content

Rollback package.json if plugin installation fails #2531

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

Merged
merged 1 commit into from
Feb 15, 2017

Conversation

petekanev
Copy link
Contributor

Implement rollback of package.json contents of project if npm installation fails for whatever reason during installation of a NS plugin or platform.

Addresses #2487

Copy link
Contributor

@Plamen5kov Plamen5kov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply the same logic, for catching any exception and reverting the state of the package.json, but in the node-package-manager.ts.

@petekanev petekanev self-assigned this Feb 13, 2017
@petekanev
Copy link
Contributor Author

@Plamen5kov I'd be unable to do that in the node-package-manager service as I don't want to pollute it with additional parameters (package json paths). So I might have to do it manually for every place where npm.install is called.

@Plamen5kov
Copy link
Contributor

@Pip3r4o

let jsonContentBefore = this.$fs.readJson(path.join(pathToSave, "package.json"));
the path and the content already exist in node-package-manager, so there won't be any polution. We also need a mechanism to handle ctrl + C signal in various places in cli, to revert the project state. @rosen-vladimirov what's your oppinion?

@petekanev petekanev force-pushed the pete/plugin-install-fail-rollback branch from 3682480 to 8144098 Compare February 14, 2017 08:30
@petekanev petekanev force-pushed the pete/plugin-install-fail-rollback branch from 8144098 to edce854 Compare February 14, 2017 13:53
…ugin installation fails

throw error when npm-installation-manager install fails
@petekanev petekanev force-pushed the pete/plugin-install-fail-rollback branch from edce854 to 8ed341c Compare February 14, 2017 16:06
@petekanev petekanev merged commit 96ab06c into master Feb 15, 2017
@petekanev petekanev deleted the pete/plugin-install-fail-rollback branch February 15, 2017 08:48
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.

2 participants