Skip to content

Commit 47e588a

Browse files
committed
env: Next.js + TypeScript 기본 프로젝트 설정
1 parent dd339e5 commit 47e588a

File tree

9 files changed

+166
-0
lines changed

9 files changed

+166
-0
lines changed

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel
35+
36+
# typescript
37+
*.tsbuildinfo

next-env.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

next.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
reactStrictMode: true,
4+
};
5+
6+
module.exports = nextConfig;

pages/_app.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { AppProps } from 'next/app';
2+
import { ThemeProvider } from 'styled-components';
3+
import GlobalStyle from 'styles/global-styles';
4+
import theme from 'styles/theme';
5+
import media from 'styles/media';
6+
7+
function App({ Component, pageProps }: AppProps) {
8+
return (
9+
<ThemeProvider theme={{ ...theme, ...media }}>
10+
<GlobalStyle />
11+
<Component {...pageProps} />
12+
</ThemeProvider>
13+
);
14+
}
15+
16+
export default App;

pages/_document.tsx

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import Document, {
2+
DocumentContext,
3+
Html,
4+
Head,
5+
Main,
6+
NextScript,
7+
} from 'next/document';
8+
import { ServerStyleSheet } from 'styled-components';
9+
10+
export default class MyDocument extends Document {
11+
// Styled Components용 코드
12+
static async getInitialProps(ctx: DocumentContext) {
13+
const sheet = new ServerStyleSheet();
14+
const originalRenderPage = ctx.renderPage;
15+
16+
try {
17+
ctx.renderPage = () =>
18+
originalRenderPage({
19+
enhanceApp: (App) => (props) =>
20+
sheet.collectStyles(<App {...props} />),
21+
});
22+
23+
const initialProps = await Document.getInitialProps(ctx);
24+
return {
25+
...initialProps,
26+
styles: (
27+
<>
28+
{initialProps.styles}
29+
{sheet.getStyleElement()}
30+
</>
31+
),
32+
};
33+
} finally {
34+
sheet.seal();
35+
}
36+
}
37+
38+
render() {
39+
return (
40+
<Html>
41+
<Head>
42+
{/* SEO 용 */}
43+
<title>YAPP</title>
44+
<meta name="description" content="YAPP 공식사이트" />
45+
<meta content="width=device-width, initial-scale=1" name="viewport" />
46+
<link rel="icon" href="/favicon.ico" />
47+
{/* 폰트 */}
48+
<link
49+
rel="stylesheet"
50+
type="text/css"
51+
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css"
52+
/>
53+
</Head>
54+
<body>
55+
<Main />
56+
<NextScript />
57+
</body>
58+
</Html>
59+
);
60+
}
61+
}

pages/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { NextPage } from 'next';
2+
import styled from 'styled-components';
3+
4+
const Home: NextPage = () => {
5+
return <Wrapper>Home Component</Wrapper>;
6+
};
7+
8+
const Wrapper = styled.div`
9+
width: 100%;
10+
height: 100vh;
11+
12+
font-size: 10rem;
13+
font-weight: 800;
14+
`;
15+
16+
export default Home;

public/favicon.ico

25.3 KB
Binary file not shown.

public/vercel.svg

Lines changed: 4 additions & 0 deletions
Loading

tsconfig.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": true,
8+
"forceConsistentCasingInFileNames": true,
9+
"noEmit": true,
10+
"esModuleInterop": true,
11+
"baseUrl": "./",
12+
"module": "esnext",
13+
"moduleResolution": "node",
14+
"resolveJsonModule": true,
15+
"isolatedModules": true,
16+
"jsx": "preserve",
17+
"incremental": true
18+
},
19+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
20+
"exclude": ["node_modules"]
21+
}

0 commit comments

Comments
 (0)