1
00:00:01,050 --> 00:00:06,330
Moving forward, we're going to focus on the implementation of our Seelie package and the local API

2
00:00:06,330 --> 00:00:10,470
package, so we're going to kind of just forget for a little bit that we even have this Riak project.

3
00:00:11,030 --> 00:00:14,970
Remember, these are two separate packages, even though it's going to eventually seem like they should

4
00:00:14,970 --> 00:00:16,400
really be the same package.

5
00:00:16,920 --> 00:00:20,790
So the only goal of our Seelie is to start up the local node API.

6
00:00:21,090 --> 00:00:25,170
And so, like I said, you're going to eventually say, hey, these things should really be the same

7
00:00:25,170 --> 00:00:25,650
package.

8
00:00:25,900 --> 00:00:29,550
But the reason we are creating the Seelie separately is, remember, we might eventually want to add

9
00:00:29,550 --> 00:00:34,430
in some additional commands to it, such as JDBC publish, which would involve making a request off

10
00:00:34,590 --> 00:00:35,850
to our public API.

11
00:00:36,240 --> 00:00:39,890
That logic wouldn't really be appropriate for putting into our local node API.

12
00:00:40,140 --> 00:00:42,210
So that's why we are keeping these two things separate.

13
00:00:43,160 --> 00:00:47,840
So to create these two packages, all we have to do is create some new folders inside of our packages

14
00:00:47,840 --> 00:00:53,480
directory and then inside of each of these folders, we are going to generate a new package, JSON file.

15
00:00:54,030 --> 00:00:55,790
Let's do that right away, back at our terminal.

16
00:00:56,810 --> 00:01:03,440
Back at my terminal, I'm inside of my overall job directory, so there's my is on file and the packages

17
00:01:03,440 --> 00:01:08,660
folder, I'm also going to make sure that I open up my code editor inside of this directory as well.

18
00:01:09,050 --> 00:01:13,000
I did that very shortly before this video, but here's my editor.

19
00:01:13,010 --> 00:01:15,350
You'll notice I've got my packages directory right there.

20
00:01:15,800 --> 00:01:19,370
Inside of it right now is just the local client, which has all of our code.

21
00:01:20,150 --> 00:01:21,170
There's learned JSON.

22
00:01:21,170 --> 00:01:22,370
There's package DOT, JSON.

23
00:01:23,930 --> 00:01:30,140
OK, so back over at the terminal, I will change into packages, I'm going to create a new folder called

24
00:01:30,320 --> 00:01:31,010
Kellye.

25
00:01:32,050 --> 00:01:35,590
And another folder called Local Dash API.

26
00:01:37,110 --> 00:01:42,810
Then inside of each of those directories, I'll do a quick Nghiem and knit dash y to generate some package

27
00:01:42,810 --> 00:01:46,680
JSON files, I'll first begin inside of the directory.

28
00:01:47,430 --> 00:01:48,660
So Nkem in it.

29
00:01:48,670 --> 00:01:49,320
Dashi.

30
00:01:52,720 --> 00:01:54,160
I'll change back out.

31
00:01:55,490 --> 00:02:03,170
And go into my local AP directory and inside there, I'll do another NPM in it, Dashi.

32
00:02:04,910 --> 00:02:06,080
OK, simple enough.

33
00:02:07,260 --> 00:02:13,250
Now, we definitely need to start adding in a couple of dependencies to our Seelie directory and the

34
00:02:13,370 --> 00:02:14,690
local API as well.

35
00:02:15,020 --> 00:02:19,880
For example, the local API project, we probably want that to use express maybe some other stuff.

36
00:02:20,240 --> 00:02:25,520
And our Seelie, we might want to install a package to help us pass any incoming command line arguments

37
00:02:25,520 --> 00:02:26,450
and stuff like that.

38
00:02:27,030 --> 00:02:32,480
So you might be very tempted at this point to do an NPM install to add in some modules to both the projects

39
00:02:32,480 --> 00:02:33,460
we just added in.

40
00:02:33,920 --> 00:02:37,100
But here's the very first Gocha with Lernout.

41
00:02:38,130 --> 00:02:39,930
This is really important, so please.

