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

CLI code to update tsconfig.json paths will remove any comments #40

Open
davestewart opened this issue Nov 25, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@davestewart
Copy link
Owner

davestewart commented Nov 25, 2021

Background

Because tsconfig.json supports // comments simply loading and then saving JSON to the file will replace the file's contents and so remove any comments:

https://github.com/davestewart/alias-hq/blob/master/cli/utils/file.js#L20

Proposal

Replace only the paths part of the file.

Ideas:

  • see if the TypeScript's own tools added in Add support for tsconfig extends #37 have a solution to this
  • programatically find and replace portions of the file using regexp / string methods
  • use some kind of AST or lexer (3rd-party or something home-rolled for speed, counting brackets in and out)
@davestewart davestewart changed the title Code to update tsconfig.json paths will remove any comments CLI code to update tsconfig.json paths will remove any comments Nov 25, 2021
@davestewart davestewart added the bug Something isn't working label Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant