Skip to content

Conversation

@mcmire
Copy link
Contributor

@mcmire mcmire commented Jan 14, 2026

Explanation

Since comments were added to tsconfig.json and tsconfig.build.json files, the create-package tool no longer works.

This commit fixes the tool by using the comment-json package to parse JSONC files while retaining comments. Note that I needed to reformat tsconfig.json and tsconfig.build.json in this PR due to the way that I need to use comment-json. If we don't do this, then the next time someone runs create-package then 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

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Fix create-package to support JSONC

  • Use comment-json in scripts/create-package/utils.ts to parse and stringify tsconfig.json and tsconfig.build.json while preserving comments
  • Update finalizeAndWriteData to write JSON with consistent indentation; adjust tests in utils.test.ts to expect pretty-printed output
  • Reformat root tsconfig.json and tsconfig.build.json to expanded, consistently formatted references
  • Add comment-json to devDependencies and update yarn.lock

Written by Cursor Bugbot for commit 6296348. This will update automatically on new commits. Configure here.

@socket-security
Copy link

socket-security bot commented Jan 14, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcomment-json@​4.5.110010010088100

View full report

Since comments were added to `tsconfig.json` and `tsconfig.build.json`
files, the `create-package` tool no longer works.

This commit fixes the tool by using the `comment-json` package to parse
JSONC files while retaining comments. Note that I needed to reformat
`tsconfig.json` and `tsconfig.build.json` in this PR due to the way that
I need to use `comment-json`. If we don't do this, then the next time
someone runs `create-package` then the diffs for these files will be
large.
@mcmire mcmire force-pushed the fix-create-package branch from 126a0cd to 6296348 Compare January 14, 2026 16:31
@mcmire mcmire marked this pull request as ready for review January 14, 2026 17:11
@mcmire mcmire enabled auto-merge January 14, 2026 17:13
@mcmire mcmire added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit 55a1585 Jan 14, 2026
290 checks passed
@mcmire mcmire deleted the fix-create-package branch January 14, 2026 17:17
await writeJsonFile(
REPO_TS_CONFIG_BUILD,
JSON.stringify(monorepoFileData.tsConfigBuild),
commentJson.stringify(monorepoFileData.tsConfigBuild, null, 2),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier JSON parser incompatible with JSONC comments

Medium Severity

The writeJsonFile function uses parser: 'json' with prettier, but commentJson.stringify outputs JSONC content with comments when the input object has comment symbols (parsed from real tsconfig files). Prettier's json parser doesn't support comments and would throw a parse error. The test doesn't catch this because mock data lacks comment symbols. Using parser: 'json5' instead would handle comments correctly.

Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I didn't know about this. Well, if this is a problem we can try this out.

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.

4 participants