42
00:02:40,840 --> 00:02:45,690
Stay tuned in for this part right here, extremely important, whenever we start making use of llena,

43
00:02:46,300 --> 00:02:50,800
we are not going to manually install new modules at any point in time.

44
00:02:51,490 --> 00:02:56,470
So as soon as you start using Launa inside of this project, we just forget that the installed command

45
00:02:56,470 --> 00:02:57,610
even exists.

46
00:02:57,940 --> 00:03:00,360
We are never, ever going to run and install.

47
00:03:00,880 --> 00:03:07,240
Instead, we delegate all the additions of any modules, any installation, any removal, any updates,

48
00:03:07,240 --> 00:03:10,580
all that stuff we delegated off to learn instead.

49
00:03:11,050 --> 00:03:15,100
So llena is going to be managing all the different dependencies across our different projects.

50
00:03:15,550 --> 00:03:20,770
So rather than using a command of NPM install, we're going to instead use a command of llena at.

51
00:03:21,860 --> 00:03:26,480
This is extremely important, if you ever run and start moving forward, you're going to break all your

52
00:03:26,480 --> 00:03:30,620
code, you're going to be a little bit confused as to why stuff isn't working as expected.

53
00:03:30,860 --> 00:03:35,710
And you're going to eventually have to delete all your dependencies and reinstall them with llena.

54
00:03:35,720 --> 00:03:38,150
So please remember, do not do an NPM install.

55
00:03:39,350 --> 00:03:44,360
To understand a little a little bit more about the ad itself, we're going to go take a look at documentation

56
00:03:44,360 --> 00:03:44,960
very quickly.

57
00:03:45,560 --> 00:03:48,200
We can find some documentation or learn at this link.

58
00:03:48,620 --> 00:03:51,860
So I'm going to take this link and open it up inside of a new browser tab.

59
00:03:55,820 --> 00:03:56,750
So here it is right here.

60
00:03:58,370 --> 00:04:00,350
I'm going to scroll down to the README.

61
00:04:02,040 --> 00:04:07,200
And inside the README is a link to documentation on some different commands that are included with Elena

62
00:04:07,200 --> 00:04:09,690
Seelie, which we just installed onto our local machine.

63
00:04:10,230 --> 00:04:13,350
So we already made use of Lernout in it a moment ago.

64
00:04:14,220 --> 00:04:18,630
To install any dependencies, we're going to start to run that command of learn to add, it's going

65
00:04:18,630 --> 00:04:20,730
to go to the documentation for that command.

66
00:04:22,250 --> 00:04:26,360
So if you want to you you can take a quick glance at some of the documentation, all you really need

67
00:04:26,360 --> 00:04:32,000
to understand here is that if we ever want to add in a package, we're going to run llena, add the

68
00:04:32,000 --> 00:04:34,850
name of the package off of NPM and then.

69
00:04:35,890 --> 00:04:41,410
By default, this is really unexpected, but if you just do learn to add by itself, it is going to

70
00:04:41,410 --> 00:04:45,860
add in that package to all the different packages inside of your packages directory.

71
00:04:46,240 --> 00:04:52,810
So, for example, right now, if we did a Lernout Add Express Express would be added in to every single

72
00:04:52,810 --> 00:04:55,430
module inside of our packages directory.

73
00:04:55,450 --> 00:04:59,700
So we would add it into Seelie and local API and local client.

74
00:05:00,160 --> 00:05:02,960
That is very rarely the behavior you want.

75
00:05:03,010 --> 00:05:06,730
You very rarely want to add in a dependency to all of your different packages.

76
00:05:07,250 --> 00:05:13,930
So instead you have to scope this command and be very clear, very explicit about exactly which modules

77
00:05:13,930 --> 00:05:15,520
are going to get this new dependency.

78
00:05:16,420 --> 00:05:20,560
So most frequently we're going to run a command that looks like this one right here.

79
00:05:21,070 --> 00:05:26,020
We will do something like learn to add the name of the dependency that we want to install.

80
00:05:27,330 --> 00:05:33,060
And then we are going to add on the scope option scope is going to dictate which of our packages we

81
00:05:33,060 --> 00:05:34,530
want to add this new dependency to.

