Application port management #7462
Replies: 4 comments
-
+1 The ability to define ports for apps in a config file would be awesome. |
Beta Was this translation helpful? Give feedback.
-
This would indeed by cool, I'll take this to the team to see if we want to enhance support for our |
Beta Was this translation helpful? Give feedback.
-
We talked about this at the team meeting today, and we think this is ultimately part of #986 when we get to it. I'll leave this open since the scope is much narrower, but I think we'll want to think through it together. In the meantime, hardcoding the port in each package.json is the best workaround I can think of |
Beta Was this translation helpful? Give feedback.
-
Hey, we have exactly the same situation. Retrieving the port or iterating it by --ports-sequence would be very helpful. Any news on this topic? |
Beta Was this translation helpful? Give feedback.
-
Which project is this feature idea for?
Turborepo
Describe the feature you'd like to request
Hi team. Turborepo is great, but there are some areas we could improve on.
One of the areas is how ports are attributed to nextjs repos inside the apps folder. I'm working on a monorepo with several applications (production and some prototypes) and its quite hard to find which port should I connect to because it changes every time I stop my dev process for whatever reason. I know we can hard code the ports on apps/my_app/package.json but I wonder if instead of assigning the ports randomly based on which process started first, they could be assigned alphabetically based of the apps folder. This way if you are working on localhost:3009 and you need to stop
turbo dev
to run some dependency install and then runturbo dev
again at least your app is still on the same port and you dont have to go and try port 3000, 3001, 3002, etc until you find your app.I understand that this might not be a out of the box feature, but it can be frustrating in a large monorepo with multiple applications always having to guess where your app is.
Describe the solution you'd like
I would like to call
yarn dev --ports-sequence
or someething to indicate to turborepo that each app needs to start in a sequence (alphabetical) and not cuncurrently.Describe alternatives you've considered
I can manually go and assign a port to each application package.json but in my particular repo where prototypes are constantly added, its hard to see which ports are already assigned specially.
So for example if you think of an app looking like this
And you have to manually set the
dev
process inside each package.json individuallynext dev --port 3000
.And even if you are careful and make your ports assigned alphabetically and you add a new prototype then the port you manually have assigned to
website
will be incorrect. Or if you add a new app calleddocs
then all of them are incorrect becausedocs
comes beforeprototype...
alphabetically.So you either have to:
On an application with 1-4 apps maybe this is nor relevant, but anything bigger than that it becomes quite frustrating to have to guess which port we need to go into.
Also considered running the apps with
--filter
so only 1 app runs + its dependencies.TURBO-1521
Beta Was this translation helpful? Give feedback.
All reactions