azu / monorepo-utils

A collection of utilities for monorepo/lerna. Tools for TypeScript project references etc..
164 stars 10 forks source link

workspaces-to-typescript-project-references: More compact JSON formatting #74

Closed jonaskello closed 1 year ago

jonaskello commented 1 year ago

The workspaces-to-typescript-project-references tool works great but it does this kind of formatting in tsconfig:

{
  "references": [
    {
      "path": "../../shared/package1"
    },
    {
      "path": "../../app-a/package2"
    },
    {
      "path": "../../app-b/package3"
    }
  ]
}

With many references this takes up a lot of lines and is hard to get an overview over. I would prefer this formatting:

{
  "references": [
    { "path": "../../shared/package1" },
    { "path": "../../app-a/package2" },
    { "path": "../../app-b/package3" }
  ]
}

I can fix this manually but workspaces-to-typescript-project-references will revert back to the more verbose formatting with every update so it is a bit tedious. I tried using prettier to auto-format it but prettier will respect multi-line json objects and keep them as-is.

azu commented 1 year ago

It has used JSON.stringify()-like method. That has not line break option.

Formatting issue is out of scope. I will close it.