Enable useTsconfigDeclarationDir if declarationDir#468
Enable useTsconfigDeclarationDir if declarationDir#468agilgur5 merged 8 commits intojaredpalmer:masterfrom
Conversation
|
CI fails because "Your lockfile needs to be updated, but yarn was run with |
If you rebase with master and force-push, it should be fixed. It was just fixed in #470 |
There was a problem hiding this comment.
Awesome you made the test folder too! Was going to do that myself 😄
Looks good, but a few changes:
- Can you rename it to
build-withTsconfig(directory,package.json, unit test)? We can re-use the fixture for testing other custom tsconfig properties (e.g. #469 ) similarly to howbuild-defaultis used for a few different tests. - Can you add this directory to the list in
test/fixtures/README.md? syntax/folder andfoo.tsare unnecessary/redundant for this case. just have the smallindex.tsis plenty (also only its declaration file is checked for in the test anyway)
| @@ -0,0 +1,28 @@ | |||
| { | |||
| "compilerOptions": { | |||
| "target": "es5", | |||
There was a problem hiding this comment.
target was just removed from all test fixtures in #466
agilgur5
left a comment
There was a problem hiding this comment.
Thanks for the PR and quick iteration!
|
@etienne-dldc @agilgur5 - if What do you think about making I read @agilgur5's comment in #465, but I just ran rollup with no |
@justingrant I don't think this specific PR is the right place to discuss
I do think we'd want testing around this because rpts2 does behave differently when it is set vs. unset, as shown by the rpts2 code I pointed to in my comment. |
|
@agilgur5 - oops, I didn't notice that tsdx doesn't support That said, I still think my question is relevant: would it be good for
Sorry for confusion. I observed that if |
Yea
I'll refer to my proposed fix in #479 (comment) for any other readers.
Ok, so they were both only ever set to No changes required here in this PR. |
There was a problem hiding this comment.
So when working on #488 , I noticed some confusing changes here.
diff test/fixtures/build-default/tsconfig.json test/fixtures/build-withTsconfig/tsconfig.json should have only shown the necessary changes here, that declarationDir and declarationMap are added, but some others popped up that confused me for a bit while debugging.
Not totally sure why these configs were changed as they don't seem to have any impact on the output, but maybe I'm missing something as it's my first time actually playing with these options.
Also, #488 is a decent amount more complex (including a breaking change) than just setting useTsconfigDeclarationDir: true at all times, so good thing it was separated out 😅
|
Welp this still hasn't been merged by Jared and #504 got merged in first (that one is high prio to be fair), so now Annd there's a merge conflict in here from #476 which also got merged first before this 😭 SORRY for the churn, I'd have merged this in a while ago if I could 😐 |
Co-Authored-By: Anton Gilgur <agilgur5@gmail.com>
Co-Authored-By: Anton Gilgur <agilgur5@gmail.com>
|
I've messed up a little bit with git (sorry 😞 ) but should be good now... Ready to merge again 😉 |
|
👋 @jaredpalmer any update on this ? |
|
Sorry for churn! Thank you for the effort! Makes a lot of sense. Would you be able to summarize this in one shirt comment for the release notes for me? |
|
Sure 😃,
If this is too long you can keep just the first two sentences or even just the first one. |
|
Just one thing -- this doesn't completely fix #135 / #479. As I wrote in #479 and a bit here, this creates a workaround for correct declaration map |
|
I emailed Jared and have now been added as a collaborator so I've merged this myself now. I don't yet have permissions on NPM to publish though. Thanks again for this change @etienne-dldc and sticking through with the delays and conflicts 🙏 💯 😄 @all-contributors please add @etienne-dldc for bugs, code, tests |
|
I've put up a pull request to add @etienne-dldc! 🎉 |
TSDX now uses `declarationDir` when found in `tsconfig.json`. This let you change where types declarations (and associated declaration maps) are emitted. It also allow you to get correct declaration maps (`.d.ts.map`) paths by setting `declarationDir` to the default `dist` output directory * Enable useTsconfigDeclarationDir if declarationDir * Rename fixture folder to be reused * Update test/fixtures/build-withTsconfig/tsconfig.json Co-Authored-By: Anton Gilgur <agilgur5@gmail.com> * Update test/fixtures/build-withTsconfig/tsconfig.json Co-Authored-By: Anton Gilgur <agilgur5@gmail.com> * Fix tests * Enable useTsconfigDeclarationDir if declarationDir * Rename fixture folder to be reused * Set rootDir to src and fix test Co-authored-by: Anton Gilgur <agilgur5@gmail.com>
Fixes #465
This enable thes
useTsconfigDeclarationDiroption ofrollup-plugin-typescript2whendeclarationDiris set in tsconfig.fix (probably) #135 too