Skip to content

Preserve existing indentation in package.json #206

@gilmoreorless

Description

@gilmoreorless

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?

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions