Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,390 --> 00:00:02,140
Hello, everyone, and welcome back.
2
00:00:02,700 --> 00:00:08,850
In this video, I'm going to show you how you can update the packages that your project depends on to
3
00:00:08,850 --> 00:00:10,150
the latest versions.
4
00:00:10,650 --> 00:00:15,900
I'm going to show you with our Final Monsters Rolodex project where I will update, react and react,
5
00:00:15,900 --> 00:00:20,430
Dom, to the latest versions, as well as any dev dependencies that they have.
6
00:00:20,520 --> 00:00:26,400
And the steps are very easy and you can reproduce them whenever you need to update your libraries in
7
00:00:26,400 --> 00:00:27,270
your projects.
8
00:00:27,870 --> 00:00:33,930
So to start, I'm going to close down the final completed version of our Monsters Rolodex project.
9
00:00:34,290 --> 00:00:39,000
You can do this with an existing project if you don't want to clone one down and let's say you have
10
00:00:39,000 --> 00:00:42,690
a local one that you just want to update, the steps are going to remain the same.
11
00:00:42,690 --> 00:00:46,780
But I want to show you with a fresh cloned project as well.
12
00:00:47,340 --> 00:00:53,160
So what I'm going to do is I'm going to copy down the link and I'm going to switch into my terminal
13
00:00:53,160 --> 00:00:55,380
and then clone down the project.
14
00:00:56,270 --> 00:01:02,270
So once you have the project down, let's just cut into it, I do want to mention a couple of things.
15
00:01:02,900 --> 00:01:09,020
Depending on the project that you closed down, you may already have a lock file in this particular
16
00:01:09,020 --> 00:01:09,380
case.
17
00:01:09,380 --> 00:01:14,810
If we look at unless we see we already have a yard lock file in this particular example, I want to
18
00:01:14,810 --> 00:01:16,590
show everyone how to do it with NPM.
19
00:01:16,910 --> 00:01:21,620
So if there exists a yarn lock file already, we can just remove this lock file.
20
00:01:22,610 --> 00:01:27,590
In this particular case, this works because we are planning on updating all of our packages anyways.
21
00:01:27,680 --> 00:01:34,130
These lock files tell our package what versions are currently locked to the project.
22
00:01:34,280 --> 00:01:38,450
But if we're seeking to update all of these versions anyways, it does not matter.
23
00:01:38,540 --> 00:01:39,590
In this particular case.
24
00:01:39,590 --> 00:01:45,920
I also want to use NPM and if we come up with a package lock file, which is the NPM version of the
25
00:01:45,920 --> 00:01:48,980
lock file, then these two things might cause conflict.
26
00:01:49,070 --> 00:01:53,350
So this is one thing you always want to think about when you clone down a new project.
27
00:01:53,750 --> 00:01:56,090
So here I have our project.
28
00:01:56,090 --> 00:02:01,250
We have no dependencies installed yet and our John Lock File just got removed.
29
00:02:01,610 --> 00:02:07,580
In this particular case, what we want to do is we want to run NPM update D.
30
00:02:07,970 --> 00:02:12,620
So here what we're saying is I want to update all of the existing dependencies.
31
00:02:12,620 --> 00:02:19,460
If you are using a project that already exists in my case, because it is a newly clone project, there
32
00:02:19,460 --> 00:02:21,290
are no existing dependencies yet.
33
00:02:21,590 --> 00:02:26,440
Update we'll still install any projects or dependencies that don't exist.
34
00:02:26,870 --> 00:02:31,460
So Dashty here is also going to give me all of the dev dependencies.
35
00:02:32,000 --> 00:02:34,280
So when I run this, it could take a little bit of time.
36
00:02:34,280 --> 00:02:35,870
So let's just fast forward through this.
37
00:02:38,680 --> 00:02:45,910
So here we have finished installing or updating our respective packages, you may notice that down here
38
00:02:45,910 --> 00:02:50,230
you'll see that there were five vulnerabilities or however many vulnerabilities when you run it.
39
00:02:50,740 --> 00:02:55,750
This just means that there might be some versions that are insecure of the packages that you installed
40
00:02:55,870 --> 00:02:57,430
or there might be other issues.
41
00:02:57,760 --> 00:03:02,550
The great thing about our package manager, whether it be NPM or yarn, is that they can fix this.
42
00:03:03,070 --> 00:03:05,830
So here are NPM actually tells us exactly what to do.
43
00:03:05,840 --> 00:03:08,350
We just run NPM audit fix.
44
00:03:08,890 --> 00:03:13,960
Sometimes when you run this command, though, you may get some type of error involving your package
45
00:03:13,960 --> 00:03:14,330
lock.
46
00:03:14,920 --> 00:03:16,260
So here we got that error.
47
00:03:16,390 --> 00:03:19,930
It says that something was found to be wrong with our package locked JSON.
48
00:03:19,930 --> 00:03:22,270
We want to run NPM install so we can fix them.
49
00:03:22,540 --> 00:03:28,070
So once again, very easily we can just npm install and we're going to go through that whole thing again.
50
00:03:28,090 --> 00:03:30,120
So let's just fast forward to this part as well.
51
00:03:32,700 --> 00:03:39,030
And here we'll see that we have once again finished our install any of those particular issues that
52
00:03:39,030 --> 00:03:44,160
came, we tried to run NPM out to fix the first time we're going to be resolved, but you'll notice
53
00:03:44,160 --> 00:03:46,710
that we still have our five vulnerabilities.
54
00:03:47,040 --> 00:03:53,870
So here once again, if we run NPM audit fix, this should now work and get rid of those problems.
55
00:03:54,360 --> 00:03:59,880
This process of auditing might also be quite extensive because there's so many different packages that
56
00:03:59,880 --> 00:04:05,270
we have installed through any of our major packages like react and react, Dom.
57
00:04:05,640 --> 00:04:09,620
But what we're doing here is we're essentially trying to fix any of these issues.
58
00:04:09,900 --> 00:04:15,120
So walking through the steps that we just went through, the first thing we did is we said, let's upgrade
59
00:04:15,120 --> 00:04:17,100
all of our package versions.
60
00:04:17,220 --> 00:04:22,290
Once they're upgraded, there might be some dependency issues and vulnerabilities which were highlighted
61
00:04:22,290 --> 00:04:22,690
to us.
62
00:04:23,040 --> 00:04:28,770
So what we're doing now is we're saying, OK, take all of those vulnerabilities, NPM and I want you
63
00:04:28,770 --> 00:04:31,110
to fix them to the best that you can.
64
00:04:31,290 --> 00:04:38,040
Maybe change semantic versions to versions that still work with our given updated versions of our packages
65
00:04:38,040 --> 00:04:38,880
that we want.
66
00:04:39,180 --> 00:04:43,320
But make sure that you give us versions of it that don't have these problems.
67
00:04:43,320 --> 00:04:48,660
And NPM will know how to do all of this for us, which is the great thing about using these package
68
00:04:48,660 --> 00:04:49,200
managers.
69
00:04:49,800 --> 00:04:52,320
So it's going through these steps and now we're done.
70
00:04:52,530 --> 00:04:56,730
We'll see that all five of the five different vulnerabilities were fixed.
71
00:04:56,730 --> 00:05:02,070
And if we run NPM audit, we'll see that there are no vulnerabilities.
72
00:05:02,790 --> 00:05:08,640
So now that we've updated all of our packages and we have the latest versions, what we can do now is
73
00:05:08,640 --> 00:05:10,440
just run, npm start.
74
00:05:11,360 --> 00:05:15,050
So let's just start a project and make sure that everything is working as it should be.
75
00:05:16,870 --> 00:05:22,360
And we can see that our monstrous Rolodex is completely working here, and if you want to double check
76
00:05:22,360 --> 00:05:28,650
to make sure you have the right versions, all we need to do is just open up our project.
77
00:05:28,960 --> 00:05:33,820
So here I'm going to make a new tab and have our server running on the other tab and just open up this
78
00:05:33,820 --> 00:05:34,480
project.
79
00:05:35,260 --> 00:05:39,810
And what we want to do is go to the lock file inside of the lock file.
80
00:05:40,000 --> 00:05:44,750
Remember, this log file tells us what versions of our packages were currently tied to.
81
00:05:45,070 --> 00:05:53,800
So if you go find the react or the React Dom library in this particular case, you'll see here that
82
00:05:53,800 --> 00:05:57,080
we have the latest version, which is exactly what we want.
83
00:05:57,520 --> 00:06:02,650
So this means that all of our projects and all of our packages are now updated to their correct version.
84
00:06:02,770 --> 00:06:04,080
And this is all we need to do.
85
00:06:04,900 --> 00:06:10,840
One last thing that I do want to mention is that due to a recent change, perhaps the master branch
86
00:06:10,840 --> 00:06:14,170
of your project is now called the main branch.
87
00:06:14,770 --> 00:06:17,960
In our particular case, you'll see that mine is still called the master branch.
88
00:06:17,980 --> 00:06:24,190
So this is just something that might have not been updated yet with my project, but GitHub is rolling
89
00:06:24,190 --> 00:06:25,240
out this change.
90
00:06:25,720 --> 00:06:30,820
So one last thing that we might want to do now that we've made all of these updates is just to push
91
00:06:30,820 --> 00:06:36,170
up the latest version that we've updated to our remote repository on GitHub.
92
00:06:36,730 --> 00:06:40,360
So what I'm going to do is I'm just going to say get add a.
93
00:06:41,860 --> 00:06:42,730
Get Kimmitt
94
00:06:45,250 --> 00:06:54,940
updated our packages to latest version removed and fixed any vulnerabilities.
95
00:06:59,110 --> 00:07:00,580
And then I'm just going to get push.
96
00:07:06,010 --> 00:07:09,430
And now if we go back to our project and we refresh.
97
00:07:12,010 --> 00:07:17,470
We'll see that we updated some of our different problems a couple of seconds ago, so here this is all
98
00:07:17,470 --> 00:07:19,480
we need to do to update all of our packages.
99
00:07:19,930 --> 00:07:25,090
I've also linked in your resources folder for this video, our final project.
100
00:07:25,090 --> 00:07:30,760
When it comes to the Crown Clothing Project, I have the front end link for you so you can clone it
101
00:07:30,760 --> 00:07:33,640
down and practice what you've just learned with me here.
102
00:07:33,790 --> 00:07:36,160
You can do it with yarn or you can do with NPM.
103
00:07:36,580 --> 00:07:42,550
Just practice it and update the latest version of React and React Dom or any of the other dependencies
104
00:07:42,550 --> 00:07:43,720
that we have in that project.
105
00:07:43,720 --> 00:07:47,140
If you want to try it out, you can also do it with your local version as well.
106
00:07:47,170 --> 00:07:52,510
You don't necessarily have to do it with a freshly clone project, but I've included the link for you
107
00:07:52,540 --> 00:07:54,010
just in case you want to practice.
108
00:07:54,370 --> 00:07:55,150
But that's it.
109
00:07:55,540 --> 00:07:58,840
That's all you need to know when it comes to updating packages.
11219
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.