Fix create-package to handle JSONC files #7631
Merged
+421
−140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
Since comments were added to
tsconfig.jsonandtsconfig.build.jsonfiles, thecreate-packagetool no longer works.This commit fixes the tool by using the
comment-jsonpackage to parse JSONC files while retaining comments. Note that I needed to reformattsconfig.jsonandtsconfig.build.jsonin this PR due to the way that I need to usecomment-json. If we don't do this, then the next time someone runscreate-packagethen the diffs for these files will be large.Manual testing steps
Run
yarn create-package --name foo-controller --description "This is the FooController". It should work.References
Checklist
Note
Fix create-package to support JSONC
comment-jsoninscripts/create-package/utils.tsto parse and stringifytsconfig.jsonandtsconfig.build.jsonwhile preserving commentsfinalizeAndWriteDatato write JSON with consistent indentation; adjust tests inutils.test.tsto expect pretty-printed outputtsconfig.jsonandtsconfig.build.jsonto expanded, consistently formatted referencescomment-jsontodevDependenciesand updateyarn.lockWritten by Cursor Bugbot for commit 6296348. This will update automatically on new commits. Configure here.