Understanding and Utilizing PNPM - An efficient package manager for Node.js

An introduction to PNPM and its benefits.

Project Source Code

Get the project source code below, and follow along with the lesson material.

Download Project Source Code

To set up the project on your local machine, please follow the directions provided in the README.md file. If you run into any issues with running the project source code, then feel free to reach out to the author in the course's Discord channel.

  • |

Lesson Transcript

  • [00:00 - 00:15] Welcome to lesson 2. In the last lesson we learned about P&PM and what it brings to our project. In this lesson we are going to set up a mono-report folder structure with P&PM workspaces.

  • [00:16 - 00:40] To start you can create an empty folder. Let's name it mono-report with NX. Fire up your Wishes Studio instance and the newly created folder. In order to create a P&PM workspace you can create a file named pnpm-workspace.yaml.

  • [00:41 - 01:08] Once you created this file we can add the packages we want in our repo story. This is a place where we can define our architecture for the mono-report.

  • [01:09 - 01:39] I'm planning to add an app section as well as packages section. In the app section we will create our apps. For example the React application that we are going to build. And in the packages section we can build libraries that we are planning to share across different repositories.

  • [01:40 - 02:21] This is a place where we can define the boundaries. Identify the different logical grouping domains of code. Bear in mind the names we gave here are not mandatory except for line one packages. Appcent packages in line two and three are what we decide to call our modules.

  • [02:22 - 02:56] For example you could have used a name like modules here. And this would be perfectly fine. It 's up to you to name your modules and the structure. Let's change the name back to packages. So here we are planning to add our React application in the apps folder. And maybe build a library inside the packages folder. Once we build that library in the package folder we can export it.

  • [02:57 - 04:01] And in the apps folder the React application can import that package and use it . So this way we can have more than one application sitting inside the apps folder. Sharing a shared library that's inside the packages folder. So for example you could have your React app sitting inside the apps folder as well as your server app. In the package folder you could have your shared UI library. And let's say shared utils. And that's it for this lesson. In this lesson we learned how to set up pnpm workspace and build your mono repo folder structure. In the next lesson we are going to look at what Nx is. See you in the next lesson.

Welcome to lesson 2. In the last lesson we learned about P&PM and what it brings to our project. In this lesson we are going to set up a mono-report folder structure with P&PM workspaces. To start you can create an empty folder. Let's name it mono-report with NX. Fire up your Wishes Studio instance and the newly created folder. In order to create a P&PM workspace you can create a file named pnpm-workspace.yaml. Once you created this file we can add the packages we want in our repo story. This is a place where we can define our architecture for the mono-report. I'm planning to add an app section as well as packages section. In the app section we will create our apps. For example the React application that we are going to build. And in the packages section we can build libraries that we are planning to share across different repositories. This is a place where we can define the boundaries. Identify the different logical grouping domains of code. Bear in mind the names we gave here are not mandatory except for line one packages. Appcent packages in line two and three are what we decide to call our modules. For example you could have used a name like modules here. And this would be perfectly fine. It 's up to you to name your modules and the structure. Let's change the name back to packages. So here we are planning to add our React application in the apps folder. And maybe build a library inside the packages folder. Once we build that library in the package folder we can export it. And in the apps folder the React application can import that package and use it . So this way we can have more than one application sitting inside the apps folder. Sharing a shared library that's inside the packages folder. So for example you could have your React app sitting inside the apps folder as well as your server app. In the package folder you could have your shared UI library. And let's say shared utils. And that's it for this lesson. In this lesson we learned how to set up pnpm workspace and build your mono repo folder structure. In the next lesson we are going to look at what Nx is. See you in the next lesson.