No video

Package JSON Demystified - The 'Workspaces' Keyword

  Рет қаралды 4,799

A shot of code

A shot of code

Күн бұрын

In this Javascript tutorial on NPM Package.JSON we look at the 'WORKSPACES' keyword and how it helps us manage monrepo setups
With a monrepo we have maintenance and tasks that can be aided by ceratin tools. The workspaces feature of NPM is one such tool in that in allows us to NPM link all the sub packages to the main root package in our repo. This takes away the manual work associated with this. Workspaces can also help automate running of scripts against all of the sub projects. So it provides a nice bit of automation for us and can be built upon by other tools. So if the basic functionality is not enough then we can also incorporate other tools that build upon this such as 'Lerna'

Пікірлер: 11
@alanjouhar8313
@alanjouhar8313 2 жыл бұрын
Thank you very much for this video, I can listen to you for hours. I think your channel is really underrated. Maybe adding more quality videos like this one will help you grow.
@Ashotofcode
@Ashotofcode 2 жыл бұрын
Thanks Alan, much appreciated 🙂
@philjohnston5774
@philjohnston5774 2 жыл бұрын
Great explainer. Thanks!
@Ashotofcode
@Ashotofcode 2 жыл бұрын
Glad it was helpful Phil 🙂 Cheers Mark
@ajricherson1099
@ajricherson1099 Жыл бұрын
Really great teacher, thanks!
@Ashotofcode
@Ashotofcode Жыл бұрын
Glad it was helpful AJ - cheers Mark 🙂
@wendylee5498
@wendylee5498 2 жыл бұрын
Great video that explains the essence of workspaces with simple examples. Thanks for that. Got a question though, noticed "npm i" installs only one "node_modules" in the root directory, I also tried "yarn install" using the same folder structure and it behaves the same as your example. But I saw some other projects with yarn + workspaces, "yarn install" installs one "node_modules" for each subdirectory. In the context of the example, "yarn install" may create 3 "node_modules" in root directory, ./packages/cli/, and ./packages/cli2/ respectively. Any idea why? Or if extra configuration to enable/disable "node-modules" creations? (Hope I've made my question clear enough.. ) Thank you.
@dawnrazor
@dawnrazor 2 жыл бұрын
Great, thanks for this video. I do have a question. Is the parent worskspace individually source controlled from it's child packages? The first thing that came to mind was, how do I check in workspace items, without also checking in the child packages? Do I have to add the root of the child packages ('let's call this the packages folder) to the gitignore, or is this part of the functionality of npm workspaces, to recognise that the child packages are independently source controlled from the workspace (actually, like git submodules)? Thanks.
@Ashotofcode
@Ashotofcode 2 жыл бұрын
Good question! I'm not 100% sure to be honest. As I'm aware there is no granularity in a Github monorepo so nothing there to define checking in only one of the packages . That said I would imagine the process would be to create a new branch for any dev you perform on a particular package and that gives you the isolation required. So dev on other packages is also contained within their own branches and you can merge back to Master and push without pushing the other packages also. Sounds good? maybe! but not tried it out myself :-) Cheers Mark
@MichaelSalo
@MichaelSalo 2 жыл бұрын
Is each package just as easy to publish to npm, as if it were standalone?
@Ashotofcode
@Ashotofcode 2 жыл бұрын
Hi Michael, I'm thinking so yes, each package has its own package.json, so should be BAU. Cheers Mark 😀
npm workspaces and overrides #DemoDays
37:36
GitHub
Рет қаралды 9 М.
package.json is not enough
15:40
Hussein Nasser
Рет қаралды 53 М.
Incredible Dog Rescues Kittens from Bus - Inspiring Story #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 28 МЛН
SPILLED CHOCKY MILK PRANK ON BROTHER 😂 #shorts
00:12
Savage Vlogs
Рет қаралды 50 МЛН
what will you choose? #tiktok
00:14
Анастасия Тарасова
Рет қаралды 5 МЛН
I Finally Changed Package Managers
4:01
Theo - t3․gg
Рет қаралды 89 М.
Using TailwindCSS with LitElement
12:07
A shot of code
Рет қаралды 3,2 М.
Yarn Workspaces Setup - Multiple JavaScript Packages (Mono-Repo)
14:27
Why I’m using a monorepo with Yarn workspaces
9:18
Web Dev Cody
Рет қаралды 25 М.
React app + NPM workspaces
10:57
AntonCodes
Рет қаралды 3,1 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,6 МЛН
How to Create a React Typescript Monorepo with Git Submodules
40:54
Alex Eagleson
Рет қаралды 13 М.
How to use NPM LINK?
10:01
A shot of code
Рет қаралды 23 М.
Yarn Workspaces Tutorial
11:01
Ben Awad
Рет қаралды 61 М.