Skip to content

Commit

Permalink
feat(astro-when): Use new injectTypes utility when available (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryuni authored Sep 5, 2024
1 parent 581963c commit 485df2c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/unlucky-dragons-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@inox-tools/astro-when': patch
---

Inject types in `.astro` folder structure if the utility is available
10 changes: 10 additions & 0 deletions packages/astro-when/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ export default defineIntegration({
},
});
},
'astro:config:done': (params) => {
// Check if the version of Astro being used has the `injectTypes` utility.
if (typeof params.injectTypes === 'function') {
debug('Injecting types in .astro structure');
params.injectTypes({
filename: 'types.d.ts',
content: "import '@inox-tools/astro-when';",
});
}
},
},
}),
});

0 comments on commit 485df2c

Please sign in to comment.