Things Every Developer Should Know About package.json

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 76

  • @vijaykumarreddyalavala3713
    @vijaykumarreddyalavala3713 4 роки тому +10

    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.

  • @jeanmarcpourchel307
    @jeanmarcpourchel307 4 роки тому +6

    ...and as always, thanks for sharing and teaching !

  • @sp00fify
    @sp00fify 4 роки тому +12

    you can also get variables like this:
    npm run task --var=data
    console.log(process.env.npm_config_var); // data

  • @djlee0721
    @djlee0721 4 роки тому +5

    This kind of stuff is just eye opening.. Thank you so much!

  • @ankamsarav
    @ankamsarav 4 роки тому +5

    Thanks for the detailed explanation. Your tuts are always an eye opener.

  • @chrsbll
    @chrsbll 4 роки тому +3

    Great advice, excellent video.

  • @finnleyfoxx6665
    @finnleyfoxx6665 3 роки тому +2

    My dude! This was extremely well explained. Thankyou! Liked & Subbed

  • @paulosimoes1891
    @paulosimoes1891 4 роки тому

    Great videos Steve, i'm addicted to your channel! Thanks!

  • @barungh
    @barungh 2 роки тому +2

    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"

  • @yitzchaksviridyuk932
    @yitzchaksviridyuk932 4 роки тому +1

    Thanks a lot. Great video!

  • @beuguebaye4864
    @beuguebaye4864 4 роки тому

    Great video. I always automatically click on notification to watch your video. Thanks for sharing

  • @memduhcevik
    @memduhcevik Рік тому

    awesome tutor👏👍

  • @PhongNguyen-tp7lg
    @PhongNguyen-tp7lg 3 роки тому

    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  3 роки тому +1

      You can name the scripts anything you want as long as they are inside "scripts"
      I'm from Canada.

    • @PhongNguyen-tp7lg
      @PhongNguyen-tp7lg 3 роки тому

      @@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  3 роки тому +1

      @@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 3 роки тому +1

      @@SteveGriffith-Prof3ssorSt3v3 haha my mistake, Ive watched so many videos for a clear exlaination ^^

  • @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 роки тому +1

      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,

  • @adrishkumarde4155
    @adrishkumarde4155 2 роки тому

    Thanks for the explanation

  • @autobochi5229
    @autobochi5229 4 роки тому +1

    your video is good, your voice is super Good, and your Name is extra super Good, and your Teaching is Mega fiber Goood

  • @lerneninverschiedenenforme7513
    @lerneninverschiedenenforme7513 3 роки тому

    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

  • @Nishant__29
    @Nishant__29 4 місяці тому

    good work sir

  • @dndfan3000
    @dndfan3000 4 роки тому

    You mind doing a video about static-link ?

  • @gcristian1417
    @gcristian1417 4 роки тому

    Thank you very much!!!!! Keep going! :D

  • @testtai9160
    @testtai9160 4 роки тому

    @stevegriffith What happens when you also have -- inside the script? For example, "gitty": "node g.js -- ..."?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 роки тому +1

      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.

  • @Colstonewall
    @Colstonewall 4 роки тому +2

    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. - ua-cam.com/video/LCezax2uN3c/v-deo.html

  • @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".

  • @snehashischattopadhyay9519
    @snehashischattopadhyay9519 4 роки тому

    process.argv is it inbuilt method to catch any arguments passed from command line?

  • @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.

  • @oleksiimarchenko3470
    @oleksiimarchenko3470 4 роки тому +1

    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.

  • @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 роки тому +1

      @@SteveGriffith-Prof3ssorSt3v3 thanks for clarifying Steve as I was going through some stackoverflow links but couldn't make out.

  • @jackodonnell-u2c
    @jackodonnell-u2c Рік тому

    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.

  • @daegudude1048
    @daegudude1048 4 роки тому

    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  4 роки тому +1

      Yep. But my students can see me type clear

    • @daegudude1048
      @daegudude1048 4 роки тому +1

      @@SteveGriffith-Prof3ssorSt3v3 Ahh That's right :) My bad! Anyway thanks for the always good quality videos, I really enjoyed the pubsub pattern you uploaded :)

  • @arvindersingh9863
    @arvindersingh9863 4 роки тому

    Sir, i wanna know what is package-lock.json then?

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  4 роки тому +2

      In package.json we provide ranges for versions of dependencies.
      package-lock.json records the exact version that is currently installed.

  • @r0x304
    @r0x304 4 роки тому +2

    npm init -y works too

  • @sebastianfarias5670
    @sebastianfarias5670 4 роки тому

    Great video !!!
    Thank you :) +1 sub !!!!

  • @Mandeepsingh-jo5cf
    @Mandeepsingh-jo5cf 3 роки тому

    Thanks

  • @meowlol1837
    @meowlol1837 4 роки тому

    Thank You !!!!!!

  • @Naz-yi9bs
    @Naz-yi9bs 2 роки тому

    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  2 роки тому

      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 2 роки тому +1

      @@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.

  • @adicide9070
    @adicide9070 4 роки тому

    very cool.

  • @mohamedyoussef8835
    @mohamedyoussef8835 3 роки тому

    Awesome ++++++++++++

  • @DarkLife-vhd4
    @DarkLife-vhd4 4 роки тому

    Love it

  • @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 роки тому +1

      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.

  • @juancamacho479
    @juancamacho479 3 роки тому +1

    me: thank you so much! this is just what I needed.
    weebs: your voice turns me on senpai...

  • @BitYoungjae
    @BitYoungjae 4 роки тому

    와... npm init 으로 이런 것 까지 할 수 있구나..

  • @alimansourey2076
    @alimansourey2076 3 роки тому

    pretty advanced for me now..

  • @frederichermandsen3024
    @frederichermandsen3024 3 роки тому

    Your voice is like dark chocolate

  • @dCoder92
    @dCoder92 3 роки тому

    Was hoping for some words to package-lock.json

    • @SteveGriffith-Prof3ssorSt3v3
      @SteveGriffith-Prof3ssorSt3v3  3 роки тому

      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!!