Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commands to init NodeJS + TypeScript projects

License

NotificationsYou must be signed in to change notification settings

abnerfs/ts-node-init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Sample commands to init a NodeJS TypeScript project

Dependencies

yarn add typescript ts-node ts-node-dev @types/node --dev

OR

npm i typescript ts-node ts-node-dev @types/node --save-dev

tsconfig.json

Createtsconfig.json in the root directory that will contain your typescript compiler configuration, more information inhttps://www.typescriptlang.org/docs/handbook/tsconfig-json.html

{"compilerOptions": {"target":"es2017","experimentalDecorators":true,"emitDecoratorMetadata":true,"module":"commonjs","rootDir":"./src","outDir":"./dist","removeComments":true,"esModuleInterop":true,"forceConsistentCasingInFileNames":true,"strict":true,"resolveJsonModule":true,"skipLibCheck":true   }}

According to our configuration you should write your code insrc/ folder and should have an entry point file calledindex.ts inside.

image

package.json

Adddev andbuild scripts to yourpackage.json file,

"scripts": {"build":"tsc","dev":"ts-node-dev --respawn --transpile-only --ignore-watch node_modules --no-notify src/index.ts"  }

NPM Package

If you are writing a npm package specifymain andtypes path and add--declaration to your build script in order to generate types suggestions to who is using your package.

package.json

"main" :"dist/index.js","types" :"dist/index.d.ts","scripts": {"build":"tsc --declaration"  }

Run

npm run dev

OR

yarn dev

Build

npm run build

or

yarn build

About

Commands to init NodeJS + TypeScript projects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp