티스토리 뷰
반응형
- MDN web docs를 보다가 못보던 아이콘이 보여서 찾아보게 되었고, macOS에서 간단하게 설치해 볼 수 있었다.
Deno란?
- Deno는 JS / TS 런타임이며, Node.js의 Ryan Dahl이 주도하는 프로젝트이다.
- 아무래도 라이언 형이 Node.js에서 있었던 아쉬운 점, 또는 미련을 Deno를 통해 상당 부분 해소(?)하려는 것 같다.
설치하기(macOS)
- brew를 통해 간단하게 설치할 수 있다.
- macOS가 아닌 다른 OS의 경우 링크를 확인하자!
[~] brew install deno
// 설치 과정 생략
[~] deno --version
deno 1.22.0 (release, x86_64-apple-darwin)
v8 10.0.139.17
typescript 4.6.2
[~]
Hello World
- 적당한 디렉토리에 간단한 ts 파일을 작성한 후, deno run 명령어로 실행할 수 있다.
// my-first-deno.ts
type Person = {
name: string;
age: number;
alias: string;
}
function sayHello(who: Person): void {
const { name, age, alias } = who;
console.log(`Hello, ${name}(or ${alias})! [${age} years old]`);
}
sayHello({
name: 'ingnoh',
age: 3,
alias: 'injuk',
});
- 해당 코드는 컴파일 과정이나 ts-node 없이 Node.js로 실행할 수는 없다.
[~] node my-first-deno.ts
/Your/Folders/deno/my-first-deno.ts:1
type Person = {
^^^^^^
SyntaxError: Unexpected identifier
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
[~]
- 그러나 Deno는 TS 런타임이기도 하므로, 바로 실행해볼 수 있다.
[~] deno run my-first-deno.ts
Check file:///Your/Folders/deno/my-first-deno.ts
Hello, ingnoh(or injuk)! [3 years old]
[~]
- 이 밖에도 Deno 만의 여러 특징이 있는 것 같은데, 이 부분은 차차 공부해나가며 문서를 추가하기로 했다.
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Spring Cloud Config
- eureka
- Git
- kotlin
- JPA
- pgloader
- javascript
- react
- Node.js
- IntelliJ
- shell
- Docker
- Java
- AWS
- Puppeteer
- AWS IoT
- hashicorp
- Vault
- 코딩테스트
- spring boot
- postgresql
- etc
- mysql
- terraform
- JEST
- RancherDesktop
- Gradle
- Database
- jQuery
- Linux
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함