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

Support custom tsconfig file #299

Closed
G-Rath opened this issue Nov 7, 2019 · 5 comments · May be fixed by oclif/config#152
Closed

Support custom tsconfig file #299

G-Rath opened this issue Nov 7, 2019 · 5 comments · May be fixed by oclif/config#152

Comments

@G-Rath
Copy link
Contributor

G-Rath commented Nov 7, 2019

oclif has a hard requirement on tsconfig.json.

I should be able to specify the name of my tsconfig.json, & it's path (ideally), i.e

  "oclif": {
    "commands": "./lib/commands",
    "tsconfig": "tsconfig.build.json",
    "bin": "mycommand",
    "plugins": [
      "@oclif/plugin-help",
      "@oclif/plugin-autocomplete"
    ]
  }
@iammathew
Copy link

For future references I leave this here, it seems like this line needs to be adapted to support a custom tsconfig:
https://github.com/oclif/config/blob/master/src/ts-node.ts#L26

@fwoelffel
Copy link

It looks like having a configuration tsconfig.json path would probably not be enough as not all values are actually used. See https://github.com/oclif/config/blob/master/src/ts-node.ts#L68

What's your usecase? Mine is to use oclif to build a CLI in a Nx monorepo and reuse some of our libs. Not being able to use our custom tsconfig.json might leave us with no other choice than using some other lib.

@mshwery
Copy link

mshwery commented Feb 8, 2021

I'm in a similar boat. I would love to use oclif in a monorepo, but without support for either custom tsconfig paths or without respecting extends (#488) it's a non-starter.

Saeris added a commit to Saeris/config that referenced this issue Mar 15, 2021
This addresses both oclif/oclif#299 and oclif/oclif#488

`loadTSConfig()` in `src/ts-node.ts` was not properly resolving extended configuration files, because while `parseConfigFileTextToJson` will load and parse a given `tsconfig.json` file, it does not merge compilerOptions from configs specified in the `extends` option.

This implementation is based on the solutions suggested in microsoft/TypeScript#5276
and https://stackoverflow.com/questions/53804566/how-to-get-compileroptions-from-tsconfig-json which rely on Typescript's utilities for loading and parsing `tsconfig.json` files.

Specifically, by adding  a call to `parseJsonConfigFileContent()`,  the merged compilerOptions will be resolved as expected.

Additionally, this adds support for user-defined tsconfig files through the `tsConfig` option under `oclif` key in their `package.json`.
@amphro
Copy link
Contributor

amphro commented Apr 28, 2021

I would like to get this into oclif/core instead. Thoughts?

@mdonnalley mdonnalley closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2022
@0xdevalias
Copy link

@mdonnalley It would be nice to include some context/description on why the issue is being closed (if it was completed, then when/where it was completed; if it's 'not planned' then more of an explanation of why it's not going to happen). This current process of 'close a huge pile of issues' with no context is generally considered pretty 'hostile'/'disrespectful' (for lack of a better term) to open source/collaboration/etc.

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 a pull request may close this issue.

7 participants