Skip to content

Commit 70abb5e

Browse files
committed
update 03-boilerplate
1 parent 0292836 commit 70abb5e

7 files changed

Lines changed: 39 additions & 40 deletions

File tree

04-frameworks/08-nextjs/03-boilerplate/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
# 03 Boilerplate
22

3-
Next.js is unopinionated about how you [organize your project](https://nextjs.org/docs/app/building-your-application/routing/colocation) but it gives you some features to avoid create unnecessary routes like:
3+
Next.js is unopinionated about how you [organize your project](https://nextjs.org/docs/app/getting-started/project-structure) but it gives you some features to avoid create unnecessary routes like:
44

5-
- [src directory](https://nextjs.org/docs/app/building-your-application/routing/colocation#src-directory)
5+
- [src directory](https://nextjs.org/docs/app/getting-started/project-structure#src-folder)
66

7-
- [Store project files outside of app](https://nextjs.org/docs/app/building-your-application/routing/colocation#store-project-files-outside-of-app)
7+
- [Store project files outside of app](https://nextjs.org/docs/app/getting-started/project-structure#store-project-files-outside-of-app)
88

9-
- [Private folders](https://nextjs.org/docs/app/building-your-application/routing/colocation#private-folders) using underscore as prefix: `_folderName`.
9+
- [Private folders](https://nextjs.org/docs/app/getting-started/project-structure#private-folders) using underscore as prefix: `_folderName`.
1010

11-
- [Route groups](https://nextjs.org/docs/app/building-your-application/routing/colocation#route-groups): `(folderName)` to groups several routes under the same folder without create a new group route.
11+
- [Route groups](https://nextjs.org/docs/app/getting-started/project-structure#route-groups): `(folderName)` to groups several routes under the same folder without create a new group route.
1212

1313
- [Image component](https://nextjs.org/docs/app/api-reference/components/image) in `./src/app/cars/layout.tsx`, differences with `<img style={{ width: 32, height: 'auto' }} src="/home-logo.png" />`.
14+
1415
- If we use `img` it downloads the full image and resizes it in the browser: ~214kB.
1516
- If we use `Image` component it downloads the image with the size we need: ~3.2kB.
1617
- Try `Image` component with `blurDataURL="/home-logo-low-resolution.png"` and `placeholder="blur"`.
1718

1819
- [Using fonts](https://nextjs.org/docs/app/building-your-application/optimizing/fonts)
20+
1921
- [Font display values](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display#values)
2022

21-
- [Working on support emotion and MUI](https://nextjs.org/docs/app/building-your-application/styling/css-in-js)
23+
- [CSS-in-JS support](https://nextjs.org/docs/app/building-your-application/styling/css-in-js)
2224

2325
- [Material Icons discussion](https://github.com/vercel/next.js/discussions/42881)
2426

25-
- [Module aliases](https://nextjs.org/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases#module-aliases)
26-
27+
- [Module aliases](https://nextjs.org/docs/app/getting-started/installation#set-up-absolute-imports-and-module-path-aliases)
2728

2829
# About Basefactor + Lemoncode
2930

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
import "./.next/dev/types/routes.d.ts";
34

45
// NOTE: This file should not be edited
56
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
{
2-
"name": "07-nextjs-examples",
2+
"name": "nextjs-examples",
33
"version": "1.0.0",
44
"description": "Nextjs examples",
5+
"type": "module",
6+
"imports": {
7+
"#*": "./src/*"
8+
},
59
"scripts": {
610
"start": "next dev",
7-
"build": "rimraf .next && next build",
11+
"build": "next build",
812
"start:prod": "next start -p 8080",
913
"start:api-server": "cd api-server && npm run mock-server",
1014
"postinstall": "cd ./api-server && npm install"
1115
},
12-
"imports": {
13-
"#*": "./src/*"
14-
},
1516
"author": "Lemoncode",
1617
"license": "MIT",
1718
"dependencies": {
18-
"next": "^15.1.6",
19+
"next": "^16.0.10",
1920
"normalize.css": "^8.0.1",
20-
"react": "^19.0.0",
21-
"react-dom": "^19.0.0",
22-
"sharp": "^0.33.5"
21+
"react": "^19.2.3",
22+
"react-dom": "^19.2.3",
23+
"sharp": "^0.34.5"
2324
},
2425
"devDependencies": {
25-
"@types/node": "22.13.1",
26-
"@types/react": "^19.0.8",
27-
"@types/react-dom": "^19.0.3",
26+
"@types/node": "25.0.1",
27+
"@types/react": "^19.2.7",
28+
"@types/react-dom": "^19.2.3",
2829
"npm-run-all": "^4.1.5",
29-
"rimraf": "^6.0.1",
30-
"typescript": "^5.7.3"
30+
"typescript": "^5.9.3"
3131
}
3232
}

04-frameworks/08-nextjs/03-boilerplate/src/app/cars/[carId]/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import React from 'react';
22
import { Metadata } from 'next';
33

44
interface Props {
5-
params: { carId: string };
5+
params: Promise<{ carId: string }>;
66
}
77

88
export const generateMetadata = async (props: Props): Promise<Metadata> => {
9-
const { params } = props;
9+
const params = await props.params;
1010
return {
1111
title: `Rent a car - Car ${params.carId} details`,
1212
};
1313
};
1414

15-
const CarPage = (props: Props) => {
16-
const { params } = props;
15+
const CarPage = async (props: Props) => {
16+
const params = await props.params;
1717
return (
1818
<>
1919
<h2>Car detail page</h2>

04-frameworks/08-nextjs/03-boilerplate/src/app/layout.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { Inter } from 'next/font/google';
12
import 'normalize.css';
2-
import './material-icons.css';
33
import React from 'react';
4-
import { Inter } from 'next/font/google';
4+
import './material-icons.css';
55

66
const inter = Inter({
77
subsets: ['latin'],
@@ -16,7 +16,9 @@ const RootLayout = (props: Props) => {
1616
const { children } = props;
1717
return (
1818
<html lang="en" className={inter.className}>
19-
<body>{children}</body>
19+
<body>
20+
<main>{children}</main>
21+
</body>
2022
</html>
2123
);
2224
};

04-frameworks/08-nextjs/03-boilerplate/src/app/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import React from 'react';
2-
import Link from 'next/link';
31
import { Metadata } from 'next';
2+
import Link from 'next/link';
43

54
export const metadata: Metadata = {
65
title: 'Rent a car - Home',

04-frameworks/08-nextjs/03-boilerplate/tsconfig.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"target": "ES2017",
34
"lib": [
45
"dom",
56
"dom.iterable",
@@ -15,23 +16,18 @@
1516
"moduleResolution": "node",
1617
"resolveJsonModule": true,
1718
"isolatedModules": true,
18-
"jsx": "preserve",
19+
"jsx": "react-jsx",
1920
"plugins": [
2021
{
2122
"name": "next"
2223
}
23-
],
24-
"baseUrl": ".",
25-
"paths": {
26-
"#*": [
27-
"./src/*"
28-
]
29-
},
30-
"target": "ES2017"
24+
]
3125
},
3226
"include": [
3327
"next-env.d.ts",
3428
".next/types/**/*.ts",
29+
".next/dev/types/**/*.ts",
30+
"**/*.mts",
3531
"**/*.ts",
3632
"**/*.tsx"
3733
],

0 commit comments

Comments
 (0)