Deno는 JavaScript와 TypeScript를 실행하기 위한 안전한 런타임 환경입니다. 이러한 런타임 환경에서 사용할 수 있는 몇 가지 기본 명령어를 리스트 입니다.
Node.js → Deno Cheatsheet 를 참조하면 더 이해하기 좋습니다.
1.
deno run
•
대응 명령어: node file.js / ts-node file.ts
•
사용 방법: deno run [options] [file]
•
실행할 JavaScript 또는 TypeScript 파일을 지정합니다. 파일이 웹에서 가져올 경우 URL도 사용 가능합니다.
•
사용 예: deno run https://deno.land/std/examples/welcome.ts
2.
deno eval
•
대응 명령어: node -e
•
사용 방법: deno eval [options] [code]
•
콘솔에서 직접 코드를 평가하고 실행합니다.
3.
deno test
•
대응 명령어: jest / ava / mocha / tap / 등
•
사용 방법: deno test [options] [files]
•
Deno로 작성된 테스트를 실행합니다. 테스트 파일은 이름이 _test.ts 또는 _test.js 형식이어야 합니다.
•
사용 예: deno test test/my_test.ts
4.
deno install
•
대응 명령어: npm i -g
•
사용 방법: deno install [options] [name] [url]
•
Deno 스크립트를 실행 파일로 설치합니다. 이를 통해 Deno로 작성된 CLI 도구를 사용할 수 있습니다.
•
사용 예: deno install -A --unstable -n deno_lint https://deno.land/x/deno_lint/mod.ts
5.
deno task
•
대응 명령어: npm run
•
사용 방법: deno task [options] [task]
•
Deno로 정의된 작업을 실행합니다.
6.
deno bundle
•
사용 방법: deno bundle [options] [input] [output]
•
JavaScript 또는 TypeScript 파일을 하나의 JavaScript 파일로 번들합니다.
•
사용 예: deno bundle src/main.ts dist/bundle.js
7.
deno fmt
•
사용 방법: deno fmt [options] [files]
•
JavaScript와 TypeScript 파일의 코드 스타일을 통일합니다. 기본적으로 Deno가 제공하는 스타일 가이드를 따릅니다.
•
사용 예: deno fmt src/main.ts
8.
deno lint
•
사용 방법: deno lint [options] [files]
•
JavaScript와 TypeScript 파일의 코드를 분석하여 문제를 찾고 리포트합니다.
•
사용 예: deno lint src/main.ts
9.
deno check
•
대응 명령어: tsc
•
사용 방법: deno check [options] [files]
•
TypeScript 파일의 타입을 검사합니다.
10.
deno doc
•
대응 명령어: typedoc
•
사용 방법: deno doc [options] [input]
•
JavaScript 또는 TypeScript 파일에 대한 문서를 생성합니다.
•
사용 예: deno doc src/main.ts
11.
deno completions
•
사용 방법: deno completions [shell]
•
지정된 셸에 대한 Deno 자동 완성 스크립트를 생성합니다.
•
사용 예: deno completions bash
12.
deno run/lint/test --watch
•
대응 명령어: nodemon
•
사용 방법: deno [run/lint/test] --watch [options] [file]
•
파일 변경시 자동으로 스크립트를 재실행합니다.
13.
deno compile
•
대응 명령어: nexe / pkg
•
사용 방법: deno compile [options] [input] [output]
•
Deno 스크립트를 실행 가능한 바이너리로 컴파일합니다.
14.
deno info
•
대응 명령어: npm explain
•
사용 방법: deno info [options] [specifier]
•
모듈에 대한 정보를 제공합니다.
15.
deno upgrade
•
대응 명령어: nvm / n / fnm
•
사용 방법: deno upgrade [options]
•
Deno의 최신 버전으로 업그레이드합니다.
16.
deno lsp
•
대응 명령어: tsserver
•
사용 방법: deno lsp
•
Deno의 Language Server를 시작합니다. 이를 통해 텍스트 에디터와 통합하여 개발 경험을 향상시킬 수 있습니다.
17.
deno coverage
•
대응 명령어: nyc / c8 / istanbul
•
사용 방법: deno coverage [options] [dir]
•
테스트 커버리지 정보를 생성하고 출력합니다.
18.
deno bench
•
대응 명령어: benchmarks
•
사용 방법: deno bench [options] [files]
•
벤치마크 테스트를 실행하고 결과를 출력합니다.
이 명령어들은 Deno 개발 환경에서 프로젝트를 관리하고 실행하는 데 도움이 됩니다. 사용하려는 명령어에 대한 자세한 옵션과 정보를 보려면 deno help [command]를 실행하세요.