Skip to content

Commit

Permalink
chore: update version
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-lefebvre committed Jan 31, 2024
1 parent 7a50397 commit 214dc1d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 57 deletions.
56 changes: 0 additions & 56 deletions .changeset/wicked-brooms-pay.md

This file was deleted.

57 changes: 57 additions & 0 deletions package/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
# astro-integration-kit

## 0.0.10

### Patch Changes

- 7a50397: Updates the `hasIntegration` utility to support relative position check

When using extended hooks, the `hasIntegration` now accepts two optional arguments, one for relative position and one for a reference to the relative position.
Those fields allow checking for the presence of an integration positioned before or after another in the Astro Config:

```ts
// Check if Tailwind is installed before the current integration
hasIntegration("@astrojs/tailwind", "before");

// Check if Tailwind is installed after the current integration
hasIntegration("@astrojs/tailwind", "after");

// Check if Tailwind is installed before the MDX integration
hasIntegration("@astrojs/tailwind", "before", "@astrojs/mdx");

// Check if Tailwind is installed after the MDX integration
hasIntegration("@astrojs/tailwind", "after", "@astrojs/mdx");
```

When using standalone utilities, the `hasIntegration` utility now accept two optional fields:

- `position` to enable checking the relative position of the integration.
- `relativeTo` the integration to compare agains when checking for relative position.

Since standalone utilities don't have the context of the current integration, checking for a relative position must include a `relativeTo`, throwing an error if one is not passed in.

```ts
// Check if Tailwind is installed before the MDX integration
hasIntegration({
name: "@astrojs/tailwind",
position: "before",
relativeTo: "@astrojs/mdx",
config: config,
});

// Check if Tailwind is installed after the MDX integration
hasIntegration({
name: "@astrojs/tailwind",
position: "after",
relativeTo: "@astrojs/mdx",
config: config,
});

// Rejected by TypeScript and throws at runtime
hasIntegration({
name: "@astrojs/tailwind",
position: "before",
config: config,
});
```

If `position` is `undefined` or absent the utility will only check whether the integration is installed as it was before.

## 0.0.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "astro-integration-kit",
"version": "0.0.9",
"version": "0.0.10",
"description": "A package that contains utilities to help you build Astro integrations.",
"author": {
"email": "[email protected]",
Expand Down

0 comments on commit 214dc1d

Please sign in to comment.