Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Astro 4.7 article #1078

Merged
merged 4 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
70 changes: 70 additions & 0 deletions src/content/blog/astro-470.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: "Astro 4.7"
description: "Astro 4.7 is out now! This release includes major improvements to the API for making toolbar apps, a new way to keep yourself up to date, and more."
publishDate: "April 25, 2024"
authors:
- erika
- ema
- matthew
- nate
- bjorn
Princesseuh marked this conversation as resolved.
Show resolved Hide resolved
coverImage: "/src/content/blog/_images/astro-470/post-header-4.7.webp"
socialImage: "/src/content/blog/_images/astro-470/og-image-4.7.webp"
lang: "en"
---

import BlogSummary from "/src/components/BlogSummary.astro";
import updateCheckerImage from "/src/content/blog/_images/astro-470/update-checker.webp";
import BlogContentImage from "/src/components/BlogContentImage.astro"

<BlogSummary>
Astro 4.7 is now available! This release includes major improvements to the API for making toolbar apps, more ways to keep your Astro project up to date, and more.
</BlogSummary>

Full release highlights include:

- [**Major improvements to the Dev Toolbar API**](#dev-toolbar-api-improvements)
- [**Update checker**](#update-checker)
- [**`allowJs: true` for strictest TypeScript preset**](#allowjs-true-for-strictest-typescript-preset)

To upgrade an existing project, use the automated `@astrojs/upgrade` CLI tool. Alternatively, upgrade manually by running the upgrade command for your package manager:

```sh
# Recommended:
npx @astrojs/upgrade

# Manual:
npm install astro@latest
pnpm upgrade astro --latest
yarn upgrade astro --latest
```

## Dev Toolbar API improvements

Astro 4.7 includes major improvements to the API for making toolbar apps. One of our main goal this release was to make it easier to build and maintain toolbar apps, and we're excited to share these improvements with you!
Princesseuh marked this conversation as resolved.
Show resolved Hide resolved

- `defineToolbarApp` helper that makes it easier to define toolbar apps, this is similar to the `defineConfig` helper for defining Astro config, or `defineMiddleware` for defining middleware.
- `app` and `server` helpers to make it easier to interact with the toolbar and the server.
- New starter project for building toolbar apps, to help you get started building your own toolbar apps in no time. Run `npm create astro@latest -- --template toolbar-app` and start building your toolbar app.
- [Revamped documentation for building toolbar apps](https://docs.astro.build/en/reference/dev-toolbar-app-reference/).
- [All new recipe guiding you through building a toolbar app from scratch](https://docs.astro.build/en/recipes/making-toolbar-apps/), including how to use JSX frameworks like React or Preact in your app.
Princesseuh marked this conversation as resolved.
Show resolved Hide resolved

We hope you'll enjoy these improvements and we can't wait to see what you build with them!

## Update checker

Starting from this release, Astro will now check for updates when you run the dev server. If a new version is available, you'll see a message in the terminal with instructions on how to update and in the dev toolbar.

<BlogContentImage src={updateCheckerImage} alt="A screenshot of the message that Astro shows when an update is available." />
Princesseuh marked this conversation as resolved.
Show resolved Hide resolved

In order to avoid spamming you with update messages, Astro will only check for updates once per 10 days and only if you're multiple versions behind. You can also disable this feature by running `astro preferences disable checkUpdates` or setting the `ASTRO_DISABLE_UPDATE_CHECK` environment variable to `false`.
Princesseuh marked this conversation as resolved.
Show resolved Hide resolved

## `allowJs: true` for strictest TypeScript preset

Our `strictest` TypeScript preset previously included `allowJs: false`, to disable the usage of .js files completely. This proved to be a bit too strict for the average user and often caused confusion. We've now changed this to `allowJs: true`, which allows you to use .js files in your project.

This should not be a breaking change, but if you're using the `strictest` preset and would like to still disable .js files, you can set `allowJs: false` manually in your `tsconfig.json`.
Princesseuh marked this conversation as resolved.
Show resolved Hide resolved

## Bug Fixes

As it is known, Astro 4.7 includes more bug fixes and smaller improvements that couldn't make it into this post! Check out the full [release notes](https://github.com/withastro/astro/blob/refs/heads/main/packages/astro/CHANGELOG.md#470) to learn more.
sarah11918 marked this conversation as resolved.
Show resolved Hide resolved