Publishing your First Typescript NPM Package

I assume that you already have at least the basic knowledge of NodeJs, NPM and Typescript.Before, we start. Please make your devices has typescript and touch-cli install globally. If not, you can run command yarn global add typescript touch-cli.typescr…


This content originally appeared on Level Up Coding - Medium and was authored by Sear Cheulong

I assume that you already have at least the basic knowledge of NodeJs, NPM and Typescript.

Before, we start. Please make your devices has typescript and touch-cli install globally. If not, you can run command yarn global add typescript touch-cli.

  • typescript — to be able to use tsc command.
  • touch-cli — to be able to implement the touch command for Node.

Frist, create a new nodejs project

npm init -y

It will create package.json

Next, add dependencies

yarn add -D typescript
  • typescript — to code typescript in the project.

After that, you can run tsc init to generate tsconfig.json

touch index.ts

Now, let write some basic functions

Before go any further, we need to edit tsconfig.json and package.json

Finally, run yarn build

Now we will publish our package to npm

To create a profile for the public npm registry

npm config set registry https://registry.npmjs.org/
npm login

After you logged in, you run npm publish

Go to npmjs.com and search rtl-checker

Congratulations, you published your first npm package.

Repository for this code https://github.com/cheulong/rtl-checker

Example for this package codesandbox


Publishing your First Typescript NPM Package was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.


This content originally appeared on Level Up Coding - Medium and was authored by Sear Cheulong


Print Share Comment Cite Upload Translate Updates
APA

Sear Cheulong | Sciencx (2021-08-17T18:36:03+00:00) Publishing your First Typescript NPM Package. Retrieved from https://www.scien.cx/2021/08/17/publishing-your-first-typescript-npm-package/

MLA
" » Publishing your First Typescript NPM Package." Sear Cheulong | Sciencx - Tuesday August 17, 2021, https://www.scien.cx/2021/08/17/publishing-your-first-typescript-npm-package/
HARVARD
Sear Cheulong | Sciencx Tuesday August 17, 2021 » Publishing your First Typescript NPM Package., viewed ,<https://www.scien.cx/2021/08/17/publishing-your-first-typescript-npm-package/>
VANCOUVER
Sear Cheulong | Sciencx - » Publishing your First Typescript NPM Package. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/17/publishing-your-first-typescript-npm-package/
CHICAGO
" » Publishing your First Typescript NPM Package." Sear Cheulong | Sciencx - Accessed . https://www.scien.cx/2021/08/17/publishing-your-first-typescript-npm-package/
IEEE
" » Publishing your First Typescript NPM Package." Sear Cheulong | Sciencx [Online]. Available: https://www.scien.cx/2021/08/17/publishing-your-first-typescript-npm-package/. [Accessed: ]
rf:citation
» Publishing your First Typescript NPM Package | Sear Cheulong | Sciencx | https://www.scien.cx/2021/08/17/publishing-your-first-typescript-npm-package/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.