Roaders
Roaders

Reputation: 4525

How to set Typescript --outDir to be root folder

I have the following project structure:

root
  -src
    -lib
      index.ts
    -example
      test.ts

I would like to set the outDir to be the root folder / so that I end up with this:

root
  -lib
    index.js
  -example
    test.js
  -src
    -lib
      index.ts
    -example
      test.ts

So that I can publish to npm with lib in the root folder and .npmignore the example folder along with the src folder ending up with just

root
  -lib
    index.js

I have tried setting outDir to "", "/" and "./" but they do not work. I do not know where the compiled files go but no example or lib folders appear in the root.

Is this possible? Is there a better way or organising my code so that I can easily ignore certain folders?

Thanks

Upvotes: 4

Views: 599

Answers (1)

Roaders
Roaders

Reputation: 4525

Of course, as soon as I posted this and returned to the code it worked!

Setting outDir to "" does do exactly what I want - I don't know why it didn't work before I asked this questions!

Upvotes: 4

Related Questions