Skip to content

Add template tsconfigs for users to extend from#4439

Merged
matthewp merged 4 commits into
mainfrom
add-template-tsconfigs
Aug 25, 2022
Merged

Add template tsconfigs for users to extend from#4439
matthewp merged 4 commits into
mainfrom
add-template-tsconfigs

Conversation

@Princesseuh
Copy link
Copy Markdown
Member

Changes

This adds tsconfig templates that users can extend from and update our templates and create-astro to use them. The benefits of having those templates is that it's neater, convenient for users to build from and that we can update them between versions of Astro without needing any users interaction (ex: adding new TypeScript settings, setting up aliases etc)

This also severely reduce the maintenance cost of our templates since we don't have to update all the tsconfig.json manually anymore

Fix #4297 at the same time

Testing

Tested manually

Docs

N/A

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Aug 23, 2022

🦋 Changeset detected

Latest commit: 2312699

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
astro Patch
create-astro Patch
@e2e/astro-component Patch
@e2e/error-react-spectrum Patch
@e2e/error-sass Patch
@e2e/errors Patch
@e2e/hydration-race Patch
@e2e/lit-component Patch
@e2e/preact-component Patch
@e2e/react-component Patch
@e2e/solid-component Patch
@e2e/solid-recurse Patch
@e2e/svelte-component Patch
@e2e/e2e-tailwindcss Patch
@e2e/ts-resolution Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added pkg: astro Related to the core `astro` package (scope) pkg: create-astro Related to the `create-astro` package (scope) pkg: example Related to an example package (scope) labels Aug 23, 2022
@Princesseuh
Copy link
Copy Markdown
Member Author

Hmm, this works perfectly fine in the editor, but for some reason Vite/ESBuild isn't able to resolve the extends and building fails. Not sure why

Comment on lines +32 to +33
"./tsconfigs/*.json": "./tsconfigs/*",
"./tsconfigs/*": "./tsconfigs/*.json",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need those two because in a tsconfig.json, you can optionally omit the file extension

Copy link
Copy Markdown
Member

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we ready for tsconfig changes to become breaking changes? This will really limit changes to these files going forward, so I just want to call that out. If we think this is stable enough to not really change until v2.0, then I'm on board!

@Princesseuh
Copy link
Copy Markdown
Member Author

Are we ready for tsconfig changes to become breaking changes? This will really limit changes to these files going forward, so I just want to call that out. If we think this is stable enough to not really change until v2.0, then I'm on board!

That's good to me! I honestly don't expect much breaking changes to them in our future. The big one that could come to mind would be switching to moduleResolution: 'node16' at some point, perhaps? Apart from that, our changes should be synced with TypeScript releases, which makes them easier to justify

@FredKSchott
Copy link
Copy Markdown
Member

SGTM!

@matthewp matthewp merged commit 77ce6be into main Aug 25, 2022
@matthewp matthewp deleted the add-template-tsconfigs branch August 25, 2022 19:15
This was referenced Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope) pkg: create-astro Related to the `create-astro` package (scope) pkg: example Related to an example package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template tsconfig overridden by create-astro typescript strict/stricter

3 participants