1
00:00:00,780 --> 00:00:04,860
Let's continue doing a little bit of set up between our Seelie and local API packages.

2
00:00:05,310 --> 00:00:09,150
We're going to start to add in some code to both our Seelie and the local API.

3
00:00:09,360 --> 00:00:11,920
We're then going to link them together using Lernout.

4
00:00:12,600 --> 00:00:13,260
But here's the goal.

5
00:00:13,710 --> 00:00:18,740
Inside of our local API, we're going to create an index JS file inside there.

6
00:00:18,750 --> 00:00:20,580
We're going to export a simple function.

7
00:00:20,820 --> 00:00:24,630
Whenever that thing gets called, we're going to do a simple console log of server started.

8
00:00:25,910 --> 00:00:31,200
Then inside of our packages on file, we'll make sure that we add in a main property of indexer.

9
00:00:32,330 --> 00:00:35,990
Remember what this main property does inside of eight packages on file.

10
00:00:36,260 --> 00:00:39,650
We spoke about this property much earlier inside the course when we were discussing bundling.

11
00:00:40,100 --> 00:00:47,300
This tells all other packages that are trying to use local API with the main entry file is for this

12
00:00:47,300 --> 00:00:47,800
package.

13
00:00:48,470 --> 00:00:55,100
So a main of index, James says that if you ever try to require in local API, you're going to get back

14
00:00:55,280 --> 00:00:55,870
index.

15
00:00:57,990 --> 00:01:03,360
Then over inside of our Seelie, we're going to make sure that we tell llena that these two packages

16
00:01:03,360 --> 00:01:09,750
are somehow linked, so we're going to add in local API as a dependency to our project.

17
00:01:12,800 --> 00:01:18,920
Then inside the index, his file, we'll add in a require statement or that serve function.

18
00:01:19,250 --> 00:01:24,290
We're going to try to require it from local API and then finally, we will try manually calling the

19
00:01:24,290 --> 00:01:28,460
search function, which could end up giving us that log of server started.

20
00:01:29,730 --> 00:01:34,920
This diagram is really showing everything we need, we have to make sure the package is on file inside

21
00:01:34,920 --> 00:01:38,010
of me or inside of local API has this main property.

22
00:01:38,580 --> 00:01:43,800
We have to create an index JS file inside of both packages, and then we have to set up a link between

23
00:01:43,800 --> 00:01:44,820
them using llena.

24
00:01:45,120 --> 00:01:48,120
So let's get to it back at my code editor.

25
00:01:48,930 --> 00:01:51,200
I'll first begin inside of my local API.

26
00:01:51,840 --> 00:01:53,790
I'm going to find the package JSON file.

27
00:01:54,450 --> 00:02:00,420
It looks like there's already an option in here of main index, so that has been taken care of for us.

28
00:02:02,580 --> 00:02:08,250
Next up, inside of local API, I will make a new file of index dogs.

29
00:02:10,449 --> 00:02:16,050
Inside of here, I'll do a module, exports of a function, and whenever it gets cold, we'll do a console

30
00:02:16,150 --> 00:02:18,370
log of server started.

31
00:02:21,800 --> 00:02:25,940
All right, let's believe it or not, pretty much all we have to do right now inside a local API.

32
00:02:26,630 --> 00:02:31,250
So now next up, we're going to form this link between Seelie and local API.

33
00:02:31,700 --> 00:02:35,370
And for that, we are once again going to use that llena add command.

34
00:02:36,230 --> 00:02:37,340
So back at our terminal.

35
00:02:39,890 --> 00:02:44,960
Inside of any folder, inside of our overall project, we will run llena add.

36
00:02:45,900 --> 00:02:51,840
Local AP, we want to add this package to another package inside of our project, and we want to be

37
00:02:51,840 --> 00:02:54,320
very explicit about which package we are adding this to.

38
00:02:54,330 --> 00:02:59,340
So we're going to add on that dash dash scope command and we will add in Seelie.

39
00:03:00,190 --> 00:03:07,010
That means find the package and make sure it gets linked somehow to the local AP package.

