alias-hq icon indicating copy to clipboard operation
alias-hq copied to clipboard

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

Open davestewart opened this issue 3 years ago • 0 comments

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 #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 avatar Nov 25 '21 17:11 davestewart