Introduce JSON output mode for the `spfx list-templates` command
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 32
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Description
currently the spfx list-templates command has a ASCII like table output mode which is note that helpful.
First of all, it is not always readable in smaller terminals
Second of all, it is tricky to parse when used in scripts, tests, CI-CD. Since it is not standard, the view may change at any time, which creates an even bigger challenge.
I suggest we introduce JSON output mode to this command, which is standard and easily parse to a TS/C#/PS and other objects and I would make the JSON output mode default.
Additionally, we could introduce other output modes besides json like:
text- which could be what is currently shown, so the tablecsv
In order to allo to the use to specify a different output mode we could add a new option -o, --output so that if user would like a text output, he or she could run:
spfx list-templates --output 'text'
Use case
Introducing JSON output mode will allow to use this command in CI CD automation, scripts and tests.
The current output format is not readable and tricky to parse
Alternatives considered
Alternatively, you could provide and script example how to easily parse the current output format to an TS object
Additional context
IMHO JSON output format is kinda standard which I think this tool could follow.
CLI for Microsoft 365 is a good example of a tool that supports multiple output modes
https://pnp.github.io/cli-microsoft365/user-guide/cli-output-mode
I would follow a similar pattern
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the spfx list-templates command and inspect how its current ASCII table output is produced. Define the scope of the -o, --output option, including JSON as the default and whether text and CSV are supported; done means template listings are reliably parseable for scripts, tests, and CI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100