Skip to content

Commit

Permalink
Export defineConfig helper (#2803)
Browse files Browse the repository at this point in the history
* feat: add astro/config entrypoint

* chore: update examples to use `defineConfig` util

* chore: prettier fix

* chore: add changeset
  • Loading branch information
natemoo-re committed Mar 15, 2022
1 parent 2d95541 commit 2b76ee8
Show file tree
Hide file tree
Showing 29 changed files with 101 additions and 205 deletions.
15 changes: 15 additions & 0 deletions .changeset/quick-islands-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'astro': patch
---

Add an `astro/config` entrypoint with a `defineConfig` utility.

Config files can now be easily benefit from Intellisense using the following approach:

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

export default defineConfig({
renderers: []
})
```
12 changes: 3 additions & 9 deletions examples/blog-multiple-authors/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the Preact renderer to support Preact JSX components.
renderers: ['@astrojs/renderer-preact'],
});
13 changes: 3 additions & 10 deletions examples/blog/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// Enable the Preact renderer to support Preact JSX components.
// https://astro.build/config
export default defineConfig({
renderers: ['@astrojs/renderer-preact'],
buildOptions: {
site: 'https://example.com/',
Expand Down
12 changes: 3 additions & 9 deletions examples/component/demo/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Comment out "renderers: []" to enable Astro's default component support.
renderers: [],
});
12 changes: 3 additions & 9 deletions examples/docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
renderers: [
// Enable the Preact renderer to support Preact JSX components.
'@astrojs/renderer-preact',
Expand Down
8 changes: 3 additions & 5 deletions examples/env-vars/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// Comment out "renderers: []" to enable Astro's default component support.
// https://astro.build/config
export default defineConfig({
renderers: [],
});
12 changes: 3 additions & 9 deletions examples/framework-alpine/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// No renderers are needed for AlpineJS support, just use Astro components!
renderers: [],
});
12 changes: 3 additions & 9 deletions examples/framework-lit/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the lit renderer to support LitHTML components and templates.
renderers: ['@astrojs/renderer-lit'],
});
12 changes: 3 additions & 9 deletions examples/framework-multiple/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable many renderers to support all different kinds of components.
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue', '@astrojs/renderer-solid'],
});
12 changes: 3 additions & 9 deletions examples/framework-preact/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the Preact renderer to support Preact JSX components.
renderers: ['@astrojs/renderer-preact'],
});
12 changes: 3 additions & 9 deletions examples/framework-react/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the React renderer to support React JSX components.
renderers: ['@astrojs/renderer-react'],
});
12 changes: 3 additions & 9 deletions examples/framework-solid/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the Solid renderer to support Solid JSX components.
renderers: ['@astrojs/renderer-solid'],
});
12 changes: 3 additions & 9 deletions examples/framework-svelte/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the Svelte renderer to support Svelte components.
renderers: ['@astrojs/renderer-svelte'],
});
12 changes: 3 additions & 9 deletions examples/framework-vue/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the Vue renderer to support Vue components.
renderers: ['@astrojs/renderer-vue'],
});
7 changes: 3 additions & 4 deletions examples/minimal/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Comment out "renderers: []" to enable Astro's default component support.
renderers: [],
});
7 changes: 3 additions & 4 deletions examples/non-html-pages/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Comment out "renderers: []" to enable Astro's default component support.
renderers: [],
});
12 changes: 3 additions & 9 deletions examples/portfolio/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable the Preact renderer to support Preact JSX components.
renderers: ['@astrojs/renderer-preact'],
});
2 changes: 1 addition & 1 deletion examples/ssr/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check

export default /** @type {import('astro').AstroUserConfig} */ ({
export default defineConfig({
renderers: ['@astrojs/renderer-svelte'],
vite: {
server: {
Expand Down
12 changes: 3 additions & 9 deletions examples/starter/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Set "renderers" to "[]" to disable all default, builtin component support.
renderers: [],
});
12 changes: 3 additions & 9 deletions examples/subpath/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Comment out "renderers: []" to enable Astro's default component support.
buildOptions: {
site: 'http:https://example.com/blog',
Expand Down
12 changes: 3 additions & 9 deletions examples/with-markdown-plugins/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.
import { defineConfig } from 'astro/config';
import astroRemark from '@astrojs/markdown-remark';
import addClasses from './add-classes.mjs';

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable Custom Markdown options, plugins, etc.
renderers: [],
markdownOptions: {
Expand Down
12 changes: 3 additions & 9 deletions examples/with-markdown-shiki/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.
import { defineConfig } from 'astro/config';
import astroRemark from '@astrojs/markdown-remark';

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable Custom Markdown options, plugins, etc.
renderers: [],
markdownOptions: {
Expand Down
12 changes: 3 additions & 9 deletions examples/with-markdown/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue'],
});
12 changes: 3 additions & 9 deletions examples/with-nanostores/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Full Astro Configuration API Documentation:
// https://docs.astro.build/reference/configuration-reference
import { defineConfig } from 'astro/config';

// @type-check enabled!
// VSCode and other TypeScript-enabled text editors will provide auto-completion,
// helpful tooltips, and warnings if your exported object is invalid.
// You can disable this by removing "@ts-check" and `@type` comments below.

// @ts-check
export default /** @type {import('astro').AstroUserConfig} */ ({
// https://astro.build/config
export default defineConfig({
// Enable many renderers to support all different kinds of components.
renderers: ['@astrojs/renderer-preact', '@astrojs/renderer-react', '@astrojs/renderer-svelte', '@astrojs/renderer-vue', '@astrojs/renderer-solid'],
});
Loading

0 comments on commit 2b76ee8

Please sign in to comment.