Have you read the Contributing Guidelines on issues?
Description
When configuring a theme, plugin, or preset, instead of looking up for the NPM package itself, we could have a chain of NPM package resolve attempts, in the respective order/priority:
docusaurus-theme-{theme}
@docusaurus/theme-{theme}
@{theme}/docusaurus-theme
{theme}
The same for plugins and presets.
Example docusaurus configuration:
module.exports = {
themes: ['classic'],
};
Package resolve attempts:
docusaurus-theme-classic
@docusaurus/theme-classic
@classic/docusaurus-theme
classic
PS.: it is not clear to me if we should lookup for scoped packages only when the user input begins with @, so there are two alternatives:
A: themes: ['@org'] -> @org/docusaurus-theme (resolvers chain, as of the numbered list above: 3)
B: themes: ['org'] -> @org/docusaurus-theme (resolvers chain, as of the numbered list above: 1, 2, 3, 4)
Has this been requested on Canny?
https://docusaurus.io/feature-requests/p/shorthand-for-themespluginspresets-configuration
Motivation
Some modern tools are adopting the "shareable config" concept, generally supporting shorthand, so the user may omit the keywords that may be inferred, e.g. eslint-config-{config}, eslint-plugin-{plugin}.
This also encourages developers to publish their packages in a canonical way (including docusaurus-(theme|plugin|preset) in the name), so a GitHub or NPM search would result in way more packages, therefore increasing their reusability and popularity.
Reference:
https://eslint.org/docs/developer-guide/shareable-configs
API design
I guess the API design is pretty straightforward: users may omit the following keywords in their configuration:
docusaurus-theme
docusaurus-plugin
docusaurus-preset
About the implementation itself, we could use ESLint as the baseline:
https://github.com/eslint/eslintrc/blob/main/lib/shared/naming.js#L14
Or thinking in a more ambitious way, we could have a dedicated package/repository to that, just like cosmiconfig, which does the same, but for configuration file names lookup.
Have you tried building it?
No response
Self-service
Have you read the Contributing Guidelines on issues?
Description
When configuring a theme, plugin, or preset, instead of looking up for the NPM package itself, we could have a chain of NPM package resolve attempts, in the respective order/priority:
docusaurus-theme-{theme}@docusaurus/theme-{theme}@{theme}/docusaurus-theme{theme}The same for plugins and presets.
Example docusaurus configuration:
Package resolve attempts:
docusaurus-theme-classic@docusaurus/theme-classic@classic/docusaurus-themeclassicPS.: it is not clear to me if we should lookup for scoped packages only when the user input begins with
@, so there are two alternatives:A:
themes: ['@org']->@org/docusaurus-theme(resolvers chain, as of the numbered list above: 3)B:
themes: ['org']->@org/docusaurus-theme(resolvers chain, as of the numbered list above: 1, 2, 3, 4)Has this been requested on Canny?
https://docusaurus.io/feature-requests/p/shorthand-for-themespluginspresets-configuration
Motivation
Some modern tools are adopting the "shareable config" concept, generally supporting shorthand, so the user may omit the keywords that may be inferred, e.g.
eslint-config-{config},eslint-plugin-{plugin}.This also encourages developers to publish their packages in a canonical way (including
docusaurus-(theme|plugin|preset)in the name), so a GitHub or NPM search would result in way more packages, therefore increasing their reusability and popularity.Reference:
https://eslint.org/docs/developer-guide/shareable-configs
API design
I guess the API design is pretty straightforward: users may omit the following keywords in their configuration:
docusaurus-themedocusaurus-plugindocusaurus-presetAbout the implementation itself, we could use ESLint as the baseline:
https://github.com/eslint/eslintrc/blob/main/lib/shared/naming.js#L14
Or thinking in a more ambitious way, we could have a dedicated package/repository to that, just like cosmiconfig, which does the same, but for configuration file names lookup.
Have you tried building it?
No response
Self-service