Skip to content

Commit 05b583e

Browse files
author
=
committed
nodejs add translation korean
1 parent 4c6832e commit 05b583e

File tree

1 file changed

+36
-34
lines changed

1 file changed

+36
-34
lines changed

docs/quick/nodejs.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
# TypeScript with Node.js
2-
TypeScript has had *first class* support for Node.js since inception. Here's how to setup a quick Node.js project:
32

4-
> Note: many of these steps are actually just common practice Node.js setup steps
3+
타입스크립트는 처음부터 Node.js에 대해 *first class*를 지원했습니다. 빠르게 Node.js로 프로젝트를 구성하는 방법은 다음과 같습니다.
54

6-
1. Setup a Node.js project `package.json`. Quick one : `npm init -y`
7-
1. Add TypeScript (`npm install typescript --save-dev`)
8-
1. Add `node.d.ts` (`npm install @types/node --save-dev`)
9-
1. Init a `tsconfig.json` for TypeScript options with a few key options in your tsconfig.json (`npx tsc --init --rootDir src --outDir lib --esModuleInterop --resolveJsonModule --lib es6,dom --module commonjs`)
5+
> 메모: 이러한 많은 단계는 일반적인 Node.js 설정 단계입니다.
106
11-
That's it! Fire up your IDE (e.g. `code .`) and play around. Now you can use all the built in node modules (e.g. `import * as fs from 'fs';`) with all the safety and developer ergonomics of TypeScript!
7+
1. Node.js 프로젝트 설정에는 `package.json`이 필요합니다. 이 파일을 빠르게 생성하는 방법은 `npm init -y`
8+
1. 타입스크립트를 추가 (`npm install typescript --save-dev`)
9+
1. `node.d.ts`를 추가 (`npm install @types/node --save-dev`)
10+
1. 타입스크립트 옵션은 `tsconfig.json`을 이용해서 초기화하고 설정할수 있습니다. (`npx tsc --init --rootDir src --outDir lib --esModuleInterop --resolveJsonModule --lib es6,dom --module commonjs`)
1211

13-
All your TypeScript code goes in `src` and the generated JavaScript goes in `lib`.
12+
타입스크립트는 node modules에 설치된 모든것을 (예: `import * as fs from 'fs';`)를 이용해서 안전하게 가져올수 있습니다.
1413

15-
## Bonus: Live compile + run
16-
* Add `ts-node` which we will use for live compile + run in node (`npm install ts-node --save-dev`)
17-
* Add `nodemon` which will invoke `ts-node` whenever a file is changed (`npm install nodemon --save-dev`)
14+
타입스크립트 `src`에 있는 모든 코드는 자바스크립트의 `lib`에 생성됩니다.
1815

19-
Now just add a `script` target to your `package.json` based on your application entry e.g. assuming its `index.ts`:
16+
## 보너스: Live compile + run (실시간 컴파일 + 실행)
17+
18+
- `ts-node`는 어떤것이든 실행이후 실시간 컴파일을 지원합니다. 추가는 (`npm install ts-node --save-dev`)
19+
- `nodemon``ts-node`가 파일이 변경될때마다 동작합니다. 추가는 (`npm install nodemon --save-dev`)
20+
21+
`package.json`에서 `script`를 지정할 수 있고 기본적인 진입점을 가정하면 예:`index.ts`:
2022

2123
```json
2224
"scripts": {
@@ -26,21 +28,21 @@ Now just add a `script` target to your `package.json` based on your application
2628
},
2729
```
2830

29-
So you can now run `npm start` and as you edit `index.ts`:
31+
이제 `npm start`를 실행하면 `index.ts`를 수정할 수 있습니다.
3032

31-
* nodemon reruns its command (ts-node)
32-
* ts-node transpiles automatically picking up tsconfig.json and the installed TypeScript version,
33-
* ts-node runs the output JavaScript through Node.js.
33+
- nodemon이 해당 명령어를 재실행합니다. (ts-node)
34+
- ts-node 트랜스파일이 tsconfig.json 및 설치된 타입스크립트 버전을 자동으로 선택합니다.
35+
- Node.js를 통해 ts-node가 실행되면 자바스크립트를 출력합니다.
3436

35-
And when you are ready to deploy your JavaScript application run `npm run build`.
37+
자바스크립트 애플리케이션을 배포할 준비가 되면 `npm run build`를 실행하십시요.
3638

37-
## Creating TypeScript node modules
39+
## 타입스크립트에서 node modules를 생성
3840

39-
* [A lesson on creating TypeScript node modules](https://egghead.io/lessons/typescript-create-high-quality-npm-packages-using-typescript)
41+
- [타입스크립트에서 node modules를 생성하는 수업](https://egghead.io/lessons/typescript-create-high-quality-npm-packages-using-typescript)
4042

41-
Using modules written in TypeScript is super fun as you get great compile time safety and autocomplete (essentially executable documentation).
43+
컴파일 시간 안정성과 자동완성 기능이 향상되어 타입스크립트로 작성된 모듈을 사용하는 것은 매우 재미있습니다.
4244

43-
Creating a high quality TypeScript module is simple. Assume the following desired folder structure for your package:
45+
고품질의 타입스크립트 모듈을 만드는 것은 간단합니다. 패키지에 대해 원하는 폴더 구조를 가정하십시요.
4446

4547
```text
4648
package
@@ -60,25 +62,25 @@ package
6062
└─ ...
6163
```
6264

65+
- 내부에 `tsconfig.json`가 있고
6366

64-
* In your `tsconfig.json`
65-
* have `compilerOptions`: `"outDir": "lib"` and `"declaration": true` < This generates declaration and js files in the lib folder
66-
* have `include: ["./src/**/*"]` < This includes all the files from the `src` dir.
67+
- 옵션에는 `compilerOptions`: `"outDir": "lib"` 그리고 `"declaration": true` 이것은 컴파일된 js파일을 lib폴더 생성 하겠다고 선언한것입니다.
68+
- 또 다른 옵션으로는 `include: ["./src/**/*"]` 포함할 모든 파일은 `src`폴더에 지정
6769

68-
* In your `package.json` have
69-
* `"main": "lib/index"` < This tells Node.js to load `lib/index.js`
70-
* `"types": "lib/index"` < This tells TypeScript to load `lib/index.d.ts`
70+
- 그리고 `package.json` 파일도 있습니다.
71+
- `"main": "lib/index"` Node.js로 로드할 경우 `lib/index.js`를 지정
72+
- `"types": "lib/index"` 타입도 마찬가지로 `lib/index.d.ts`를 지정
7173

74+
Example 패키지:
7275

73-
Example package:
74-
* `npm install typestyle` [for TypeStyle](https://www.npmjs.com/package/typestyle)
75-
* Usage: `import { style } from 'typestyle';` will be completely type safe.
76+
- `npm install typestyle` [타입스타일](https://www.npmjs.com/package/typestyle)
77+
- Usage: `import { style } from 'typestyle';` 타입을 안전하게 사용하는 방법.
7678

7779
MORE:
7880

79-
* If your package depends on other TypeScript authored packages, put them in `dependencies`/`devDependencies`/`peerDependencies` just like you would with raw JS packages.
80-
* If your package depends on other JavaScript authored packages and you want to use it with type safety in your project, put their types (e.g. `@types/foo`) in `devDependencies`. JavaScript types should be managed *out of bound* from the main NPM streams. The JavaScript ecosystem breaks types without semantic versioning too commonly, so if your users need types for these they should install the `@types/foo` version that works for them.
81+
- 패키지가 다른 타입스크립트 패키지에 의존하는 경우 원시 JS 패키지와 마찬가지로 `dependencies`/`devDependencies`/`peerDependencies`에 넣으십시요.
82+
- 패키지가 다른 자바스크립트 패키지에 의존하는 경우에는 프로젝트에 안전하게 타입을 이용하려면 (예: `@types/foo`) `devDependencies`에 넣으십시요. 자바스크립트 타입은 NPM 스트림에서 *out of bound*로 관리되어야 합니다. 자바스크립트는 일반적으로 타입을 구분하므로 만약 당신이 `@types/foo` 타입이 필요한 경우에는 해당 버전을 설치하십시요.
8183

82-
## Bonus points
84+
## 보너스 포인트
8385

84-
Such NPM modules work just fine with browserify (using tsify) or webpack (using ts-loader).
86+
앞에서 이미 언급한 NPM 모듈은 browserify에서 (tsify) 사용하거나 웹팩에서 (ts-loader)를 사용

0 commit comments

Comments
 (0)