82
00:05:35,070 --> 00:05:41,100
So, for example, if we want to add in a new a new package to our CLIA project, we would end up running

83
00:05:41,610 --> 00:05:50,280
something like llena, Ad Express, Dash, Dash, Scope, and then Seelie, which is the name of our

84
00:05:50,280 --> 00:05:55,290
Seelie project that would add in Express only to our Seelie sub project.

85
00:05:56,570 --> 00:06:00,440
Now, in this case, we don't actually want to add in express to our satellite project, so we're not

86
00:06:00,440 --> 00:06:01,640
going run this particular command.

87
00:06:01,970 --> 00:06:07,760
But one package that we are going to add into our satellite package is the commander package.

88
00:06:08,500 --> 00:06:12,410
Commander, if you're not familiar with it as little new module, that just makes it easier to read

89
00:06:12,410 --> 00:06:13,700
in command line arguments.

90
00:06:13,970 --> 00:06:19,140
It is very commonly used inside of any kind of program that is meant to behave as a satellite.

91
00:06:19,730 --> 00:06:22,670
So we're going to understand a little bit more about commander here in just a little bit.

92
00:06:22,940 --> 00:06:27,500
But let's use this command right now to add in that package where Seelie module.

93
00:06:29,350 --> 00:06:30,970
All right, so back at my terminal.

94
00:06:34,240 --> 00:06:38,950
Inside of any directory, inside of our project, so it just has to be inside of the book directory,

95
00:06:38,960 --> 00:06:40,420
doesn't matter where we run this command.

96
00:06:40,510 --> 00:06:42,210
So right now I'm inside a local API.

97
00:06:42,550 --> 00:06:50,620
We are going to run llena ad samandar dash dash scope equals Seelie.

98
00:06:54,420 --> 00:06:58,290
And we'll see some very familiar login information here, it definitely looks like something is being

99
00:06:58,290 --> 00:06:59,460
installed from NPM.

100
00:07:00,440 --> 00:07:04,790
And after a brief moment or two, eventually it should resolve and say, OK, everything was installed

101
00:07:04,790 --> 00:07:05,450
successfully.

102
00:07:06,310 --> 00:07:11,620
I'm going to let it do its thing really quickly and then eventually after it gets installed, we should

103
00:07:11,620 --> 00:07:17,200
see a new edition inside of our Seelie package JSON file, and there should eventually be a dependency

104
00:07:17,200 --> 00:07:18,670
listed inside of your of commander.

105
00:07:19,090 --> 00:07:20,560
Looks like that was already added in.

106
00:07:20,890 --> 00:07:25,900
And so right now, my terminal is probably just downloading all the source code for a commander itself

107
00:07:25,900 --> 00:07:28,150
and adding it into this new node modules directory.

108
00:07:29,120 --> 00:07:34,670
OK, so, again, the big takeaway here is we just forget that and install it even exists and we instead

109
00:07:34,670 --> 00:07:39,980
make use of this Lelaina at command and the vast, vast majority of the time we probably want to add

110
00:07:39,980 --> 00:07:41,270
on that scope option.

111
00:07:42,330 --> 00:07:46,890
As one last little side note here, you might be a little bit curious why we are allowing llena to manage

112
00:07:46,890 --> 00:07:48,180
our dependencies at all?

113
00:07:48,600 --> 00:07:52,680
Well, it all comes down to one of the reasons that we're even using in the first place.

114
00:07:53,430 --> 00:07:59,670
Remember, we spoke a little bit ago about how we want to be able to develop one module and have changes

115
00:07:59,710 --> 00:08:03,230
we make to that module, show up inside of another project or another module instantly.

116
00:08:04,080 --> 00:08:08,670
So when we are making use of learning and we start to depend upon this behavior of linking between different

117
00:08:08,670 --> 00:08:14,050
packages, well, if we start running an install command, all these connections are just going to be

118
00:08:14,050 --> 00:08:15,930
broke, broken by NPM.

119
00:08:16,350 --> 00:08:18,630
So that's why we are relying upon Lernout instead.

120
00:08:20,050 --> 00:08:20,720
All right, very good.

121
00:08:20,750 --> 00:08:23,110
So let's take a pause right here and move on in just a moment.

