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

Preserve existing indentation in package.json #206

Closed
gilmoreorless opened this Issue Sep 21, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@gilmoreorless

gilmoreorless commented Sep 21, 2017

Using vsce publish <version> is clobbering the existing indentation in package.json and forcing it to always be 4 spaces. This differs from the default 2-space indentation generated by npm init, and can make git diffs rather messy.

I know npm has code to detect the indentation of package.json and preserve it when installing/updating/removing dependencies or publishing a new version. Ideally vsce would do the same.

I’ve been able to quickly get the same functionality working for vsce locally (using the same module as npm for consistency). I’d be happy to create a PR for it, but I also saw in #180 that vsce might be moving away from custom package.json updates completely. So before I clean up the code and write tests for it, is this a PR that’s worth doing, or should I just wait until vsce uses npm publish under the covers?

@joaomoreno

This comment has been minimized.

Member

joaomoreno commented Sep 21, 2017

I'm more in favour of having vsce just spawn npm.

@gilmoreorless

This comment has been minimized.

gilmoreorless commented Sep 21, 2017

Fair enough, I’ll leave it alone then. 😃

@joaomoreno joaomoreno self-assigned this Sep 21, 2017

@joaomoreno joaomoreno added this to the Backlog milestone Sep 21, 2017

@joaomoreno joaomoreno added the bug label Sep 21, 2017

@JimiC

This comment has been minimized.

Contributor

JimiC commented Jun 2, 2018

@joaomoreno So how to think this should be implemented? Using npm unofficial API or spawning a child process and executing the npm command?

@JimiC

This comment has been minimized.

Contributor

JimiC commented Jun 2, 2018

Looking at the code I concluded that child process is preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment