mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 07:37:19 +02:00
feat(v2): presets (#1401)
* feat(v2): presets * misc: add newline * misc: add tests * misc: fix path
This commit is contained in:
parent
7ebcf10478
commit
361986515c
28 changed files with 394 additions and 89 deletions
|
@ -15,15 +15,15 @@ describe('loadDocs', () => {
|
|||
const {env, siteDir, siteConfig} = await loadSetup('simple');
|
||||
const sidebarPath = path.join(siteDir, 'sidebars.json');
|
||||
const plugin = new DocusaurusPluginContentDocs(
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
{
|
||||
env,
|
||||
siteDir,
|
||||
siteConfig,
|
||||
},
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
);
|
||||
const {docs: docsMetadata} = await plugin.loadContent();
|
||||
const docsDir = plugin.contentPath;
|
||||
|
@ -62,15 +62,15 @@ describe('loadDocs', () => {
|
|||
const {env, siteDir, siteConfig} = await loadSetup('versioned');
|
||||
const sidebarPath = path.join(siteDir, 'sidebars.json');
|
||||
const plugin = new DocusaurusPluginContentDocs(
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
{
|
||||
env,
|
||||
siteDir,
|
||||
siteConfig,
|
||||
},
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
);
|
||||
const {docs: docsMetadata, versionedDir} = await plugin.loadContent();
|
||||
const docsDir = plugin.contentPath;
|
||||
|
@ -109,15 +109,15 @@ describe('loadDocs', () => {
|
|||
const {env, siteDir, siteConfig} = await loadSetup('transversioned');
|
||||
const sidebarPath = path.join(siteDir, 'sidebars.json');
|
||||
const plugin = new DocusaurusPluginContentDocs(
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
{
|
||||
env,
|
||||
siteDir,
|
||||
siteConfig,
|
||||
},
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
);
|
||||
const {
|
||||
docs: docsMetadata,
|
||||
|
@ -177,15 +177,15 @@ describe('loadDocs', () => {
|
|||
const {env, siteDir, siteConfig} = await loadSetup('translated');
|
||||
const sidebarPath = path.join(siteDir, 'sidebars.json');
|
||||
const plugin = new DocusaurusPluginContentDocs(
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
{
|
||||
env,
|
||||
siteDir,
|
||||
siteConfig,
|
||||
},
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
},
|
||||
);
|
||||
const {docs: docsMetadata, translatedDir} = await plugin.loadContent();
|
||||
const docsDir = plugin.contentPath;
|
||||
|
@ -227,16 +227,16 @@ describe('loadDocs', () => {
|
|||
const {env, siteDir, siteConfig} = await loadSetup('versioned');
|
||||
const sidebarPath = path.join(siteDir, 'sidebars.json');
|
||||
const plugin = new DocusaurusPluginContentDocs(
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
skipNextRelease: true,
|
||||
},
|
||||
{
|
||||
env,
|
||||
siteDir,
|
||||
siteConfig,
|
||||
},
|
||||
{
|
||||
path: '../docs',
|
||||
sidebarPath,
|
||||
skipNextRelease: true,
|
||||
},
|
||||
);
|
||||
const {docs: docsMetadata, versionedDir} = await plugin.loadContent();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ const DEFAULT_OPTIONS = {
|
|||
};
|
||||
|
||||
class DocusaurusPluginContentDocs {
|
||||
constructor(opts, context) {
|
||||
constructor(context, opts) {
|
||||
this.options = {...DEFAULT_OPTIONS, ...opts};
|
||||
this.context = context;
|
||||
this.contentPath = path.resolve(this.context.siteDir, this.options.path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue