Here's a couple of useful links: Git Github example repo: github.com/juristr/jsnation-pnpm-workspace-nx Package based tutorial: nx.dev/tutorials/package-based-repo-tutorial
I've only ever used the integrated Nx monorepo setup before, but was wondering if there is a way to use Nx's generators with a package-based setup? Or do you have to manually create the directory, add tsup, set up the package.json etc.?
Yup!! The Nx generator API is awesome (imo) and is great for generating projects for package-based solutions. We don't have first-party package-based generators yet, but you can absolutely make your own.
Everything nice! But how do bundle ONLY nextapp or remixapp in a Docker image without bringing workspace folders like packages? Because I found several problems with symlinked dependencies and other components in my workspace that aren't shipped in the application I want to deploy independently.
Very good tutorial, thanks for the team, I have one question, how do I build nested monorepos using NX and PNPM? I'm trying to manage a monorepo (one shared library between two monorepos)
Hey man! Best option is to just not nest monorepos. If you can join and flatten the repos, that's almost always better, but not always an option. If you can't for whatever reason, I'd just publish the one shared library to a registry and have it as a dependency for your 2 monorepos. Git submodules are a thing too, might match what you're looking for, but there's alot of pain down that route.
One "stupid" question. I'm trying to collaborate on a project that is somehow related to 2 repos that depend on each other. I want to make a monorepo, but the project is not mine and I don't want to impose my workflow to the authors, so... I'm doing a monorepo and then forking those repos, to my packages folder. In theory I still can do separate commits to each repo but I'm not sure how to implement this. I'm pretty sure I'm doing something wrong, do I have to commit the git folder? I don't commit the packages folder but add an step to autoclone those folders?. Have anybody done something like this?
Not a stupid question! What you're describing is actually SUPER close to git submodules. Check it out, but there's alot of pain involved with this approach (we often recommend monorepos instead of submodules for this reason).
@@Supaship6000 I'm feeling the pain already... Anyways, thanks!, just knowing there is something already in this regards makes me thinks im not crazy! I'll check it out.
@@SRG-Learn-Code yeah it's one of those things that seems really cool the first time I saw it, but you start to notice the wrinkles REAL quick when you get into it!
This is a great video. I have already done this a few months ago based on some article I have read nx posted. It works fantastic. I have had some issues though configuring when I have an application that has hot/live reloading and a dependencies that is pointing to a workspace project. For example, If I have a nextjs application under `apps/example` and then I have a ui library under `libs/core-ui`. When I run `nx dev example` it will run `next dev` for that project. If I update a dependent workspace project, it will not hot reload. While I understand why I just wanted to see if it is possible to get done without have nx build the application for you. Since I want to run next dev. I have a attempt the `nx` key in my package.json and I dont want to use the project.json configuration I know you can pass and get working. I also know you can configure to use chokidar to look at dependent libraries. I just didnt know if there was a way built in to do this or it is just frowned on since you core libs/apps should be scope to themselves?
hey @bananaisadonut - if you're using `next dev` then checkout the transpilePackages inside of your `next.config.js`. If you opt for the `@nx/next` package, you can use our executor that will detect which internal packages you're referencing automatically!
Here's a couple of useful links: Git
Github example repo: github.com/juristr/jsnation-pnpm-workspace-nx
Package based tutorial: nx.dev/tutorials/package-based-repo-tutorial
I've only ever used the integrated Nx monorepo setup before, but was wondering if there is a way to use Nx's generators with a package-based setup? Or do you have to manually create the directory, add tsup, set up the package.json etc.?
Yup!! The Nx generator API is awesome (imo) and is great for generating projects for package-based solutions. We don't have first-party package-based generators yet, but you can absolutely make your own.
Everything nice! But how do bundle ONLY nextapp or remixapp in a Docker image without bringing workspace folders like packages? Because I found several problems with symlinked dependencies and other components in my workspace that aren't shipped in the application I want to deploy independently.
same issue here
you've got it done in 6 minutes! don't lie to us
actually, the Nx part was just 50 secs 😉 - Juri
You should see Juri's typing speed tests lol!
your videos are awesome 😎
Thanks 😊 - Juri
💯Juri has been KILLING it!
Very good tutorial, thanks for the team, I have one question, how do I build nested monorepos using NX and PNPM? I'm trying to manage a monorepo (one shared library between two monorepos)
Hey man! Best option is to just not nest monorepos. If you can join and flatten the repos, that's almost always better, but not always an option.
If you can't for whatever reason, I'd just publish the one shared library to a registry and have it as a dependency for your 2 monorepos. Git submodules are a thing too, might match what you're looking for, but there's alot of pain down that route.
One "stupid" question. I'm trying to collaborate on a project that is somehow related to 2 repos that depend on each other. I want to make a monorepo, but the project is not mine and I don't want to impose my workflow to the authors, so... I'm doing a monorepo and then forking those repos, to my packages folder. In theory I still can do separate commits to each repo but I'm not sure how to implement this. I'm pretty sure I'm doing something wrong, do I have to commit the git folder? I don't commit the packages folder but add an step to autoclone those folders?. Have anybody done something like this?
Not a stupid question!
What you're describing is actually SUPER close to git submodules. Check it out, but there's alot of pain involved with this approach (we often recommend monorepos instead of submodules for this reason).
@@Supaship6000 I'm feeling the pain already...
Anyways, thanks!, just knowing there is something already in this regards makes me thinks im not crazy! I'll check it out.
@@SRG-Learn-Code yeah it's one of those things that seems really cool the first time I saw it, but you start to notice the wrinkles REAL quick when you get into it!
@@Supaship6000 I see the pain now... watch?v=PKts7yCmlWk
How would yo do it?
This is a great video. I have already done this a few months ago based on some article I have read nx posted. It works fantastic. I have had some issues though configuring when I have an application that has hot/live reloading and a dependencies that is pointing to a workspace project. For example, If I have a nextjs application under `apps/example` and then I have a ui library under `libs/core-ui`. When I run `nx dev example` it will run `next dev` for that project. If I update a dependent workspace project, it will not hot reload. While I understand why I just wanted to see if it is possible to get done without have nx build the application for you. Since I want to run next dev. I have a attempt the `nx` key in my package.json and I dont want to use the project.json configuration I know you can pass and get working. I also know you can configure to use chokidar to look at dependent libraries. I just didnt know if there was a way built in to do this or it is just frowned on since you core libs/apps should be scope to themselves?
hey @bananaisadonut - if you're using `next dev` then checkout the transpilePackages inside of your `next.config.js`. If you opt for the `@nx/next` package, you can use our executor that will detect which internal packages you're referencing automatically!
We need a solution for HMR in dev mode for all dependencies! Usually, entry files point to the dist folder of each package which makes HMR impossible.
“real” HMR might be tough, but we recently added the ability to “watch” dependencies and auto-rebuild them: nx.dev/recipes/other/workspace-watching
Gorczany Corner