Skip to content

Commit

Permalink
Migrate to new config (#2962)
Browse files Browse the repository at this point in the history
* wip: config migration

* fix: formatting

* refactor: projectRoot -> root

* refactor: pageUrlFormat -> format

* refactor: buildOptions.site -> site

* refactor: public -> publicDir

* refactor: dist -> outDir

* refactor: styleOptions -> style

* fix: some dist tests -> outDir

* refactor: remove legacyBuild (with TODOs)

* refactor: more legacyBuild cleanup

* refactor: server host and port

* fix: remove experimentalStaticBuild CLI flag

* refactor: src -> srcDir

* refactor: devOptions.trailing -> trailing

* refactor: remove sitemap + related flags

* refactor: experimentalSSR -> experimental.ssr

* fix: last devOptions

* refactor: drafts -> markdown.drafts

* fix: TS error on port as const

* refactor: remove pages

* refactor: more --project-root updates

* refactor: markdownOptions -> markdown

* fix: remaining type errors

* feat: update AstroUserConfig

* refactor: update CLI flag mapper + server mapper

* fix: loadFixture projectRoot

* fix: merge CLI flags before validating / transforming

* wip: attempt to fix bad createRouteManifest config

* refactor: combine config.base and config.site

* fix: skip route manifest test for now

* fix: site and base handling

* refactor: update failing config testes

* fix: build failure

* feat: update config types with migration help

* chore: update types

* fix(deno): update deno fixture

* chore: remove config migration logic

* chore: remove logLevel

* chore: clean-up config types

* chore: update config warning

* chore: add changeset

* Sitemap Integration (#2965)

* feat: add sitemap filter config option

* feat: add canonicalURL sitemap config option

* docs: update sitemap README

* fix: update for new config

* fix: filter not being applied

* chore: changeset

Co-authored-by: bholmesdev <[email protected]>

* fred pass

* fix: Astro.resolve typo

* fix: public => publicDir

Co-authored-by: bholmesdev <[email protected]>
Co-authored-by: Fred K. Schott <[email protected]>
  • Loading branch information
3 people authored Apr 2, 2022
1 parent 76f6643 commit 17c0292
Show file tree
Hide file tree
Showing 137 changed files with 1,208 additions and 1,360 deletions.
7 changes: 7 additions & 0 deletions .changeset/tall-cooks-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/sitemap': patch
---

Add new sitemap configuration options:
- `filter`: filter pages to include in your sitemap
- `canonicalURL`: override your astro.config `site` with a custom base URL
11 changes: 11 additions & 0 deletions .changeset/wicked-toes-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'astro': minor
'@astrojs/deno': minor
'@astrojs/netlify': minor
'@astrojs/partytown': minor
'@astrojs/sitemap': minor
'@astrojs/tailwind': minor
'@astrojs/markdown-remark': minor
---

Update config options to resepect [RFC0019](https://github.com/withastro/rfcs/blob/main/proposals/0019-config-finalization.md)
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function getStaticPaths({ paginate, rss }) {
const sortedPosts = allPosts.sort((a, b) => new Date(b.frontmatter.date).valueOf() - new Date(a.frontmatter.date).valueOf());
// Generate an RSS feed from this collection of posts.
// NOTE: This is disabled by default, since it requires `buildOptions.site` to be set in your "astro.config.mjs" file.
// NOTE: This is disabled by default, since it requires `site` to be set in your "astro.config.mjs" file.
// rss({
// title: 'Don’s Blog',
// description: 'An example blog on Astro',
Expand Down
5 changes: 2 additions & 3 deletions examples/blog/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import preact from '@astrojs/preact';
// https://astro.build/config
export default defineConfig({
integrations: [preact()],
buildOptions: {
site: 'https://example.com/',
},
site: 'https://example.com',
base: '/subpath',
});
6 changes: 3 additions & 3 deletions examples/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "astro --project-root demo dev",
"build": "astro --project-root demo build",
"serve": "astro --project-root demo preview"
"start": "astro --root demo dev",
"build": "astro --root demo build",
"serve": "astro --root demo preview"
},
"devDependencies": {
"astro": "^0.25.4"
Expand Down
4 changes: 1 addition & 3 deletions examples/subpath/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ import react from '@astrojs/react';
// https://astro.build/config
export default defineConfig({
integrations: [react()],
buildOptions: {
site: 'http://example.com/blog',
},
site: 'http://example.com/blog',
});
12 changes: 3 additions & 9 deletions examples/with-markdown-plugins/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { defineConfig } from 'astro/config';
import astroRemark from '@astrojs/markdown-remark';
import addClasses from './add-classes.mjs';

// https://astro.build/config
export default defineConfig({
// Enable Custom Markdown options, plugins, etc.
markdownOptions: {
render: [
astroRemark,
{
remarkPlugins: ['remark-code-titles'],
rehypePlugins: [['rehype-autolink-headings', { behavior: 'prepend' }], ['rehype-toc', { headings: ['h2', 'h3'] }], [addClasses, { 'h1,h2,h3': 'title' }], 'rehype-slug'],
},
],
markdown: {
remarkPlugins: ['remark-code-titles'],
rehypePlugins: [['rehype-autolink-headings', { behavior: 'prepend' }], ['rehype-toc', { headings: ['h2', 'h3'] }], [addClasses, { 'h1,h2,h3': 'title' }], 'rehype-slug'],
},
});
22 changes: 8 additions & 14 deletions examples/with-markdown-shiki/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import { defineConfig } from 'astro/config';
import astroRemark from '@astrojs/markdown-remark';

// https://astro.build/config
export default defineConfig({
// Enable Custom Markdown options, plugins, etc.
markdownOptions: {
render: [
astroRemark,
{
syntaxHighlight: 'shiki',
shikiConfig: {
theme: 'dracula',
// Learn more about this configuration here:
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
},
},
],
},
markdown: {
syntaxHighlight: 'shiki',
shikiConfig: {
theme: 'dracula',
// Learn more about this configuration here:
// https://docs.astro.build/en/guides/markdown-content/#syntax-highlighting
},
}
});
Loading

0 comments on commit 17c0292

Please sign in to comment.