How to write and publish your first Typescript library

  Рет қаралды 13,281

Ady Ngom

Ady Ngom

Күн бұрын

If you keep creating the same blocks of code over and over it might be a good idea to turn them into reusable modules. There is nothing more modular when it comes to code than writing a library. But where do you start. In this video I will show all you need to write and publish your first Typescript / Javascript library as an NPM package
Table of Contents:
00:06 - Check if library name is available
00:41 - Create your new library folder
01:07 - Create a package.json file
01:27 - Add essentials values to package.json
02:04 - Install typescript
02:18 - Create dynamically a tsconfig file
02:45 - Add essential values to tsconfig
04:10 - Add your lib files under a src folder
05:43 - Convert typescript to javascript
06:08 - Login to npm via the cli
06:36 - Now publish your package
07:05 - Time to test your new package
09:32 - How to test without adding a new version
13:43 - Next steps

Пікірлер: 26
@erikjohnson9112
@erikjohnson9112 9 ай бұрын
Wow, you covered EXACTLY what I wanted. Well done. Thanks!
@AdyNgom
@AdyNgom 9 ай бұрын
glad it was helpful - thank you for the comment
@k1defjoel397
@k1defjoel397 2 жыл бұрын
Very well organized presentation, getting right to the point and not having the viewer jump through the hoops and loops of "oh let's start out by making mistakes!" Bravo!
@AdyNgom
@AdyNgom 2 жыл бұрын
thank you for the kind remarks Joel. Glad you found it useful :)
@ironsand
@ironsand 8 ай бұрын
GREAT content! It was exactly what I needed but had trouble finding. Thank you!
@ryanclements6272
@ryanclements6272 2 жыл бұрын
im so glad this exists! I really wish I had this when I was trying to build my first npm package.
@AdyNgom
@AdyNgom 2 жыл бұрын
Awesome glad you find it useful. Cheers
@edwardliemingwong7683
@edwardliemingwong7683 Жыл бұрын
Great video, Ady!
@AdyNgom
@AdyNgom Жыл бұрын
thank you kindly
@fode-diop
@fode-diop Жыл бұрын
Saved je so much time. Thank you! 🔥
@AdyNgom
@AdyNgom Жыл бұрын
glad it did - thanks for the comment :)
@VinceTaneri
@VinceTaneri 2 жыл бұрын
Really helpful, thanks!
@AdyNgom
@AdyNgom 2 жыл бұрын
You welcome 🙏🏿 happy you found it helpful
@anilrajan100
@anilrajan100 11 ай бұрын
Very good video, one thought is instead of link library, if we use monorepo or turbo its combine all apps and its dependency using namespaces
@subhranshudas8862
@subhranshudas8862 2 жыл бұрын
Great compact video! I always had a doubt about should we bundle the TSC generated files in dist, before publishing them to NPM?
@thanhnv10
@thanhnv10 11 ай бұрын
I can do it Thank you so much
@ngatcharius
@ngatcharius 2 жыл бұрын
Good Job 👍🏾 Thanks
@AdyNgom
@AdyNgom 2 жыл бұрын
Thank you glad you like it 🙂
@user-ty6vq8xy9m
@user-ty6vq8xy9m 6 ай бұрын
nice
@memories1641
@memories1641 Жыл бұрын
Thank you
@AdyNgom
@AdyNgom Жыл бұрын
you are very welcome :)
@goodylili
@goodylili 2 жыл бұрын
good one
@AdyNgom
@AdyNgom Жыл бұрын
Thank you! Cheers!
@ironsand
@ironsand 8 ай бұрын
When I created a npm link to my project, it imports brings to node-modules everything in the linked package, including source folder and configuration files. How can I link only the dist folder?
@kalanibright9236
@kalanibright9236 Жыл бұрын
I've never seen anyone include typescript in normal dependencies and not --save-dev...just fyi ...should probably be the other.
@AdyNgom
@AdyNgom Жыл бұрын
Hello Kalani. I think a more accurate statement could be we might not need to include Typescript in the normal dependencies since the library final output is vanilla JS and I completely agree. I just tend to shy away from word like "never" because they can be very limiting. In the case of the Angular framework for example, Typescript is a core dependency as in many others. This is intended to show the different steps needed to publish a library to NPM. Feel free to add more to it and I'll happily link to that content. Thank you for the feedback :)
How to Create and Publish a React Component Library
1:19:25
Alex Eagleson
Рет қаралды 78 М.
Пройди игру и получи 5 чупа-чупсов (2024)
00:49
Екатерина Ковалева
Рет қаралды 3,2 МЛН
UNO!
00:18
БРУНО
Рет қаралды 4,8 МЛН
ISSEI & yellow girl 💛
00:33
ISSEI / いっせい
Рет қаралды 21 МЛН
The NPM Library Speedrun - 90 minutes to build, CI, and publish
1:54:17
Build a Component Library for React with Typescript [2021]
20:50
The Nerdy Canuck
Рет қаралды 24 М.
TypeScript: tsconfig demystified!
22:32
Tech Talks with Simon
Рет қаралды 12 М.
Build And Publish A React Component Library
24:02
PortEXE
Рет қаралды 101 М.
Publish private NPM package to Gitlab
12:53
Jack Do
Рет қаралды 6 М.
How to Make a Javascript Library - Building With Typescript & Publish
17:50
Monsterlessons Academy
Рет қаралды 17 М.
I Never Want To Build Authentication Any Other Way
2:03:20
Elliott Chong
Рет қаралды 19 М.
7 TypeScript DOs and DON'Ts That You Should Be Aware Of
14:07
Software Developer Diaries
Рет қаралды 4,8 М.
Building a JavaScript Library from Scratch! w/ Chris Ferdinandi
1:58:40
THANK U FOR 10M! I LOVE YOU ALL 😭❤️
0:11
Andrey Grechka
Рет қаралды 4,7 МЛН
ёкарный бабай..
0:33
Мурат 07 манипулятор
Рет қаралды 2,6 МЛН