Skip to content

Fix whitespace in JSON.stringify indentation#62

Closed
pre-martin wants to merge 1 commit intoelgatosf:mainfrom
pre-martin:fix/manifest-indentation
Closed

Fix whitespace in JSON.stringify indentation#62
pre-martin wants to merge 1 commit intoelgatosf:mainfrom
pre-martin:fix/manifest-indentation

Conversation

@pre-martin
Copy link

"4 times empty string" looks like an error. To properly indent the manifest file after sanitizing it, either the number 4 or 4 spaces are required (or any other value or string).

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#space for the details of JSON.stringify()

Indent manifest by 4 spaces.
@GeekyEggo
Copy link
Member

Hey Martin, this does indeed look to be an error, thanks for bringing it to our attention.

I notice this PR uses spaces, however the pack command is already using tabs (\t) elsewhere.

write(JSON.stringify(manifest, undefined, "\t"));

To remove the age-old “spaces vs tabs” debate, we’re going to introduce better format detection (and retention) of the manifest file. 👍

@pre-martin
Copy link
Author

Thanks for pointing that out. I didn't notice the formatting in the "version" method.

The worst thing is when tabs and spaces are mixed within the same file. That's why I've prepared an alternative pull request: #63

@GeekyEggo
Copy link
Member

Hi Martin, I'm happy to report as part of #65 we've introduced smart-formatting which retains the preferred indentation and new-line delimiters when outputting the manifest.json file — this is available today with version 1.7.0.

@GeekyEggo GeekyEggo closed this Jan 19, 2026
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