40
00:03:07,430 --> 00:03:12,630
Now, Seelie will be depending upon local API, so I'm going to run that.

41
00:03:13,660 --> 00:03:16,210
And very quickly, we just got kicked right back over.

42
00:03:19,180 --> 00:03:26,290
Next up inside of our zeolite directory, we're going to create this indexed JS file where we will attempt

43
00:03:26,290 --> 00:03:28,660
to require in the local API package.

44
00:03:29,760 --> 00:03:33,330
Let's go back inside my editor once again, I will find Seelie.

45
00:03:34,300 --> 00:03:36,760
I will make an index just file inside of that.

46
00:03:38,130 --> 00:03:41,400
At the top, I'm going to require serve.

47
00:03:42,940 --> 00:03:45,070
From local API.

48
00:03:46,160 --> 00:03:48,470
And then I will call serve like so.

49
00:03:50,130 --> 00:03:55,320
And that's it, everything should now be linked up, as a matter of fact, if we open up our node modules

50
00:03:55,320 --> 00:04:00,090
directory inside of Seelie, you'll now notice that we've got local API right here.

51
00:04:00,100 --> 00:04:03,000
So there is our dependency inside the folder.

52
00:04:04,290 --> 00:04:09,540
Now, let's try running the Seeley's Index JS file from our terminal, we're going to execute that thing

53
00:04:09,540 --> 00:04:13,770
manually and we should see a console log of server started.

54
00:04:15,050 --> 00:04:16,279
All right, so back at my terminal.

55
00:04:17,750 --> 00:04:20,149
I will change back over to our Seelie directory.

56
00:04:22,029 --> 00:04:25,800
There's the index JS file, so I will do Noad Index.

57
00:04:26,620 --> 00:04:28,500
And sure enough, there's our council log.

58
00:04:29,050 --> 00:04:29,680
Perfect.

59
00:04:30,580 --> 00:04:34,120
Now, remember, one of those key things I mentioned around Lliana is that we should be able to make

60
00:04:34,120 --> 00:04:40,450
changes at will to our dependency and immediately see those changes show up inside of whatever project

61
00:04:40,450 --> 00:04:42,560
or whatever other package is requirement in.

62
00:04:43,090 --> 00:04:50,190
So in this case, we're going to try making a change to local API instead of doing a log of server started

63
00:04:50,200 --> 00:04:53,170
will change that to server is listening.

64
00:04:55,020 --> 00:05:00,300
We're going to only update that file right there, and we're going to expect to see that update reflected

65
00:05:00,300 --> 00:05:03,630
over inside of Seelie the next time we run this package.

66
00:05:05,590 --> 00:05:09,340
So let's go back over to our local API indexed JS file.

67
00:05:10,240 --> 00:05:13,980
We will update the council, log to server is listening.

68
00:05:14,980 --> 00:05:15,700
Save this.

69
00:05:16,870 --> 00:05:18,580
And now, once again, if we go over to our terminal.

70
00:05:20,220 --> 00:05:27,810
And run note index dogs inside of our Seelie directory, we now see server is listening perfect.

71
00:05:29,030 --> 00:05:30,240
So this is pretty much it.

72
00:05:30,260 --> 00:05:33,280
This is a demonstration of exactly the behavior we want to learn.

73
00:05:33,770 --> 00:05:38,960
We can change all these different packages as much as we want in the development environment and instantly

74
00:05:38,960 --> 00:05:42,370
see all these changes reflected inside of our other projects.

75
00:05:42,800 --> 00:05:48,830
So that means that we skip that entire process of having to republish this thing off to NPM, get a

76
00:05:48,830 --> 00:05:52,660
new version number for it, and then have to update the local version used by Seelie.

77
00:05:52,670 --> 00:05:56,780
We don't have to go through that process, which is what we would potentially have to do if we were

78
00:05:56,780 --> 00:05:58,530
not making use of a tool like Lernout.

79
00:05:59,390 --> 00:06:03,950
This looks pretty good now that we've got this kind of baseline set up, we can start to dive a little

80
00:06:03,950 --> 00:06:09,260
bit more into some of the internals, the implementation of our Seelie and local API projects.

