Things Every Developer Should Know About package.json

  Рет қаралды 48,460

Steve Griffith - Prof3ssorSt3v3

Steve Griffith - Prof3ssorSt3v3

4 жыл бұрын

This tutorial explains how you can configure your package.json file and the npm config settings to properly manage your project.
How to run npm scripts and pass arguments from the command line is also discussed.
Repo from video including scripts - bitbucket.org/prof3ssorSt3v3/...

Пікірлер: 75
@vijaykumarreddyalavala3713
@vijaykumarreddyalavala3713 4 жыл бұрын
I started watching this video with the intention of understanding the difference between package.json and package-lock.json but learnt a lot more than that. Thank you so much.
@djlee0721
@djlee0721 4 жыл бұрын
This kind of stuff is just eye opening.. Thank you so much!
@paulosimoes1891
@paulosimoes1891 4 жыл бұрын
Great videos Steve, i'm addicted to your channel! Thanks!
@jeanmarcpourchel307
@jeanmarcpourchel307 4 жыл бұрын
...and as always, thanks for sharing and teaching !
@chrsbll
@chrsbll 4 жыл бұрын
Great advice, excellent video.
@finnleyfoxx6665
@finnleyfoxx6665 3 жыл бұрын
My dude! This was extremely well explained. Thankyou! Liked & Subbed
@beuguebaye4864
@beuguebaye4864 4 жыл бұрын
Great video. I always automatically click on notification to watch your video. Thanks for sharing
@sp00fify
@sp00fify 4 жыл бұрын
you can also get variables like this: npm run task --var=data console.log(process.env.npm_config_var); // data
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
Thanks for adding that note.
@ankamsarav
@ankamsarav 4 жыл бұрын
Thanks for the detailed explanation. Your tuts are always an eye opener.
@yitzchaksviridyuk932
@yitzchaksviridyuk932 3 жыл бұрын
Thanks a lot. Great video!
@vaclavvlcek4527
@vaclavvlcek4527 3 жыл бұрын
Thank you Steve for all your videos that you are doing. It helped me really much to understand lot of thing in JS. However, here I guess you omit the most import thing and it is talking about dependencies and packages itself :) You call this video "Things Every Developer Should Know About package.json", but I am not sure if the git command saved in the script is the most important think :)
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
I have other videos about git and dependencies etc. This video is a collection of things that many people are missing after they learn about git and npm basics,
@gcristian1417
@gcristian1417 3 жыл бұрын
Thank you very much!!!!! Keep going! :D
@adrishkumarde4155
@adrishkumarde4155 2 жыл бұрын
Thanks for the explanation
@_ademmeral
@_ademmeral Жыл бұрын
awesome tutor👏👍
@barungh
@barungh Жыл бұрын
lately syntax has changed a little, now it is like this:- npm config set init-license="MIT" npm config set init-author-name="Steve Griffith"
@Nishant__29
@Nishant__29 11 сағат бұрын
good work sir
@DarkLife-vhd4
@DarkLife-vhd4 4 жыл бұрын
Love it
@meowlol1837
@meowlol1837 4 жыл бұрын
Thank You !!!!!!
@sebastianfarias5670
@sebastianfarias5670 4 жыл бұрын
Great video !!! Thank you :) +1 sub !!!!
@autobochi5229
@autobochi5229 4 жыл бұрын
your video is good, your voice is super Good, and your Name is extra super Good, and your Teaching is Mega fiber Goood
@Mandeepsingh-jo5cf
@Mandeepsingh-jo5cf 3 жыл бұрын
Thanks
@testtai9160
@testtai9160 4 жыл бұрын
@stevegriffith What happens when you also have -- inside the script? For example, "gitty": "node g.js -- ..."?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
The double -- are for npm commands. You could use it with an npm command inside the script. The value is then going to be hard coded in the script and be the save every time.
@adicide9070
@adicide9070 3 жыл бұрын
very cool.
@daegudude1048
@daegudude1048 3 жыл бұрын
Thanks for the quality info :) Idk if you could find this helpful, but you can ctrl+l to clear the console instead of running 'clear'
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
Yep. But my students can see me type clear
@daegudude1048
@daegudude1048 3 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Ahh That's right :) My bad! Anyway thanks for the always good quality videos, I really enjoyed the pubsub pattern you uploaded :)
@lerneninverschiedenenforme7513
@lerneninverschiedenenforme7513 2 жыл бұрын
I missed the part where you explain how to make the `scripts` (like "steve") dependent on each other. E.g. how would you make the gitty command run everytime after/prior building
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
Here you go - kzbin.info/www/bejne/oajRaKd-f6-igqM
@lerneninverschiedenenforme7513
@lerneninverschiedenenforme7513 2 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Thank you! Very helpful!
@dndfan3000
@dndfan3000 4 жыл бұрын
You mind doing a video about static-link ?
@snehashischattopadhyay9519
@snehashischattopadhyay9519 4 жыл бұрын
process.argv is it inbuilt method to catch any arguments passed from command line?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
Yes. nodejs.org/docs/latest/api/process.html#process_process_argv
@argl1995
@argl1995 3 жыл бұрын
Hey Steve, can you please tell how to add comments in package.json file if needed and what's the best way of doing that. I need to know if both single-line and multiline comments can work in package.json file or not
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
You cant add comments in JSON files
@argl1995
@argl1995 3 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 thanks for clarifying Steve as I was going through some stackoverflow links but couldn't make out.
@PhongNguyen-tp7lg
@PhongNguyen-tp7lg 2 жыл бұрын
nice bro! im newbie to npm. just want to know that we can change Script Object's keyword to a whatever string we want to tell npm to run the script or is it fixed? btw, really like your voice / english accent. Where do you come from? ^^ subscribed!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
You can name the scripts anything you want as long as they are inside "scripts" I'm from Canada.
@PhongNguyen-tp7lg
@PhongNguyen-tp7lg 2 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 thanks Steve. Im newbie to TS too & still strugling how to use the .d.ts file. Im really confused on some points: 1. When to use import/export & when to use ///
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
@@PhongNguyen-tp7lg This tutorial is about package.json and has nothing to do with Typescript. I have not made any Typescript tutorials.
@PhongNguyen-tp7lg
@PhongNguyen-tp7lg 2 жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 haha my mistake, Ive watched so many videos for a clear exlaination ^^
@mohamedyoussef8835
@mohamedyoussef8835 2 жыл бұрын
Awesome ++++++++++++
@Colstonewall
@Colstonewall 4 жыл бұрын
The Gandalf of Javascript! Awesome vid, Steve. How bout one on package.json (common) scripts?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
Please add that to my tutorial request video comments to remind me. - kzbin.info/www/bejne/gnTIq5SuZ9qBacU
@eagillum
@eagillum Жыл бұрын
Hi Steve, how can I add type:module to the package? Like where does it go?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 Жыл бұрын
It is a top-level property just like "name". "type": "module" can go anywhere at the same level as "name".
@arvindersingh9863
@arvindersingh9863 3 жыл бұрын
Sir, i wanna know what is package-lock.json then?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
In package.json we provide ranges for versions of dependencies. package-lock.json records the exact version that is currently installed.
@oleksiimarchenko3470
@oleksiimarchenko3470 4 жыл бұрын
Great lesson! The best, probably even the only relevant video I could find on the topic. It would be great if you proceeded with more examples of real life custom scripts.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
I've got lots of those on my channel. :)
@thayyrodriguez4741
@thayyrodriguez4741 2 жыл бұрын
I'm just starting with node.js and after setting the scripts I keep getting " npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. " before it prints what I needed.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
Are you putting the flags "--global" or "--local" in your command to run a script?
@r0x304
@r0x304 4 жыл бұрын
npm init -y works too
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
yep. and npm init --yes
@BitYoungjae
@BitYoungjae 4 жыл бұрын
와... npm init 으로 이런 것 까지 할 수 있구나..
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
예 :)
@user-tq5dq3ko7c
@user-tq5dq3ko7c Жыл бұрын
im obviously missing somthing key here but when I delete and then run npm init --y I get hundreds of lines of json back, why would this be?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 Жыл бұрын
When the npm init command runs it is supposed to create the package.json file and it writes out the content of that file. The content of the file is based on the global settings that have been set. If you have lots of settings it will write all those out.
@classicguy7813
@classicguy7813 4 жыл бұрын
Sir, Great, sir you are! Can we implement these goodies for JS, for TypeScript you Greatio Sir in an extended G-Ratio! Gravitio! Gracias
@classicguy7813
@classicguy7813 4 жыл бұрын
Sorry for my royal English though
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 жыл бұрын
The package.json file relates to NPM more than the language(s) you are using in your projects. Not sure what you are looking to do with TypeScript.
@alimansourey2076
@alimansourey2076 3 жыл бұрын
pretty advanced for me now..
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 жыл бұрын
In a few months it won't be.
@juancamacho479
@juancamacho479 3 жыл бұрын
me: thank you so much! this is just what I needed. weebs: your voice turns me on senpai...
@Naz-yi9bs
@Naz-yi9bs Жыл бұрын
My question/comment keeps getting deleted I don't know why. I'll try again, I am still confused as to the overall purpose of this file, who is the ultimate recipient of the file? Does NPM need this file and the info that it contains to make sure the stuff it downloads runs/updates smoothly, or, is the receipt suppose to be the programmer/Github user who needs that dependency information? In regards to the "sc....s" ( I think this word is why my comment keeps getting deleted) section in that file, that runs other commonly used "sc....s" by you, why not just use "b.t" files (the middle letter is a) - sorry, I think this is another word that keeps getting my comments deleted.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 Жыл бұрын
The package.json file is the settings file for a project controlled by npm or yarn. It includes information about the author, project name and versioning info, any connected repos, scripts for build and deploy, plus dependencies and dev dependencies. When you install an npm module into your project this file keeps track of that and its version. It is a record for the developer of critical information about the project. For anyone who clones the project on a new computer, they can run `npm install` and it will read this file and know what dependencies to install. If you want, you can have your npm scripts run other things like batch files or shell scripts or terminal commands.
@Naz-yi9bs
@Naz-yi9bs Жыл бұрын
@@SteveGriffith-Prof3ssorSt3v3 Thank you for rewording the information in the video, plus adding additional detail. I understand the purpose and significance of the file now.
@frederichermandsen3024
@frederichermandsen3024 3 жыл бұрын
Your voice is like dark chocolate
@dCoder92
@dCoder92 2 жыл бұрын
Was hoping for some words to package-lock.json
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 жыл бұрын
The lock file is just an automatically generated file that holds the specific version of installed dependencies.
@satyampandey5584
@satyampandey5584 2 жыл бұрын
Bhai kya kar rha hai tu!!
package.json is not enough
15:40
Hussein Nasser
Рет қаралды 53 М.
TypeScript: tsconfig demystified!
22:32
Tech Talks with Simon
Рет қаралды 12 М.
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 64 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 47 МЛН
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 81 МЛН
Playing hide and seek with my dog 🐶
00:25
Zach King
Рет қаралды 36 МЛН
How to Export and Require Modules in NodeJS
12:36
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 55 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,1 МЛН
Chrome Dev Tools Console Super Powers
16:44
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 6 М.
10 Things You Should NEVER Do To Your PS4
7:12
TheGamer
Рет қаралды 5 МЛН
~/.dotfiles in 100 Seconds
13:54
Fireship
Рет қаралды 413 М.
Package JSON Demystified - The 'Exports' Keyword
14:46
A shot of code
Рет қаралды 3,6 М.
Beginner's Guide to the Bash Terminal
1:14:37
Joe Collins
Рет қаралды 2,3 МЛН
The Story of Next.js
12:13
uidotdev
Рет қаралды 559 М.
NPM - pre & post scripts
6:15
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 14 М.
#16: All about package-lock.json - Mastering NPM
9:29
Mehul - Codedamn
Рет қаралды 25 М.
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 64 МЛН