Skip to content

Commit 553f914

Browse files
authored
feat: TypeScript presets/plugins should expose Options typing (facebook#5456)
* each TS plugin should export option types + preset export option / themeConfig types + remove TS typechecking for the bootstrap theme * each TS plugin should export option types + preset export option / themeConfig types + remove TS typechecking for the bootstrap theme * fix remaining TS errors * fix remaining TS errors * TS fix * Add JSDoc type annotations to init templates and TS docs * missing title char
1 parent 013cfc0 commit 553f914

File tree

23 files changed

+514
-403
lines changed

23 files changed

+514
-403
lines changed
Lines changed: 82 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
const lightCodeTheme = require('prism-react-renderer/themes/github');
22
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
33

4+
// With JSDoc @type annotations, IDEs can provide config autocompletion
45
/** @type {import('@docusaurus/types').DocusaurusConfig} */
5-
module.exports = {
6+
(module.exports = {
67
title: 'My Site',
78
tagline: 'Dinosaurs are cool',
89
url: 'https://your-docusaurus-test-site.com',
@@ -12,82 +13,12 @@ module.exports = {
1213
favicon: 'img/favicon.ico',
1314
organizationName: 'facebook', // Usually your GitHub org/user name.
1415
projectName: 'docusaurus', // Usually your repo name.
15-
themeConfig: {
16-
navbar: {
17-
title: 'My Site',
18-
logo: {
19-
alt: 'My Site Logo',
20-
src: 'img/logo.svg',
21-
},
22-
items: [
23-
{
24-
type: 'doc',
25-
docId: 'intro',
26-
position: 'left',
27-
label: 'Tutorial',
28-
},
29-
{to: '/blog', label: 'Blog', position: 'left'},
30-
{
31-
href: 'https://github.com/facebook/docusaurus',
32-
label: 'GitHub',
33-
position: 'right',
34-
},
35-
],
36-
},
37-
footer: {
38-
style: 'dark',
39-
links: [
40-
{
41-
title: 'Docs',
42-
items: [
43-
{
44-
label: 'Tutorial',
45-
to: '/docs/intro',
46-
},
47-
],
48-
},
49-
{
50-
title: 'Community',
51-
items: [
52-
{
53-
label: 'Stack Overflow',
54-
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
55-
},
56-
{
57-
label: 'Discord',
58-
href: 'https://discordapp.com/invite/docusaurus',
59-
},
60-
{
61-
label: 'Twitter',
62-
href: 'https://twitter.com/docusaurus',
63-
},
64-
],
65-
},
66-
{
67-
title: 'More',
68-
items: [
69-
{
70-
label: 'Blog',
71-
to: '/blog',
72-
},
73-
{
74-
label: 'GitHub',
75-
href: 'https://github.com/facebook/docusaurus',
76-
},
77-
],
78-
},
79-
],
80-
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
81-
},
82-
prism: {
83-
theme: lightCodeTheme,
84-
darkTheme: darkCodeTheme,
85-
},
86-
},
16+
8717
presets: [
8818
[
8919
'@docusaurus/preset-classic',
90-
{
20+
/** @type {import('@docusaurus/preset-classic').Options} */
21+
({
9122
docs: {
9223
sidebarPath: require.resolve('./sidebars.js'),
9324
// Please change this to your repo.
@@ -102,7 +33,82 @@ module.exports = {
10233
theme: {
10334
customCss: require.resolve('./src/css/custom.css'),
10435
},
105-
},
36+
}),
10637
],
10738
],
108-
};
39+
40+
themeConfig:
41+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
42+
({
43+
navbar: {
44+
title: 'My Site',
45+
logo: {
46+
alt: 'My Site Logo',
47+
src: 'img/logo.svg',
48+
},
49+
items: [
50+
{
51+
type: 'doc',
52+
docId: 'intro',
53+
position: 'left',
54+
label: 'Tutorial',
55+
},
56+
{to: '/blog', label: 'Blog', position: 'left'},
57+
{
58+
href: 'https://github.com/facebook/docusaurus',
59+
label: 'GitHub',
60+
position: 'right',
61+
},
62+
],
63+
},
64+
footer: {
65+
style: 'dark',
66+
links: [
67+
{
68+
title: 'Docs',
69+
items: [
70+
{
71+
label: 'Tutorial',
72+
to: '/docs/intro',
73+
},
74+
],
75+
},
76+
{
77+
title: 'Community',
78+
items: [
79+
{
80+
label: 'Stack Overflow',
81+
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
82+
},
83+
{
84+
label: 'Discord',
85+
href: 'https://discordapp.com/invite/docusaurus',
86+
},
87+
{
88+
label: 'Twitter',
89+
href: 'https://twitter.com/docusaurus',
90+
},
91+
],
92+
},
93+
{
94+
title: 'More',
95+
items: [
96+
{
97+
label: 'Blog',
98+
to: '/blog',
99+
},
100+
{
101+
label: 'GitHub',
102+
href: 'https://github.com/facebook/docusaurus',
103+
},
104+
],
105+
},
106+
],
107+
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
108+
},
109+
prism: {
110+
theme: lightCodeTheme,
111+
darkTheme: darkCodeTheme,
112+
},
113+
}),
114+
});

0 commit comments

Comments
 (0)