Moving forward, we're going to focus on the implementation of our Seelie package and the local API
package, so we're going to kind of just forget for a little bit that we even have this Riak project.
Remember, these are two separate packages, even though it's going to eventually seem like they should
really be the same package.
So the only goal of our Seelie is to start up the local node API.
And so, like I said, you're going to eventually say, hey, these things should really be the same
package.
But the reason we are creating the Seelie separately is, remember, we might eventually want to add
in some additional commands to it, such as JDBC publish, which would involve making a request off
to our public API.
That logic wouldn't really be appropriate for putting into our local node API.
So that's why we are keeping these two things separate.
So to create these two packages, all we have to do is create some new folders inside of our packages
directory and then inside of each of these folders, we are going to generate a new package, JSON file.
Let's do that right away, back at our terminal.
Back at my terminal, I'm inside of my overall job directory, so there's my is on file and the packages
folder, I'm also going to make sure that I open up my code editor inside of this directory as well.
I did that very shortly before this video, but here's my editor.
You'll notice I've got my packages directory right there.
Inside of it right now is just the local client, which has all of our code.
There's learned JSON.
There's package DOT, JSON.
OK, so back over at the terminal, I will change into packages, I'm going to create a new folder called
Kellye.
And another folder called Local Dash API.
Then inside of each of those directories, I'll do a quick Nghiem and knit dash y to generate some package
JSON files, I'll first begin inside of the directory.
So Nkem in it.
Dashi.
I'll change back out.
And go into my local AP directory and inside there, I'll do another NPM in it, Dashi.
OK, simple enough.
Now, we definitely need to start adding in a couple of dependencies to our Seelie directory and the
local API as well.
For example, the local API project, we probably want that to use express maybe some other stuff.
And our Seelie, we might want to install a package to help us pass any incoming command line arguments
and stuff like that.
So you might be very tempted at this point to do an NPM install to add in some modules to both the projects
we just added in.
But here's the very first Gocha with Lernout.
This is really important, so please.
Stay tuned in for this part right here, extremely important, whenever we start making use of llena,
we are not going to manually install new modules at any point in time.
So as soon as you start using Launa inside of this project, we just forget that the installed command
even exists.
We are never, ever going to run and install.
Instead, we delegate all the additions of any modules, any installation, any removal, any updates,
all that stuff we delegated off to learn instead.
So llena is going to be managing all the different dependencies across our different projects.
So rather than using a command of NPM install, we're going to instead use a command of llena at.
This is extremely important, if you ever run and start moving forward, you're going to break all your
code, you're going to be a little bit confused as to why stuff isn't working as expected.
And you're going to eventually have to delete all your dependencies and reinstall them with llena.
So please remember, do not do an NPM install.
To understand a little a little bit more about the ad itself, we're going to go take a look at documentation
very quickly.
We can find some documentation or learn at this link.
So I'm going to take this link and open it up inside of a new browser tab.
So here it is right here.
I'm going to scroll down to the README.
And inside the README is a link to documentation on some different commands that are included with Elena
Seelie, which we just installed onto our local machine.
So we already made use of Lernout in it a moment ago.
To install any dependencies, we're going to start to run that command of learn to add, it's going
to go to the documentation for that command.
So if you want to you you can take a quick glance at some of the documentation, all you really need
to understand here is that if we ever want to add in a package, we're going to run llena, add the
name of the package off of NPM and then.
By default, this is really unexpected, but if you just do learn to add by itself, it is going to
add in that package to all the different packages inside of your packages directory.
So, for example, right now, if we did a Lernout Add Express Express would be added in to every single
module inside of our packages directory.
So we would add it into Seelie and local API and local client.
That is very rarely the behavior you want.
You very rarely want to add in a dependency to all of your different packages.
So instead you have to scope this command and be very clear, very explicit about exactly which modules
are going to get this new dependency.
So most frequently we're going to run a command that looks like this one right here.
We will do something like learn to add the name of the dependency that we want to install.
And then we are going to add on the scope option scope is going to dictate which of our packages we
want to add this new dependency to.
So, for example, if we want to add in a new a new package to our CLIA project, we would end up running
something like llena, Ad Express, Dash, Dash, Scope, and then Seelie, which is the name of our
Seelie project that would add in Express only to our Seelie sub project.
Now, in this case, we don't actually want to add in express to our satellite project, so we're not
going run this particular command.
But one package that we are going to add into our satellite package is the commander package.
Commander, if you're not familiar with it as little new module, that just makes it easier to read
in command line arguments.
It is very commonly used inside of any kind of program that is meant to behave as a satellite.
So we're going to understand a little bit more about commander here in just a little bit.
But let's use this command right now to add in that package where Seelie module.
All right, so back at my terminal.
Inside of any directory, inside of our project, so it just has to be inside of the book directory,
doesn't matter where we run this command.
So right now I'm inside a local API.
We are going to run llena ad samandar dash dash scope equals Seelie.
And we'll see some very familiar login information here, it definitely looks like something is being
installed from NPM.
And after a brief moment or two, eventually it should resolve and say, OK, everything was installed
successfully.
I'm going to let it do its thing really quickly and then eventually after it gets installed, we should
see a new edition inside of our Seelie package JSON file, and there should eventually be a dependency
listed inside of your of commander.
Looks like that was already added in.
And so right now, my terminal is probably just downloading all the source code for a commander itself
and adding it into this new node modules directory.
OK, so, again, the big takeaway here is we just forget that and install it even exists and we instead
make use of this Lelaina at command and the vast, vast majority of the time we probably want to add
on that scope option.
As one last little side note here, you might be a little bit curious why we are allowing llena to manage
our dependencies at all?
Well, it all comes down to one of the reasons that we're even using in the first place.
Remember, we spoke a little bit ago about how we want to be able to develop one module and have changes
we make to that module, show up inside of another project or another module instantly.
So when we are making use of learning and we start to depend upon this behavior of linking between different
packages, well, if we start running an install command, all these connections are just going to be
broke, broken by NPM.
So that's why we are relying upon Lernout instead.
All right, very good.
So let's take a pause right here and move on in just a moment.