angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.97k forks source link

List available projects in a workspace - `ng projects` #23482

Open dgp1130 opened 2 years ago

dgp1130 commented 2 years ago

🚀 Feature request

Command (mark with an x)

Description

In large Angular monorepo workspaces, it can sometimes be non-obvious to discover all the available projects which can be built. We should consider a new command (ng projects, ng ls, etc.) which lists all the projects in the current workspace. This can help new developers in workspace figure out exactly what they want to work on and how to do it.

Describe alternatives you've considered

Workaround is to introspect the angular.json file, which is not obvious or easy to do, especially for a new developer.

angular-robot[bot] commented 2 years ago

This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

You can find more details about the feature request process in our documentation.

angular-robot[bot] commented 2 years ago

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

zr87 commented 2 years ago

I'm joining the supporters of this feature request!

In my case, I have a workspace with multiple projects and it is time-consuming to write the --project="" argument after the command, and don't want to create a separate npm script command in the packege.json for every project for every command that needs the project parameter. I have currently 2, but there will be 12 or more in the future.

Another scenario: I thought it would be neat to have a bash script to help run the serve, build, or lint commands. The script would project by prompting the user to choose one from the list of available projects.

Currently, I plan to implement this in a separate bash script but I think this feature would be also beneficial in the CLI.

oshliaer commented 2 years ago

There is another workaround. It's to call Error: Invalid values: of ng serve. The output returns available projects list.

$> ng serve Z
$< Error: Invalid values:
       Argument: project, Given: "Z", Choices: "forms", "material-view-samples"

Also from v14 ng serve requires a mandatory [project] parameter

$> ng serve
$< Error: Cannot determine project for command.
       This is a multi-project workspace and more than one project supports this command.
       Run "ng serve [project]" to execute the command for a specific project or change the
       current working directory to a project directory.

    Available projects are:
    - forms
    - material-view-samples
angular-robot[bot] commented 2 years ago

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

guyettenathanj commented 1 year ago

I would also love this feature.