RUVIDEO
Поделитесь видео 🙏

Node.js - Section 9 Node Package json | NodeJS Beginners | Simple Tutorials | Easy Learning

Hi All, Welcome back to NodeJS tutorial course. I hope you all have watched my previous sessions which explains different concepts of nodejs and live coding examples. If not, below are the links -
Node.js - Section 1 Introduction & Setup - https://youtu.be/HSUqB2SWPkw
Node.js - Section 2 Architecture & Features - https://youtu.be/n1x2hW8baas
Node.js - Section 3 V8 Engine & First Example - https://youtu.be/BwwRrySrKJ4
Nodejs - Section 4 Globals & Live Examples - https://youtu.be/Fuhd6pYhMRY
Nodejs - Section 5 REPL Console - https://youtu.be/N-YTMCjJXHg
Node.js - Section 6 Nodejs Basics - https://youtu.be/PtqUsG06-7w
Node.js - Section 7 Modules - https://youtu.be/rmqEOmvb-2w
Node.js - Section 8 Node Package Manager - https://youtu.be/MgOvGe1tExc

Please do watch.

Today in this video i am going to explain you all about package.json and its features and usage. Will also be showing live example on how to use them.

Package.json---
If you work with JavaScript, or you've ever interacted with a JavaScript project, Node.js or a frontend project, you surely met the package.json file.
What's that for? What should you know about it, and what are some of the cool things you can do with it?

The package.json file is kind of a manifest for your project. It can do a lot of things, completely unrelated. It's a central repository of configuration for tools, for example. It's also where npm and yarn store the names and versions for all the installed packages.

Command-specific properties----
The package.json file can also host command-specific configuration,
for example for Babel, ESLint, and more.

Each has a specific property, like eslintConfig, babel and others.
Those are command-specific, and you can find how to use those in the respective command/project documentation.

package-lock.json----

In version 5, npm introduced the package-lock.json file.

What's that? You probably know about the package.json file,
which is much more common and has been around for much longer.

The goal of package-lock.json file is to keep track of the exact version
of every package that is installed so that a product is 100% reproducible
in the same way even if packages are updated by their maintainers.

This solves a very specific problem that package.json left unsolved.
In package.json you can set which versions you want to upgrade to (patch or minor), using the semver notation, for example:

if you write ~0.13.0, you want to only update patch releases: 0.13.1 is ok,
but 0.14.0 is not.
if you write ^0.13.0, you want to get updates that do not change the
leftmost non-zero number: 0.13.1, 0.13.2 and so on. If you write ^1.13.0,
you will get patch and minor releases: 1.13.1, 1.14.0 and so on up to 2.0.0
but not 2.0.0.
if you write 0.13.0, that is the exact version that will be used, always
You don't commit to Git your node_modules folder, which is generally huge, and when you try to replicate the project on another machine by using the npm install command, if you specified the ~ syntax and a patch release of a package has been released, that one is going to be installed. Same for ^ and
minor releases.

If you specify exact versions, like 0.13.0 in the example, you are not affected by this problem.

It could be you, or another person trying to initialize the project on the other side of the world by running npm install.

So your original project and the newly initialized project are actually different. Even if a patch or minor release should not introduce breaking changes, we all know bugs can (and so, they will) slide in.

The package-lock.json sets your currently installed version of each package in stone, and npm will use those exact versions when running npm ci.

This concept is not new, and other programming languages package managers (like Composer in PHP) have used a similar system for years.

The package-lock.json file needs to be committed to your Git repository,
so it can be fetched by other people, if the project is public or you have
collaborators, or if you use Git as a source for deployments.

The dependencies versions will be updated in the package-lock.json file when you run npm update.

NPX----
npx is a very powerful command that's been available in npm starting version 5.2, released in July 2017.

If you don't want to install npm, you can install npx as a standalone package

npx lets you run code built with Node.js and published through the npm registry.

Live examples are available in video

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Node.js - Section 9 Node Package json | NodeJS Beginners | Simple Tutorials | Easy Learning», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.