Skip to content

Commit 3fefb0f

Browse files
chore: update next to 5.4.0
1 parent 6905215 commit 3fefb0f

File tree

9 files changed

+162
-8
lines changed

9 files changed

+162
-8
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [5.4.0](https://github.com/t3-oss/create-t3-app/compare/v5.3.0...v5.4.0) (2022-08-02)
6+
7+
### Features
8+
9+
- add deployment strategy to generated README ([#258](https://github.com/t3-oss/create-t3-app/issues/258)) ([c7d4dce](https://github.com/t3-oss/create-t3-app/commit/c7d4dce182b1c306dc2a41d42483994c336843f4))
10+
- set appName to directory on 'npx create-t3-app .' ([#273](https://github.com/t3-oss/create-t3-app/issues/273)) ([2179f2d](https://github.com/t3-oss/create-t3-app/commit/2179f2d38f74de0e3fda5661f5125d049eb4d238))
11+
12+
### Bug Fixes
13+
14+
- height on small screens ([#256](https://github.com/t3-oss/create-t3-app/issues/256)) ([fe86915](https://github.com/t3-oss/create-t3-app/commit/fe86915ced72dc979e5fe68bd56b038d9c714928))
15+
- missing next-auth types ([#255](https://github.com/t3-oss/create-t3-app/issues/255)) ([ed42629](https://github.com/t3-oss/create-t3-app/commit/ed42629be5fb9be72abd40bbe784f2bda99eec99)), closes [#254](https://github.com/t3-oss/create-t3-app/issues/254)
16+
- **prisma:** make db changes for next-auth on mysql obvious ([#275](https://github.com/t3-oss/create-t3-app/issues/275)) ([e9507c8](https://github.com/t3-oss/create-t3-app/commit/e9507c887e135f3e44357c618689f5cdb2f13c43))
17+
518
## [5.3.0](https://github.com/t3-oss/create-t3-app/compare/v5.2.1...v5.3.0) (2022-07-25)
619

720
### Features

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-t3-app",
3-
"version": "5.3.0-next.1",
3+
"version": "5.4.0-next.1",
44
"description": "Create web application with the t3 stack",
55
"author": "Shoubhit Dash <[email protected]>",
66
"license": "MIT",

src/installers/next-auth.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export const nextAuthInstaller: Installer = ({ projectDir, packages }) => {
3232
);
3333

3434
const nextAuthDefinitionSrc = path.join(nextAuthAssetDir, "next-auth.d.ts");
35-
const nextAuthDefinitionDest = path.join(projectDir, "next-auth.d.ts");
35+
const nextAuthDefinitionDest = path.join(
36+
projectDir,
37+
"src/types/next-auth.d.ts",
38+
);
3639

3740
fs.copySync(apiHandlerSrc, apiHandlerDest);
3841
fs.copySync(restrictedApiSrc, restrictedApiDest);

src/utils/parseNameAndPath.ts

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Parses the appName and its path from the user input.
33
* Returns an array of [appName, path] where appName is the name put in the package.json and
44
* path is the path to the directory where the app will be created.
5+
* If the appName is '.', the name of the directory will be used instead.
56
* Handles the case where the input includes a scoped package name
67
* in which case that is being parsed as the name, but not included as the path
78
* e.g. dir/@mono/app => ["@mono/app", "dir/app"]
@@ -12,6 +13,11 @@ export const parseNameAndPath = (input: string) => {
1213

1314
let appName = paths[paths.length - 1];
1415

16+
// If the user ran `npx create-t3-app .` or similar, the appName should be the current directory
17+
if (appName === ".") {
18+
appName = process.cwd().split("/").pop();
19+
}
20+
1521
// If the first part is a @, it's a scoped package
1622
const indexOfDelimiter = paths.findIndex((p) => p.startsWith("@"));
1723
if (paths.findIndex((p) => p.startsWith("@")) !== -1) {

template/addons/prisma/auth-schema.prisma

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ generator client {
77

88
datasource db {
99
provider = "sqlite"
10+
// NOTE: When using postgresql, mysql or sqlserver, uncomment the @db.text annotations in model Account below
11+
// Further reading:
12+
// https://next-auth.js.org/adapters/prisma#create-the-prisma-schema
13+
// https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#string
1014
url = env("DATABASE_URL")
1115
}
1216

@@ -21,12 +25,12 @@ model Account {
2125
type String
2226
provider String
2327
providerAccountId String
24-
refresh_token String?
25-
access_token String?
28+
refresh_token String? // @db.text
29+
access_token String? // @db.text
2630
expires_at Int?
2731
token_type String?
2832
scope String?
29-
id_token String?
33+
id_token String? // @db.text
3034
session_state String?
3135
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
3236

template/base/README.md

+128
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,131 @@
11
# Create T3 App
22

33
This is an app bootstrapped according to the [init.tips](https://init.tips) stack, also known as the T3-Stack.
4+
5+
## Why are there `.js` files in here?
6+
7+
As per [T3-Axiom #3](https://github.com/t3-oss/create-t3-app/tree/next#3-typesafety-isnt-optional), we believe take typesafety as a first class citizen. Unfortunately, not all frameworks and plugins support TypeScript which means some of the configuration files have to be `.js` files.
8+
9+
We try to emphasize that these files are javascript for a reason, by explicitly declaring its type (`cjs` or `mjs`) depending on what's supported by the library it is used by. Also, all the `js` files in this project are still typechecked using a `@ts-check` comment at the top.
10+
11+
## What's next? How do I make an app with this?
12+
13+
We try to keep this project as simple as possible, so you can start with the most basic configuration and then move on to more advanced configuration.
14+
15+
If you are not familiar with the different technologies used in this project, please refer to the respective docs. If you still are in the wind, please join our [Discord](https://t3.gg/discord) and ask for help.
16+
17+
- [Next-Auth.js](https://next-auth.js.org)
18+
- [Prisma](https://prisma.io)
19+
- [TailwindCSS](https://tailwindcss.com)
20+
- [tRPC](https://trpc.io) (using @next version? [see v10 docs here](https://alpha.trpc.io))
21+
22+
## How do I deploy this?
23+
24+
### Vercel
25+
26+
We recommend deploying to [Vercel](https://vercel.com/?utm_source=t3-oss&utm_campaign=oss). It makes it super easy to deploy NextJs apps.
27+
28+
- Push your code to a GitHub repository.
29+
- Go to [Vercel](https://vercel.com/?utm_source=t3-oss&utm_campaign=oss) and sign up with GitHub.
30+
- Create a Project and import the repository you pushed your code to.
31+
- Add your environment variables.
32+
- Click **Deploy**
33+
- Now whenever you push a change to your repository, Vercel will automatically redeploy your website!
34+
35+
### Docker
36+
37+
You can also dockerize this stack and deploy a container.
38+
39+
1. In your [next.config.mjs](./next.config.mjs), add the `output: "standalone"` option to your config.
40+
2. Create a `.dockerignore` file with the following contents:
41+
<details>
42+
<summary>.dockerignore</summary>
43+
44+
```
45+
Dockerfile
46+
.dockerignore
47+
node_modules
48+
npm-debug.log
49+
README.md
50+
.next
51+
.git
52+
```
53+
54+
</details>
55+
56+
3. Create a `Dockerfile` with the following contents:
57+
<details>
58+
<summary>Dockerfile</summary>
59+
60+
```Dockerfile
61+
# Install dependencies only when needed
62+
FROM node:16-alpine AS deps
63+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
64+
RUN apk add --no-cache libc6-compat
65+
WORKDIR /app
66+
67+
# Install dependencies based on the preferred package manager
68+
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
69+
RUN \
70+
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
71+
elif [ -f package-lock.json ]; then npm ci; \
72+
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i; \
73+
else echo "Lockfile not found." && exit 1; \
74+
fi
75+
76+
77+
# Rebuild the source code only when needed
78+
FROM node:16-alpine AS builder
79+
WORKDIR /app
80+
COPY --from=deps /app/node_modules ./node_modules
81+
COPY . .
82+
83+
# Next.js collects completely anonymous telemetry data about general usage.
84+
# Learn more here: https://nextjs.org/telemetry
85+
# Uncomment the following line in case you want to disable telemetry during the build.
86+
# ENV NEXT_TELEMETRY_DISABLED 1
87+
88+
RUN yarn build
89+
90+
# If using npm comment out above and use below instead
91+
# RUN npm run build
92+
93+
# Production image, copy all the files and run next
94+
FROM node:16-alpine AS runner
95+
WORKDIR /app
96+
97+
ENV NODE_ENV production
98+
# Uncomment the following line in case you want to disable telemetry during runtime.
99+
# ENV NEXT_TELEMETRY_DISABLED 1
100+
101+
RUN addgroup --system --gid 1001 nodejs
102+
RUN adduser --system --uid 1001 nextjs
103+
104+
# You only need to copy next.config.js if you are NOT using the default configuration
105+
# COPY --from=builder /app/next.config.js ./
106+
COPY --from=builder /app/public ./public
107+
COPY --from=builder /app/package.json ./package.json
108+
109+
# Automatically leverage output traces to reduce image size
110+
# https://nextjs.org/docs/advanced-features/output-file-tracing
111+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
112+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
113+
114+
USER nextjs
115+
116+
EXPOSE 3000
117+
118+
ENV PORT 3000
119+
120+
CMD ["node", "server.js"]
121+
```
122+
123+
</details>
124+
125+
4. You can now build an image to deploy yourself, or use a PaaS such as [Railway's](https://railway.app) automated [Dockerfile deployments](https://docs.railway.app/deploy/dockerfiles) to deploy your app.
126+
127+
## Useful resources
128+
129+
Here are some resources that we commonly refer to:
130+
131+
- [Protecting routes with Next-Auth.js](https://next-auth.js.org/configuration/nextjs#unstable_getserversession)

template/page-studs/index/with-auth-trpc-tw.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const Home: NextPage = () => {
1313
<meta name="description" content="Generated by create-t3-app" />
1414
<link rel="icon" href="/favicon.ico" />
1515
</Head>
16-
<main className="container flex flex-col items-center justify-center h-screen p-4 mx-auto">
16+
<main className="container flex flex-col items-center justify-center min-h-screen p-4 mx-auto">
1717
<h1 className="text-5xl md:text-[5rem] leading-normal font-extrabold text-gray-700">
1818
Create <span className="text-purple-300">T3</span> App
1919
</h1>

template/page-studs/index/with-trpc-tw.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Home: NextPage = () => {
1212
<meta name="description" content="Generated by create-t3-app" />
1313
<link rel="icon" href="/favicon.ico" />
1414
</Head>
15-
<main className="container flex flex-col items-center justify-center h-screen p-4 mx-auto">
15+
<main className="container flex flex-col items-center justify-center min-h-screen p-4 mx-auto">
1616
<h1 className="text-5xl md:text-[5rem] leading-normal font-extrabold text-gray-700">
1717
Create <span className="text-purple-300">T3</span> App
1818
</h1>

template/page-studs/index/with-tw.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Home: NextPage = () => {
99
<meta name="description" content="Generated by create-t3-app" />
1010
<link rel="icon" href="/favicon.ico" />
1111
</Head>
12-
<main className="container flex flex-col items-center justify-center h-screen p-4 mx-auto">
12+
<main className="container flex flex-col items-center justify-center min-h-screen p-4 mx-auto">
1313
<h1 className="text-5xl md:text-[5rem] leading-normal font-extrabold text-gray-700">
1414
Create <span className="text-purple-300">T3</span> App
1515
</h1>

0 commit comments

Comments
 (0)