| 
1 | 1 | # TypeScript in the browser  | 
2 | 2 | 
 
  | 
3 |  | -If you are using TypeScript to create a web application here are my recommendations to get a quick TypeScript + React (my UI framework of choice) project setup.  | 
 | 3 | +만약 당신이 타입스크립트를 사용해서 웹 애플리케이션을 만들어야 한다면 나는 타입스크립트 + 리액트 조합으로 프로젝트를 구성하는 것을 추천합니다.  | 
4 | 4 | 
 
  | 
5 |  | -## General Machine Setup  | 
 | 5 | +## 일반적인 프로그램 설정  | 
6 | 6 | 
 
  | 
7 |  | -* Install [Node.js](https://nodejs.org/en/download/)  | 
8 |  | -* Install [Git](https://git-scm.com/downloads)  | 
 | 7 | +- 설치 [Node.js](https://nodejs.org/en/download/)  | 
 | 8 | +- 설치 [Git](https://git-scm.com/downloads)  | 
9 | 9 | 
 
  | 
10 |  | -## Project Setup Quick  | 
11 |  | -Use [https://github.com/basarat/react-typescript](https://github.com/basarat/react-typescript) as a base.   | 
 | 10 | +## 빠르게 프로젝트를 구성  | 
 | 11 | + | 
 | 12 | +다음을 기본으로 구성하십시요 [https://github.com/basarat/react-typescript](https://github.com/basarat/react-typescript)  | 
12 | 13 | 
 
  | 
13 | 14 | ```  | 
14 | 15 | git clone https://github.com/basarat/react-typescript.git  | 
15 | 16 | cd react-typescript  | 
16 | 17 | npm install  | 
17 | 18 | ```  | 
18 | 19 | 
 
  | 
19 |  | -Now jump to [develop your amazing application](#develop-your-amazing-application)  | 
 | 20 | +지금 읽으십시요 [당신은 놀라운 애플리케이션을 개발할 수 있습니다.](#develop-your-amazing-application)  | 
 | 21 | + | 
 | 22 | +## 프로젝트를 구성하는 자세한 방법  | 
20 | 23 | 
 
  | 
21 |  | -## Project Setup Detailed  | 
22 |  | -To see how that project is created, its documented below.  | 
 | 24 | +프로젝트를 어떻게 생성해야 하는지는 아래 문서에 있습니다.  | 
23 | 25 | 
 
  | 
24 |  | -* Create a project dir:  | 
 | 26 | +- 프로젝트 폴더를 생성  | 
25 | 27 | 
 
  | 
26 | 28 | ```  | 
27 | 29 | mkdir your-project  | 
28 | 30 | cd your-project  | 
29 | 31 | ```  | 
30 | 32 | 
 
  | 
31 |  | -* Create `tsconfig.json`:  | 
 | 33 | +-  Create `tsconfig.json`:  | 
32 | 34 | 
 
  | 
33 | 35 | ```json  | 
34 | 36 | {  | 
35 |  | - "compilerOptions": {  | 
36 |  | - "sourceMap": true,  | 
37 |  | - "module": "commonjs",  | 
38 |  | - "esModuleInterop": true,  | 
39 |  | - "resolveJsonModule": true,  | 
40 |  | - "experimentalDecorators": true,  | 
41 |  | - "target": "es5",  | 
42 |  | - "jsx": "react",  | 
43 |  | - "lib": [  | 
44 |  | - "dom",  | 
45 |  | - "es6"  | 
46 |  | - ]  | 
47 |  | - },  | 
48 |  | - "include": [  | 
49 |  | - "src"  | 
50 |  | - ],  | 
51 |  | - "compileOnSave": false  | 
 | 37 | + "compilerOptions": {  | 
 | 38 | + "sourceMap": true,  | 
 | 39 | + "module": "commonjs",  | 
 | 40 | + "esModuleInterop": true,  | 
 | 41 | + "resolveJsonModule": true,  | 
 | 42 | + "experimentalDecorators": true,  | 
 | 43 | + "target": "es5",  | 
 | 44 | + "jsx": "react",  | 
 | 45 | + "lib": ["dom", "es6"]  | 
 | 46 | + },  | 
 | 47 | + "include": ["src"],  | 
 | 48 | + "compileOnSave": false  | 
52 | 49 | }  | 
53 | 50 | ```  | 
54 | 51 | 
 
  | 
55 |  | -* Create `package.json`.  | 
 | 52 | +-  Create `package.json`.  | 
56 | 53 | 
 
  | 
57 | 54 | ```json  | 
58 | 55 | {  | 
59 |  | - "name": "react-typescript",  | 
60 |  | - "version": "0.0.0",  | 
61 |  | - "license": "MIT",  | 
62 |  | - "repository": {  | 
63 |  | - "type": "git",  | 
64 |  | - "url": "https://github.com/basarat/react-typescript.git"  | 
65 |  | - },  | 
66 |  | - "scripts": {  | 
67 |  | - "build": "webpack -p",  | 
68 |  | - "start": "webpack-dev-server -d --content-base ./public"  | 
69 |  | - },  | 
70 |  | - "dependencies": {  | 
71 |  | - "@types/react": "16.4.10",  | 
72 |  | - "@types/react-dom": "16.0.7",  | 
73 |  | - "clean-webpack-plugin": "0.1.19",  | 
74 |  | - "html-webpack-plugin": "3.2.0",  | 
75 |  | - "react": "16.4.2",  | 
76 |  | - "react-dom": "16.4.2",  | 
77 |  | - "ts-loader": "4.4.2",  | 
78 |  | - "typescript": "3.0.1",  | 
79 |  | - "webpack": "4.16.5",  | 
80 |  | - "webpack-cli": "3.1.0",  | 
81 |  | - "webpack-dev-server": "3.1.5"  | 
82 |  | - }  | 
 | 56 | +  "name": "react-typescript",  | 
 | 57 | +  "version": "0.0.0",  | 
 | 58 | +  "license": "MIT",  | 
 | 59 | +  "repository": {  | 
 | 60 | +  "type": "git",  | 
 | 61 | +  "url": "https://github.com/basarat/react-typescript.git"  | 
 | 62 | +  },  | 
 | 63 | +  "scripts": {  | 
 | 64 | +  "build": "webpack -p",  | 
 | 65 | +  "start": "webpack-dev-server -d --content-base ./public"  | 
 | 66 | +  },  | 
 | 67 | +  "dependencies": {  | 
 | 68 | +  "@types/react": "16.4.10",  | 
 | 69 | +  "@types/react-dom": "16.0.7",  | 
 | 70 | +  "clean-webpack-plugin": "0.1.19",  | 
 | 71 | +  "html-webpack-plugin": "3.2.0",  | 
 | 72 | +  "react": "16.4.2",  | 
 | 73 | +  "react-dom": "16.4.2",  | 
 | 74 | +  "ts-loader": "4.4.2",  | 
 | 75 | +  "typescript": "3.0.1",  | 
 | 76 | +  "webpack": "4.16.5",  | 
 | 77 | +  "webpack-cli": "3.1.0",  | 
 | 78 | +  "webpack-dev-server": "3.1.5"  | 
 | 79 | +  }  | 
83 | 80 | }  | 
84 | 81 | ```  | 
85 | 82 | 
 
  | 
86 |  | -* Create a `webpack.config.js` to bundle your modules into a single `app.js` file that contains all your resources:  | 
 | 83 | +-  `webpack.config.js`는 당신의 모듈을 번들해서 모든 리소스가 담긴 하나의 `app.js` 파일을 생성할 것 입니다.  | 
87 | 84 | 
 
  | 
88 | 85 | ```js  | 
89 |  | -const CleanWebpackPlugin = require('clean-webpack-plugin');  | 
90 |  | -const HtmlWebpackPlugin = require('html-webpack-plugin');  | 
 | 86 | +const CleanWebpackPlugin = require('clean-webpack-plugin')  | 
 | 87 | +const HtmlWebpackPlugin = require('html-webpack-plugin')  | 
91 | 88 | 
 
  | 
92 | 89 | module.exports = {  | 
93 |  | - entry: './src/app/app.tsx',  | 
94 |  | - plugins: [  | 
95 |  | - new CleanWebpackPlugin(['public/build']),  | 
96 |  | - new HtmlWebpackPlugin({  | 
97 |  | - template: 'src/templates/index.html'  | 
98 |  | - }),  | 
99 |  | - ],  | 
100 |  | - output: {  | 
101 |  | - path: __dirname + '/public',  | 
102 |  | - filename: 'build/[name].[contenthash].js'  | 
103 |  | - },  | 
104 |  | - resolve: {  | 
105 |  | - extensions: ['.ts', '.tsx', '.js']  | 
106 |  | - },  | 
107 |  | - module: {  | 
108 |  | - rules: [  | 
109 |  | - { test: /\.tsx?$/, loader: 'ts-loader' }  | 
110 |  | - ]  | 
111 |  | - }  | 
 | 90 | + entry: './src/app/app.tsx',  | 
 | 91 | + plugins: [  | 
 | 92 | + new CleanWebpackPlugin(['public/build']),  | 
 | 93 | + new HtmlWebpackPlugin({  | 
 | 94 | + template: 'src/templates/index.html'  | 
 | 95 | + })  | 
 | 96 | + ],  | 
 | 97 | + output: {  | 
 | 98 | + path: __dirname + '/public',  | 
 | 99 | + filename: 'build/[name].[contenthash].js'  | 
 | 100 | + },  | 
 | 101 | + resolve: {  | 
 | 102 | + extensions: ['.ts', '.tsx', '.js']  | 
 | 103 | + },  | 
 | 104 | + module: {  | 
 | 105 | + rules: [{ test: /\.tsx?$/, loader: 'ts-loader' }]  | 
 | 106 | + }  | 
112 | 107 | }  | 
113 | 108 | ```  | 
114 | 109 | 
 
  | 
115 |  | -* `src/templates/index.html` file. It will be used as the template for the `index.html` generated by webpack. The generated file will be in the `public` folder and and then served from your webserver:   | 
 | 110 | +- `src/templates/index.html` 파일은 웹팩을 사용하면 `index.html` 이 생성됩니다. 이 파일은 웹 서버내에 `public` 폴더에 생성됩니다.  | 
116 | 111 | 
 
  | 
117 | 112 | ```html  | 
118 | 113 | <html>  | 
119 |  | - <body>  | 
120 |  | - <div id="root"></div>  | 
121 |  | - </body>  | 
 | 114 | +  <body>  | 
 | 115 | +  <div id="root"></div>  | 
 | 116 | +  </body>  | 
122 | 117 | </html>  | 
123 |  | - | 
124 | 118 | ```  | 
125 | 119 | 
 
  | 
126 |  | -* `src/app/app.tsx` that is your frontend application entry point:   | 
 | 120 | +- `src/app/app.tsx` 파일은 당신의 프론트 애플리케이션의 시작 지점입니다.  | 
127 | 121 | 
 
  | 
128 | 122 | ```js  | 
129 |  | -import * as React from 'react';  | 
130 |  | -import * as ReactDOM from 'react-dom';  | 
131 |  | - | 
132 |  | -const Hello: React.FunctionComponent<{ compiler: string, framework: string }> = (props) => {  | 
133 |  | - return (  | 
134 |  | - <div>  | 
135 |  | - <div>{props.compiler}</div>  | 
136 |  | - <div>{props.framework}</div>  | 
137 |  | - </div>  | 
138 |  | - );  | 
 | 123 | +import * as React from 'react'  | 
 | 124 | +import * as ReactDOM from 'react-dom'  | 
 | 125 | + | 
 | 126 | +const Hello: React.FunctionComponent<{  | 
 | 127 | + compiler: string,  | 
 | 128 | + framework: string  | 
 | 129 | +}> = props => {  | 
 | 130 | + return (  | 
 | 131 | + <div>  | 
 | 132 | + <div>{props.compiler}</div>  | 
 | 133 | + <div>{props.framework}</div>  | 
 | 134 | + </div>  | 
 | 135 | + )  | 
139 | 136 | }  | 
140 | 137 | 
 
  | 
141 | 138 | ReactDOM.render(  | 
142 |  | - <Hello compiler="TypeScript" framework="React" />,  | 
143 |  | - document.getElementById("root")  | 
144 |  | -);  | 
 | 139 | +  <Hello compiler="TypeScript" framework="React" />,  | 
 | 140 | +  document.getElementById('root')  | 
 | 141 | +)  | 
145 | 142 | ```  | 
146 | 143 | 
 
  | 
147 |  | -# Develop your amazing application   | 
 | 144 | +# 당신은 놀라운 애플리케이션 개발을 할 수 있습니다.  | 
148 | 145 | 
 
  | 
149 |  | -> You can get the latest packages using `npm install typescript@latest react@latest react-dom@latest @types/react@latest @types/react-dom@latest webpack@latest webpack-dev-server@latest webpack-cli@latest ts-loader@latest clean-webpack-plugin@latest html-webpack-plugin@latest --save-exact`  | 
 | 146 | +> 당신은 최신 패키지를 사용할 수 있습니다. `npm install typescript@latest react@latest react-dom@latest @types/react@latest @types/react-dom@latest webpack@latest webpack-dev-server@latest webpack-cli@latest ts-loader@latest clean-webpack-plugin@latest html-webpack-plugin@latest --save-exact`  | 
150 | 147 | 
  | 
151 |  | -* Do live development by running `npm start`.   | 
152 |  | -  * Visit [http://localhost:8080](http://localhost:8080)  | 
153 |  | -  * Edit the `src/app/app.tsx` (or any ts/tsx file used in some way by `src/app/app.tsx`) and application live reloads.   | 
154 |  | -  * Edit the `src/templates/index.html` and the server live reloads.  | 
155 |  | -* Build production assets by running `npm run build`.   | 
156 |  | -  * Serve the `public` folder (which contains the built assets) from your server.  | 
 | 148 | +- `npm start`를 실행하십시요.  | 
 | 149 | +- [http://localhost:8080](http://localhost:8080) 이 url에 접속하십시요.  | 
 | 150 | +- `src/app/app.tsx` 이 파일을 수정하면 애플리케이션이 실시간으로 새로고침 됩니다.  | 
 | 151 | +- `src/templates/index.html` 이 파일을 수정하면 웹서버에서 실시간으로 새로고침 됩니다.  | 
 | 152 | +- 제품을 빌드하려면 `npm run build` 을 실행하십시요.  | 
 | 153 | +- 빌드가 끝나면 `public` 폴더를 서버에 제공하십시요.  | 
0 commit comments