Docusaurus: RFC: better swizzle cli

Created on 23 Jun 2020  路  8Comments  路  Source: facebook/docusaurus

馃殌 Feature

The swizzle cli experience works, but is a but rough and could be improved

Pitch

Here I'm using yarn workspace docusaurus-2-website swizzle ... in the screeshots (as I'm using D2 website for testing), but replace in your mind with yarn swizzle ...

Here are some suggestions


Display all the installed theme names with yarn swizzle, instead of:

image


On theme name typo, better error with theme name suggestions:

image


Do not swizzle the whole theme files with yarn swizzle @docusaurus/theme-classic, insead display available names to swizzle. (breaking change)

image


Typo on swizzle component name: same as theme, suggest valid names instead o:

image


Allow swizzling the whole theme files with an --all option: yarn swizzle @docusaurus/theme-classic --all

mlh proposal v2

All 8 comments

To facilitate the use of the users, when a user pass a command that don't exist in the CLI, we could output a help, showing the current options. Loved the idea.

@slorber I will be interested if the issue is available.

thanks

You can probably start a poc, but there's ongoing work by @SamChou19815 that we should probably merge first here: https://github.com/facebook/docusaurus/pull/2671

@slorber I am working on this issue

@slorber I was trying to get package name for themes but due to the use of require.resolve I am getting the path of the module instead. Do you know any method get package names?

hey @anshulrgoyal , maybe from the module path you could read the package.json in it, to get the name attribute?

hey @anshulrgoyal , maybe from the module path you could read the package.json in it, to get the name attribute?

Did same in my pr.

@slorber we should close this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericnakagawa picture ericnakagawa  路  3Comments

endiliey picture endiliey  路  3Comments

NikitaIT picture NikitaIT  路  3Comments

JoelMarcey picture JoelMarcey  路  3Comments

omry picture omry  路  3Comments