Skip to content

Commit

Permalink
Updated according to new configuration (#5478)
Browse files Browse the repository at this point in the history
* Updated according to new configuration

Astro imports the `defineConfig` function from `astro/config`. The `integrations` key needs to be passed into the `defineConfig` function, but it is not shown in the README. Updated the README according to the CLI example.

* update alpine

* update image

* update lit

* update mdx

* update preact

* update prefetch

* update react

* update sitemap

* update solid

* update svelte

* update tailwind

* update turbolinks

* update vue

* chore: add changeset

* update image

* update svelte readme

Co-authored-by: Nate Moore <nate@astro.build>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 26, 2023
1 parent 607f0ac commit 1c7eef3
Show file tree
Hide file tree
Showing 14 changed files with 399 additions and 103 deletions.
17 changes: 17 additions & 0 deletions .changeset/cuddly-donkeys-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@astrojs/alpinejs': patch
'@astrojs/image': patch
'@astrojs/lit': patch
'@astrojs/mdx': patch
'@astrojs/preact': patch
'@astrojs/prefetch': patch
'@astrojs/react': patch
'@astrojs/sitemap': patch
'@astrojs/solid-js': patch
'@astrojs/svelte': patch
'@astrojs/tailwind': patch
'@astrojs/turbolinks': patch
'@astrojs/vue': patch
---

Update READMEs for consistency
4 changes: 2 additions & 2 deletions packages/integrations/alpinejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ npm install alpinejs @types/alpinejs

Then, apply this integration to your `astro.config.*` file using the `integrations` property:

__`astro.config.mjs`__

```js ins={3} "alpine()"
// astro.config.mjs
```js ins={2} "alpine()"
import { defineConfig } from 'astro/config';
import alpine from '@astrojs/alpinejs';

Expand Down
38 changes: 25 additions & 13 deletions packages/integrations/image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ Then, apply this integration to your `astro.config.*` file using the `integratio

__`astro.config.mjs`__

```js
```js ins={2} "image()"
import { defineConfig } from 'astro/config';
import image from '@astrojs/image';

export default {
export default defineConfig({
// ...
integrations: [image()],
}
});
```

### Installing `sharp` (optional)
Expand All @@ -82,16 +83,18 @@ npm install sharp

Then, update the integration in your `astro.config.*` file to use the built-in `sharp` image transformer.

```js ins={2,7}
// astro.config.mjs
__`astro.config.mjs`__

```js ins={3,8}
import { defineConfig } from 'astro/config';
import image from '@astrojs/image';

export default {
export default defineConfig({
// ...
integrations: [image({
serviceEntryPoint: '@astrojs/image/sharp'
})],
}
})
```

### Update `env.d.ts`
Expand Down Expand Up @@ -446,33 +449,37 @@ The integration can be configured to run with a different image service, either

The `serviceEntryPoint` should resolve to the image service installed from NPM. The default entry point is `@astrojs/image/squoosh`, which resolves to the entry point exported from this integration's `package.json`.

__`astro.config.mjs`__

```js
// astro.config.mjs
import { defineConfig } from 'astro/config';
import image from '@astrojs/image';

export default {
export default defineConfig({
integrations: [image({
// Example: The entrypoint for a third-party image service installed from NPM
serviceEntryPoint: 'my-image-service/astro.js'
})],
}
});
```

### config.logLevel

The `logLevel` controls can be used to control how much detail is logged by the integration during builds. This may be useful to track down a specific image or transformation that is taking a long time to build.

__`astro.config.mjs`__

```js
// astro.config.mjs
import { defineConfig } from 'astro/config';
import image from '@astrojs/image';

export default {
export default defineConfig({
integrations: [image({
// supported levels: 'debug' | 'info' | 'warn' | 'error' | 'silent'
// default: 'info'
logLevel: 'debug'
})],
}
});
```

### config.cacheDir
Expand All @@ -483,7 +490,12 @@ Local images will be cached for 1 year and invalidated when the original image f

By default, transformed images will be cached to `./node_modules/.astro/image`. This can be configured in the integration's config options.

__`astro.config.mjs`__

```js
import { defineConfig } from 'astro/config';
import image from '@astrojs/image';

export default defineConfig({
integrations: [image({
// may be useful if your hosting provider allows caching between CI builds
Expand Down
7 changes: 4 additions & 3 deletions packages/integrations/lit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ Now, apply this integration to your `astro.config.*` file using the `integration

__`astro.config.mjs`__

```js
```js ins={2} "lit()"
import { defineConfig } from 'astro/config';
import lit from '@astrojs/lit';

export default {
export default defineConfig({
// ...
integrations: [lit()],
}
});
```

## Getting started
Expand Down
Loading

0 comments on commit 1c7eef3

Please sign in to comment.