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

Preserve existing indentation in package.json #206

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

Preserve existing indentation in package.json #206

gilmoreorless opened this issue Sep 21, 2017 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@gilmoreorless
Copy link

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
Copy link
Member

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

@gilmoreorless
Copy link
Author

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 Issue identified by VS Code Team member as probable bug label Sep 21, 2017
@JimiC
Copy link
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
Copy link
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
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants