moon query projects sub-command to query information about all projects in the project
graph. The project list can be filtered by passing a query statement as
an argument, or by using options arguments.
# Find all projects
$ moon query projects
# Find all projects with an id that matches "react"
$ moon query projects --id react
$ moon query projects "project~react"
# Find all projects with a `lint` or `build` task
$ moon query projects --tasks "lint|build"
$ moon query projects "task=[lint,build]"
By default, this will output a list of projects in the format of
<id> | <source> | <type> | <language>, separated by new lines.
web | apps/web | application | typescript
The projects can also be output in JSON (which contains all data) by
--json flag. The output has the following structure:
This command can also be used to query for affected projects, based on the state of the VCS working
tree. For advanced control, you can also pass the results of
moon query touched-files to stdin.
# Find all affected projects
$ moon query projects --affected
# Find all affected projects using the results of another query
$ moon query touched-files | moon query projects --affected
[query]- An optional query statement to filter projects with. When provided, all filter options are ignored. v1.4.0
--affected- Filter projects that have been affected by touched files.
--json- Display the projects in JSON format.
All option values are case-insensitive regex patterns.
--alias <regex>- Filter projects that match this alias.
--id <regex>- Filter projects that match this ID/name.
--language <regex>- Filter projects of this programming language.
--source <regex>- Filter projects that match this source path.
--tags <regex>- Filter projects that have the following tags.
--tasks <regex>- Filter projects that have the following tasks.
--type <regex>- Filter project of this type.