Skip to content

Commit

Permalink
Update Next.js to v15 (#792)
Browse files Browse the repository at this point in the history
* bump caniuse db

https://github.com/browserslist/browserslist#browsers-data-updating

* fix sed command to work with both GNU and MacOS sed

The sed command which replaces the markdown import in the api.js file
was not working on MacOS because the `-i` flag requires an argument
with the backup file extension. This commit adds the `.bak` extension
to the sed command to make it work on both GNU and MacOS sed (and then
removes the backup file).

* Update to next.js 14

- "next build export" is replaced with an output config option
  https://nextjs.org/docs/app/building-your-application/deploying/static-exports
- "next start" is not compatible with static exports and has been
  removed from the package scripts
- blog rss feed is now generated to out/blog/index.xml instead of
  _next/static/feed.xml to work with the default output and the redirect
  in netlify.toml has been reversed so that rss feed requests are
  redirected to the new location

* Upgrade to nextjs 15

- Use turbopack instead of webpack
- User typescript instead of js for next config
- silence deprecation warnings on bulma sass problems.
  Bulma 1.0.2 breaks a bunch of things that worked in 0.8
  so it's difficult to update to without changing how the site
  looks.
  • Loading branch information
joshka authored Oct 28, 2024
1 parent 6f9c24c commit a79b684
Show file tree
Hide file tree
Showing 9 changed files with 951 additions and 329 deletions.
6 changes: 1 addition & 5 deletions components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ const Layout: FC<Props> = ({ title, blog, children }) => (
></meta>
<link rel="alternate icon" type="image/png" href="/favicon-32x32.png" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link
rel="alternate"
type="application/rss+xml"
href="/_next/static/feed.xml"
/>
<link rel="alternate" type="application/rss+xml" href="/blog/index.xml" />
</Head>
<main className={roboto.className}>
<Navigation blog={blog} />
Expand Down
37 changes: 18 additions & 19 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Settings in the [build] context are global and are applied to all contexts
# unless otherwise overridden by more specific contexts.
[build]
# Directory that contains the deploy-ready HTML files and assets generated by
# the build. This is relative to the base directory if one has been set, or the
# root directory if a base has not been set. This sample publishes the
# directory located at the absolute path "root/project/build-output"
publish = "out/"
# Directory that contains the deploy-ready HTML files and assets generated by
# the build. This is relative to the base directory if one has been set, or the
# root directory if a base has not been set. This sample publishes the
# directory located at the absolute path "root/project/build-output"
publish = "out/"

# Default build command.
command = "npm run build"
# Default build command.
command = "npm run build"

[build.environment]
# Environment variables are set here
# Environment variables are set here

NODE_VERSION = "20.18.0"
NODE_VERSION = "20.18.0"

# For apps that use next export to generate static HTML
# set the NETLIFY_NEXT_PLUGIN_SKIP to true.
NETLIFY_NEXT_PLUGIN_SKIP="true"
# For apps that use next export to generate static HTML
# set the NETLIFY_NEXT_PLUGIN_SKIP to true.
NETLIFY_NEXT_PLUGIN_SKIP = "true"

# Redirects and headers are GLOBAL for all builds – they do not get scoped to
# contexts no matter where you define them in the file.
Expand All @@ -26,16 +26,15 @@

# A basic redirect rule
[[redirects]]
from = "/docs/overview"
to = "/tokio/tutorial"
from = "/docs/overview"
to = "/tokio/tutorial"

# Redirect previous rss feed location
[[redirects]]
from = "/blog/index.xml"
to = "/_next/static/feed.xml"
from = "/_next/static/feed.xml"
to = "/blog/index.xml"

# The bridging article was moved from tutorial to topics
[[redirects]]
from = "/tokio/tutorial/bridging"
to = "/tokio/topics/bridging"

from = "/tokio/tutorial/bridging"
to = "/tokio/topics/bridging"
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
12 changes: 0 additions & 12 deletions next.config.js

This file was deleted.

19 changes: 19 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
output: "export",
sassOptions: {
// bulma 0.8 has a bunch of future deprecations, but the next version breaks a lot of stuff
// so we ignore the deprecation warnings here. These
silenceDeprecations: [
"color-functions",
"import",
"global-builtin",
"legacy-js-api",
"slash-div",
],
quietDeps: true,
},
};

export default nextConfig;
Loading

0 comments on commit a79b684

Please sign in to comment.