diff --git a/.changeset/three-olives-reflect.md b/.changeset/three-olives-reflect.md index 0bbfd19600b6..5f8ea9f2b166 100644 --- a/.changeset/three-olives-reflect.md +++ b/.changeset/three-olives-reflect.md @@ -2,11 +2,13 @@ 'astro': minor --- -Adds `codegenDir` to integrations `astro:config:setup` hook +Adds a new `codegenDir` URL to integrations `astro:config:setup` hook -In 4.14, we introduced `injectTypes` on `astro:config:done`. Under the hood, it creates a file at `/.astro/integrations/`. +In 4.14, we introduced the `injectTypes` utility on the `astro:config:done` hook. It allows to create `.d.ts` files and make their types available to users projects automatically. Under the hood, it creates a file in `/.astro/integrations/`. -In this release, the folder URL is now available in `astro:config:setup` as `codegenDir`. It allows you to have space without risking being overriden by another integration, Astro or overriding another integration. This directory is always created before any hook so it's safe to write files directly: +While `.astro` has always been the preferred place to write code generated files, it has also been prone to mistakes. For example, you can write a `.astro/types.d.ts` file, breaking Astro types. Or you can create a file that overrides a file created by another integration. + +In this release, `/.astro/integrations/` is now exposed in the `astro:config:setup` hook as `codegenDir`. It allows you to have a dedicated folder, avoiding conflicts with another integration or Astro. This directory is always created before any hook runs so it's safe to write files to it directly: ```js import { writeFileSync } from 'node:fs'