How to Make a Javascript Library - Building With Typescript & Publish

  Рет қаралды 19,398

Monsterlessons Academy

Monsterlessons Academy

Күн бұрын

Пікірлер: 58
@MonsterlessonsAcademy
@MonsterlessonsAcademy 4 ай бұрын
WATCH NEXT: Typescript Interview Questions and Answers - Dominate Your Next Interview - kzbin.info/www/bejne/aqHUlqJ-gctsf7csi=2gqvcpDDDDRorNpX
@bharathram89
@bharathram89 Жыл бұрын
You are amazing keep making videos brotha!
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Thank you so much for your support. It means a lot to me!
@Novacification
@Novacification Жыл бұрын
Thanks for the response and a great video!
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
That you so much for your support. It means a lot for me!
@luistabotelho
@luistabotelho Жыл бұрын
This was a great introduction to making a library.
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad to hear that!
@mikezcooler
@mikezcooler 2 жыл бұрын
An excellent tutorial. Very well explained and at a good pace. Thank you 💯
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
Glad you enjoyed it!
@hideinbush0
@hideinbush0 Жыл бұрын
Just what I was looking for! Liked and subscribed.
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Awesome, thank you!
@RicardoLopesZe
@RicardoLopesZe 2 жыл бұрын
Very good content! Helped me a lot!
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
Glad to hear it!
@xicheung7867
@xicheung7867 2 жыл бұрын
Fantastic tutorial 👍 Thank you🙌
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
You’re welcome 😊
@AntoineGUGLIELMI-vl1xo
@AntoineGUGLIELMI-vl1xo 8 ай бұрын
Perfect video, wahou ! Thank you so much !
@MonsterlessonsAcademy
@MonsterlessonsAcademy 8 ай бұрын
You are welcome!
@Nemesis_74
@Nemesis_74 2 жыл бұрын
It is what I have been looking for 😊
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
Awesome!
@Nemesis_74
@Nemesis_74 2 жыл бұрын
@@MonsterlessonsAcademy 😊😊
@GreenAsJade
@GreenAsJade 2 жыл бұрын
Gold! Subscribed!
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
Thanks!
@GreenAsJade
@GreenAsJade 2 жыл бұрын
Could you comment on why we need the `lib` field of the `compilerOptions`? It doesn't work if that is not there, but typescript supposedly includes libraries for the DOM?
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
It is pretty good written in off docs www.typescriptlang.org/tsconfig#lib By default you get default browser libs. If you don't want that because you have a node app then you can change it.
@krishna1794
@krishna1794 Жыл бұрын
Amazing video very helpful
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad you think so!
@mikezcooler
@mikezcooler 2 жыл бұрын
Thanks
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
Thank you so much for your support! It means a lot to me.
@mikezcooler
@mikezcooler 2 жыл бұрын
@@MonsterlessonsAcademy You are welcome. If I may, one suggestion, there feels to be a Part II that would be helpful. Because when you have got say large number of utility functions, each with their own sets of types declared in a separate types file in the function folder, then what is the "best" way to compile them. Options are to leave them all in their folders and let tsc do its business, with tsc given the include of src/**/*, another option is to export them and barrel them all up into a single file export for the entire library, and only to include that file. It may be a good idea to explore these follow on in a Part II. This aspect has not been covered here, and as I find myself thinking of this, I thought a Part II will be helpful for others. Not so much me, as I have to work this out now for myself.
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
@@mikezcooler Thank you for the idea! I will add it to the list of future videos.
@mikezcooler
@mikezcooler 2 жыл бұрын
@@MonsterlessonsAcademy very strange, I cloned your repo, added few more methods, declared a types file for each function defining the types being used in the corresponding function. Then add the extra functions to the export in the root index.ts file. However when tsc runs, it creates the index.js and an index.d.ts but instead of having types inside it, the created index.d.ts is the exact same as the index.js. So there is some configuration which does not work in the current project.
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
​@@mikezcooler It is correct that they look the same. To check if you can import in your project types later try to publish/link it in your project. You will get access to data types.
@Novacification
@Novacification Жыл бұрын
Great video! With two package.json how do you manage dependencies for your library. Do you need to manage two identical dependency lists?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
I always made just a single package.json and put all dependencies there for both versions.
@Novacification
@Novacification Жыл бұрын
@@MonsterlessonsAcademy so all dependencies in the non-dist package.json?
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
@@Novacification yes
@SaadMalaeb-qt3zk
@SaadMalaeb-qt3zk 7 ай бұрын
Sorry to jump in a year later, but about this topic: When you publish the package from dist and the dependencies are not there, the app will crash (unless you copy them manually). How to handle this?
@mayurgawle1169
@mayurgawle1169 9 ай бұрын
Can I use this project in my resume ? btw great video
@MonsterlessonsAcademy
@MonsterlessonsAcademy 9 ай бұрын
Sure, if you can prove the interviewer that you understand every single line of code and why it is done this way.
@samuelolumorin1285
@samuelolumorin1285 Жыл бұрын
what If I intend to use the library as a (CDN) in the script tag,
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
It is not intended for such use as in production projects we quite rarely use libs as cdn script.
@rodmaniswild
@rodmaniswild 11 ай бұрын
These things are new to me, I just added my first github repository. I'd like my js file to be included by a script tag on an HTML page and im struggling with it. How can it be done? (I mean anyone could include it, not only me)
@MrTofi63
@MrTofi63 2 жыл бұрын
Thanks for the video! Can you please explain how to use such library with CDN?
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
I will add it as an idea for other video!
@pricklywiggles
@pricklywiggles 2 жыл бұрын
Doesn't this double the size of your package by bundling both common and es6 module versions.
@MonsterlessonsAcademy
@MonsterlessonsAcademy 2 жыл бұрын
Package yes. Imported package no as it is splitted in 2 versions.
@Michaeljamieson10
@Michaeljamieson10 10 ай бұрын
awesome
@MonsterlessonsAcademy
@MonsterlessonsAcademy 10 ай бұрын
Thanks
@berkvideo
@berkvideo 2 ай бұрын
dude just go and use and IDE or something like VS Code dont stay behind current age
@samuelolumorin1285
@samuelolumorin1285 Жыл бұрын
Awesome explanation, thank you sir!
@MonsterlessonsAcademy
@MonsterlessonsAcademy Жыл бұрын
Glad you liked it
Require vs Import Javascript
22:39
Monsterlessons Academy
Рет қаралды 81 М.
Build a Component Library for React with Typescript [2021]
20:50
The Nerdy Canuck
Рет қаралды 25 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Angular Projects Every Developer Wishes They Had in Their Portfolio
4:13:40
Monsterlessons Academy
Рет қаралды 7 М.
How to write and publish your first Typescript library
14:16
Ady Ngom
Рет қаралды 13 М.
Don't put your types in .d.ts files
3:54
Matt Pocock
Рет қаралды 143 М.
Best of CES 2025
14:50
The Verge
Рет қаралды 214 М.
How to make your own NPM package (Step-by-Step) 📦
16:46
Under Ctrl
Рет қаралды 38 М.
Build And Publish A React Component Library
24:02
PortEXE
Рет қаралды 107 М.
This UI component library is mind-blowing
8:23
Beyond Fireship
Рет қаралды 736 М.
TypeScript API: How to Set Up User Registration Without a Database
32:30
Monsterlessons Academy
Рет қаралды 1 М.
Creating Your Own UI Library with React and TypeScript
6:04
Bayan Bennett
Рет қаралды 27 М.
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН