Skip to content

Commit

Permalink
Support Astro v3 (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis authored Sep 1, 2023
1 parent 3c3e828 commit 7b75b3e
Show file tree
Hide file tree
Showing 24 changed files with 494 additions and 722 deletions.
7 changes: 7 additions & 0 deletions .changeset/stale-owls-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/starlight-tailwind': major
---

Bump minimum required Astro version to 3.0

⚠️ **BREAKING CHANGE** Astro v2 is no longer supported. Make sure you update [Astro](https://docs.astro.build/en/guides/upgrade-to/v3/), [Starlight](https://starlight.astro.build/getting-started/#updating-starlight), and any other integrations at the same time as updating the Tailwind plugin.
7 changes: 7 additions & 0 deletions .changeset/thirty-plums-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/starlight': minor
---

Bump minimum required Astro version to 3.0

⚠️ **BREAKING CHANGE** Astro v2 is no longer supported. Make sure you [update Astro](https://docs.astro.build/en/guides/upgrade-to/v3/) and any other integrations at the same time as updating Starlight.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

env:
NODE_VERSION: 16
NODE_VERSION: 18

jobs:
unit-test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'
- run: pnpm i
- name: Format with Prettier
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'pnpm'

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ cd docs
pnpm dev
```

You should then be able to open <http://localhost:3000> and see your changes.
You should then be able to open <http://localhost:4321> and see your changes.

> **Note**
> Changes to the Starlight integration will require you to quit and restart the dev server to take effect.
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :---------------------- | :----------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:3000` |
| `pnpm run dev` | Starts local dev server at `localhost:4321` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
Expand Down
8 changes: 4 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"type": "module",
"version": "0.0.1",
"scripts": {
"test": "start-server-and-test preview http://localhost:3000 pa11y",
"pa11y": "pa11y-ci --sitemap 'http://localhost:3000/sitemap-index.xml' --sitemap-find 'https://starlight.astro.build' --sitemap-replace 'http://localhost:3000' --sitemap-exclude '/(de|zh|fr|es|pt-br|it)/.*'",
"test": "start-server-and-test preview http://localhost:4321 pa11y",
"pa11y": "pa11y-ci --sitemap 'http://localhost:4321/sitemap-index.xml' --sitemap-find 'https://starlight.astro.build' --sitemap-replace 'http://localhost:4321' --sitemap-exclude '/(de|zh|fr|es|pt-br|it|ko)/.*'",
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
Expand All @@ -15,9 +15,9 @@
"dependencies": {
"@astrojs/starlight": "workspace:*",
"@types/culori": "^2.0.0",
"astro": "^2.10.5",
"astro": "^3.0.6",
"culori": "^3.2.0",
"sharp": "^0.32.3"
"sharp": "^0.32.5"
},
"devDependencies": {
"hast-util-from-html": "^1.0.2",
Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/showcase-card.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ interface Props {
const { href, title } = Astro.props;
const thumbnails = import.meta.glob<{ default: ImageMetadata }>(
'~/assets/showcase/*{.png,.jpg,.jpeg,.webp,.avif}'
'../assets/showcase/*{.png,.jpg,.jpeg,.webp,.avif}'
);
const thumbnail = thumbnails[`/src/assets/showcase/${Astro.props.thumbnail}`];
const thumbnail = thumbnails[`../assets/showcase/${Astro.props.thumbnail}`];
if (!thumbnail) {
throw new Error(`Could not resolve showcase thumbnail: ${Astro.props.thumbnail}`);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client-image" />
/// <reference types="astro/client" />
2 changes: 1 addition & 1 deletion examples/basics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
Expand Down
4 changes: 2 additions & 2 deletions examples/basics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@astrojs/starlight": "^0.8.1",
"astro": "^2.10.5",
"sharp": "^0.32.3"
"astro": "^3.0.6",
"sharp": "^0.32.5"
}
}
2 changes: 1 addition & 1 deletion examples/basics/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client-image" />
/// <reference types="astro/client" />
2 changes: 1 addition & 1 deletion examples/tailwind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
Expand Down
6 changes: 3 additions & 3 deletions examples/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"dependencies": {
"@astrojs/starlight": "^0.8.1",
"@astrojs/starlight-tailwind": "^1.0.2",
"@astrojs/tailwind": "^4.0.0",
"astro": "^2.10.3",
"sharp": "^0.32.3",
"@astrojs/tailwind": "^5.0.0",
"astro": "^3.0.6",
"sharp": "^0.32.5",
"tailwindcss": "^3.3.3"
}
}
2 changes: 1 addition & 1 deletion examples/tailwind/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client-image" />
/// <reference types="astro/client" />
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.1",
"@size-limit/file": "^8.2.4",
"astro": "^2.10.5",
"astro": "^3.0.6",
"prettier": "^3.0.0",
"prettier-plugin-astro": "^0.11.0",
"size-limit": "^8.2.4"
Expand Down
9 changes: 2 additions & 7 deletions packages/starlight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { starlightAsides } from './integrations/asides';
import { starlightSitemap } from './integrations/sitemap';
import { vitePluginStarlightUserConfig } from './integrations/virtual-user-config';
import { errorMap } from './utils/error-map';
import { StarlightConfigSchema, StarlightUserConfig } from './utils/user-config';
import { StarlightConfigSchema, type StarlightUserConfig } from './utils/user-config';
import { rehypeRtlCodeSupport } from './integrations/code-rtl-support';

export default function StarlightIntegration(opts: StarlightUserConfig): AstroIntegration[] {
Expand Down Expand Up @@ -45,12 +45,7 @@ export default function StarlightIntegration(opts: StarlightUserConfig): AstroIn
// Configure Shiki theme if the user is using the default github-dark theme.
config.markdown.shikiConfig.theme !== 'github-dark' ? {} : { theme: 'css-variables' },
},
build: { inlineStylesheets: 'auto' },
experimental: {
assets: true,
// @ts-ignore - Needed for older versions of Astro, but an error since astro@2.6.0
inlineStylesheets: 'auto',
},
scopedStyleStrategy: 'where',
};
updateConfig(newConfig);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/starlight/integrations/asides.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AstroUserConfig } from 'astro';
import { h as _h, s as _s, Properties } from 'hastscript';
import { h as _h, s as _s, type Properties } from 'hastscript';
import type { Paragraph as P, Root } from 'mdast';
import remarkDirective from 'remark-directive';
import type { Plugin, Transformer } from 'unified';
Expand Down
2 changes: 1 addition & 1 deletion packages/starlight/integrations/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sitemap, { SitemapOptions } from '@astrojs/sitemap';
import sitemap, { type SitemapOptions } from '@astrojs/sitemap';
import type { StarlightConfig } from '../types';

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/starlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"./404.astro": "./404.astro"
},
"peerDependencies": {
"astro": "^2.5.0"
"astro": "^3.0.0"
},
"devDependencies": {
"@types/node": "^18.16.19",
"@vitest/coverage-v8": "^0.33.0",
"astro": "^2.10.5",
"astro": "^3.0.6",
"vitest": "^0.33.0"
},
"dependencies": {
"@astrojs/mdx": "^0.19.7",
"@astrojs/sitemap": "^1.3.3",
"@astrojs/mdx": "^1.0.0",
"@astrojs/sitemap": "^3.0.0",
"@pagefind/default-ui": "^1.0.0-alpha.5",
"@types/mdast": "^3.0.11",
"bcp-47": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"peerDependencies": {
"@astrojs/starlight": ">=0.7.2",
"@astrojs/tailwind": "^4.0.0",
"@astrojs/tailwind": "^5.0.0",
"tailwindcss": "^3.3.3"
}
}
Loading

0 comments on commit 7b75b3e

Please sign in to comment.