![]() ![]() Because it allows you to sort of have a group of published artifacts that are associated with the single repository. And this is a common convention that's used for library style mana repos. So if I call my, if I call this package, at flack slash types, I'm using what is called a scope for my package, meaning when I publish these to NPM, they're all going to be sort of owned by a single org. Now I do want to talk a little bit about this, naming convention. And then we've got some source code and some tests. We have a Ts config, If you've seen these before, this kind of looks like a very typical one with sort of the strictness you know, cranked up to 11. So we have a pretty small and thin package JSON. ![]() ![]() Now I want us to look at what's going on here. So you get packages types, and then the rest of this code here. Or if you could do the command line version of this, but we effectively just wanna move it into this packages folder, just like this. It's got its own package JSON and a Ts config, which is our Type Script configuration. And you'll see that within this yarn workspaces folder, we have something called types. So we save this just to save ourselves a little bit of work.Now if you go into this course Files folder, which is where we're going to get a lot of the things that will become part of our project. As long as we establish the convention Darren's just going to find things as we drop new folders into this, this packages folder. I kind of like this wild card approach because that's what's gonna let us add additional packages here without having to touch this file, right? Now you could, if you want to have a bunch of things in the root of your project, you could say Library a, Something like this, or you could just press a bunch of things. That's where yarn can look to find them. Any sub folders within packages should be regarded as packages that are part of this workspace. And number two, any subfolders found within the packages folder, which I can create now. Now what we're telling yarn here is that number one, we want to use this feature called the yarn workspaces. And we're gonna say packages star, right? So it's an array and We can put one or more values in this array. And let's call it workspaces, actually, I'm not gonna say let's call it workspaces, because that implies that other things would be appropriate here, it must be workspaces. The first thing we're going to do is add a new property here. So I decided to give you the starting point. I will start with it, basically an empty project and go through the process of creating this file, but it's kind of boring. I start even earlier than what you see here. In fact, if you follow the instructions in step one The workshop project. And this is basically what you get out of the box if you just run yarn in net. The first thing we're gonna have to do today is take our package json at the root of our project. So I want your time, focused as much as possible on the meaningful stuff that has to do with working with a mono repo. A lot of the work that we're going to be doing today, has to do with configuring our project and setting up some build scripts and things like that. Because I don't want you to be spending time writing code. And that includes some of the source code for example that you're going to be working with today. And then there's this folder called course files. So this contains a markdown files that represent each step of the project that we're going to take today. There's not much here, There's a notes folder. So, if you check out your project, you should see something similar to what I'm seeing on the screen. For this course, compared to say, a TypeScript course, but it does offer some benefits in this case. Make sure you're using Visual Studio code as well if you wanna see what I see on the screen, a little bit less important to use VS.code. When looking at the read me, you're gonna wanna make sure that you follow the instructions to install volta, which helps manage your node and your yarn versions, so you get the correct version for this project. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |