create-docusaurus 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +23 -7
  2. package/bin/index.js +56 -1
  3. package/lib/.tsbuildinfo +1 -0
  4. package/lib/index.d.ts +11 -0
  5. package/lib/index.js +235 -0
  6. package/package.json +18 -3
  7. package/src/index.ts +289 -0
  8. package/templates/README.md +8 -0
  9. package/templates/bootstrap/docusaurus.config.js +93 -0
  10. package/templates/bootstrap/package.json +39 -0
  11. package/templates/bootstrap/src/pages/index.js +87 -0
  12. package/templates/bootstrap/src/pages/styles.module.css +49 -0
  13. package/templates/classic/docusaurus.config.js +118 -0
  14. package/templates/classic/package.json +40 -0
  15. package/templates/classic/src/components/HomepageFeatures.js +64 -0
  16. package/templates/classic/src/components/HomepageFeatures.module.css +11 -0
  17. package/templates/classic/src/css/custom.css +28 -0
  18. package/templates/classic/src/pages/index.js +40 -0
  19. package/templates/classic/src/pages/index.module.css +23 -0
  20. package/templates/classic-typescript/package.json +46 -0
  21. package/templates/classic-typescript/src/components/HomepageFeatures.tsx +76 -0
  22. package/templates/classic-typescript/src/pages/index.tsx +40 -0
  23. package/templates/classic-typescript/tsconfig.json +7 -0
  24. package/templates/facebook/.eslintrc.js +60 -0
  25. package/templates/facebook/.prettierignore +3 -0
  26. package/templates/facebook/.prettierrc +9 -0
  27. package/templates/facebook/.stylelintrc.js +13 -0
  28. package/templates/facebook/README.md +41 -0
  29. package/templates/facebook/babel.config.js +12 -0
  30. package/templates/facebook/docusaurus.config.js +152 -0
  31. package/templates/facebook/gitignore +23 -0
  32. package/templates/facebook/package.json +56 -0
  33. package/templates/facebook/sidebars.js +35 -0
  34. package/templates/facebook/src/css/custom.css +33 -0
  35. package/templates/facebook/src/pages/index.js +109 -0
  36. package/templates/facebook/src/pages/styles.module.css +44 -0
  37. package/templates/facebook/static/img/oss_logo.png +0 -0
  38. package/templates/shared/README.md +33 -0
  39. package/templates/shared/babel.config.js +3 -0
  40. package/templates/shared/blog/2019-05-28-first-blog-post.md +12 -0
  41. package/templates/shared/blog/2019-05-29-long-blog-post.md +44 -0
  42. package/templates/shared/blog/2021-08-01-mdx-blog-post.mdx +20 -0
  43. package/templates/shared/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
  44. package/templates/shared/blog/2021-08-26-welcome/index.md +25 -0
  45. package/templates/shared/blog/authors.yml +17 -0
  46. package/templates/shared/docs/intro.md +35 -0
  47. package/templates/shared/docs/tutorial-basics/_category_.json +4 -0
  48. package/templates/shared/docs/tutorial-basics/congratulations.md +21 -0
  49. package/templates/shared/docs/tutorial-basics/create-a-blog-post.md +34 -0
  50. package/templates/shared/docs/tutorial-basics/create-a-document.md +55 -0
  51. package/templates/shared/docs/tutorial-basics/create-a-page.md +43 -0
  52. package/templates/shared/docs/tutorial-basics/deploy-your-site.md +31 -0
  53. package/templates/shared/docs/tutorial-basics/markdown-features.mdx +144 -0
  54. package/templates/shared/docs/tutorial-extras/_category_.json +4 -0
  55. package/templates/shared/docs/tutorial-extras/manage-docs-versions.md +55 -0
  56. package/templates/shared/docs/tutorial-extras/translate-your-site.md +88 -0
  57. package/templates/shared/gitignore +20 -0
  58. package/templates/shared/sidebars.js +26 -0
  59. package/templates/shared/src/pages/markdown-page.md +7 -0
  60. package/templates/shared/static/.nojekyll +0 -0
  61. package/templates/shared/static/img/docusaurus.png +0 -0
  62. package/templates/shared/static/img/favicon.ico +0 -0
  63. package/templates/shared/static/img/logo.svg +1 -0
  64. package/templates/shared/static/img/tutorial/docsVersionDropdown.png +0 -0
  65. package/templates/shared/static/img/tutorial/localeDropdown.png +0 -0
  66. package/templates/shared/static/img/undraw_docusaurus_mountain.svg +170 -0
  67. package/templates/shared/static/img/undraw_docusaurus_react.svg +169 -0
  68. package/templates/shared/static/img/undraw_docusaurus_tree.svg +1 -0
  69. package/tsconfig.json +11 -0
package/src/index.ts ADDED
@@ -0,0 +1,289 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import chalk from 'chalk';
9
+ import fs from 'fs-extra';
10
+ import {execSync} from 'child_process';
11
+ import prompts, {Choice} from 'prompts';
12
+ import path from 'path';
13
+ import shell from 'shelljs';
14
+ import {kebabCase, sortBy} from 'lodash';
15
+ import supportsColor from 'supports-color';
16
+
17
+ const RecommendedTemplate = 'classic';
18
+ const TypeScriptTemplateSuffix = '-typescript';
19
+
20
+ function hasYarn() {
21
+ try {
22
+ execSync('yarnpkg --version', {stdio: 'ignore'});
23
+ return true;
24
+ } catch (e) {
25
+ return false;
26
+ }
27
+ }
28
+
29
+ function isValidGitRepoUrl(gitRepoUrl: string) {
30
+ return ['https://', 'git@'].some((item) => gitRepoUrl.startsWith(item));
31
+ }
32
+
33
+ async function updatePkg(pkgPath: string, obj: Record<string, unknown>) {
34
+ const content = await fs.readFile(pkgPath, 'utf-8');
35
+ const pkg = JSON.parse(content);
36
+ const newPkg = Object.assign(pkg, obj);
37
+
38
+ await fs.outputFile(pkgPath, JSON.stringify(newPkg, null, 2));
39
+ }
40
+
41
+ function readTemplates(templatesDir: string) {
42
+ const templates = fs
43
+ .readdirSync(templatesDir)
44
+ .filter(
45
+ (d) =>
46
+ !d.startsWith('.') &&
47
+ !d.startsWith('README') &&
48
+ !d.endsWith(TypeScriptTemplateSuffix) &&
49
+ d !== 'shared',
50
+ );
51
+
52
+ // Classic should be first in list!
53
+ return sortBy(templates, (t) => t !== RecommendedTemplate);
54
+ }
55
+
56
+ function createTemplateChoices(templates: string[]) {
57
+ function makeNameAndValueChoice(value: string): Choice {
58
+ const title =
59
+ value === RecommendedTemplate ? `${value} (recommended)` : value;
60
+ return {title, value};
61
+ }
62
+
63
+ return [
64
+ ...templates.map((template) => makeNameAndValueChoice(template)),
65
+ makeNameAndValueChoice('Git repository'),
66
+ ];
67
+ }
68
+
69
+ function getTypeScriptBaseTemplate(template: string): string | undefined {
70
+ if (template.endsWith(TypeScriptTemplateSuffix)) {
71
+ return template.replace(TypeScriptTemplateSuffix, '');
72
+ }
73
+ return undefined;
74
+ }
75
+
76
+ async function copyTemplate(
77
+ templatesDir: string,
78
+ template: string,
79
+ dest: string,
80
+ ) {
81
+ await fs.copy(path.resolve(templatesDir, 'shared'), dest);
82
+
83
+ // TypeScript variants will copy duplicate resources like CSS & config from base template
84
+ const tsBaseTemplate = getTypeScriptBaseTemplate(template);
85
+ if (tsBaseTemplate) {
86
+ const tsBaseTemplatePath = path.resolve(templatesDir, tsBaseTemplate);
87
+ await fs.copy(tsBaseTemplatePath, dest, {
88
+ filter: (filePath) =>
89
+ fs.statSync(filePath).isDirectory() ||
90
+ path.extname(filePath) === '.css' ||
91
+ path.basename(filePath) === 'docusaurus.config.js',
92
+ });
93
+ }
94
+
95
+ await fs.copy(path.resolve(templatesDir, template), dest, {
96
+ // Symlinks don't exist in published NPM packages anymore, so this is only to prevent errors during local testing
97
+ filter: (filePath) => !fs.lstatSync(filePath).isSymbolicLink(),
98
+ });
99
+ }
100
+
101
+ export default async function init(
102
+ rootDir: string,
103
+ siteName?: string,
104
+ reqTemplate?: string,
105
+ cliOptions: Partial<{
106
+ useNpm: boolean;
107
+ skipInstall: boolean;
108
+ typescript: boolean;
109
+ }> = {},
110
+ ): Promise<void> {
111
+ const useYarn = cliOptions.useNpm ? false : hasYarn();
112
+ const templatesDir = path.resolve(__dirname, '../templates');
113
+ const templates = readTemplates(templatesDir);
114
+ const hasTS = (templateName: string) =>
115
+ fs.pathExistsSync(
116
+ path.resolve(templatesDir, `${templateName}${TypeScriptTemplateSuffix}`),
117
+ );
118
+
119
+ let name = siteName;
120
+
121
+ // Prompt if siteName is not passed from CLI.
122
+ if (!name) {
123
+ const prompt = await prompts({
124
+ type: 'text',
125
+ name: 'name',
126
+ message: 'What should we name this site?',
127
+ initial: 'website',
128
+ });
129
+ name = prompt.name;
130
+ }
131
+
132
+ if (!name) {
133
+ throw new Error(chalk.red('A website name is required.'));
134
+ }
135
+
136
+ const dest = path.resolve(rootDir, name);
137
+ if (fs.existsSync(dest)) {
138
+ throw new Error(`Directory already exists at "${dest}"!`);
139
+ }
140
+
141
+ let template = reqTemplate;
142
+ let useTS = cliOptions.typescript;
143
+ // Prompt if template is not provided from CLI.
144
+ if (!template) {
145
+ const templatePrompt = await prompts({
146
+ type: 'select',
147
+ name: 'template',
148
+ message: 'Select a template below...',
149
+ choices: createTemplateChoices(templates),
150
+ });
151
+ template = templatePrompt.template;
152
+ if (template && !useTS && hasTS(template)) {
153
+ const tsPrompt = await prompts({
154
+ type: 'confirm',
155
+ name: 'useTS',
156
+ message:
157
+ 'This template is available in TypeScript. Do you want to use the TS variant?',
158
+ initial: false,
159
+ });
160
+ useTS = tsPrompt.useTS;
161
+ }
162
+ }
163
+
164
+ // If user choose Git repository, we'll prompt for the url.
165
+ if (template === 'Git repository') {
166
+ const repoPrompt = await prompts({
167
+ type: 'text',
168
+ name: 'gitRepoUrl',
169
+ validate: (url?: string) => {
170
+ if (url && isValidGitRepoUrl(url)) {
171
+ return true;
172
+ }
173
+ return chalk.red(`Invalid repository URL`);
174
+ },
175
+ message:
176
+ 'Enter a repository URL from GitHub, Bitbucket, GitLab, or any other public repo.\n(e.g: https://github.com/ownerName/repoName.git)',
177
+ });
178
+ template = repoPrompt.gitRepoUrl;
179
+ }
180
+
181
+ console.log(`
182
+ ${chalk.cyan('Creating new Docusaurus project...')}
183
+ `);
184
+
185
+ if (template && isValidGitRepoUrl(template)) {
186
+ console.log(`Cloning Git template ${chalk.cyan(template)}...`);
187
+ if (
188
+ shell.exec(`git clone --recursive ${template} ${dest}`, {silent: true})
189
+ .code !== 0
190
+ ) {
191
+ throw new Error(chalk.red(`Cloning Git template ${template} failed!`));
192
+ }
193
+ } else if (template && templates.includes(template)) {
194
+ // Docusaurus templates.
195
+ if (useTS) {
196
+ if (!hasTS(template)) {
197
+ throw new Error(
198
+ `Template ${template} doesn't provide the Typescript variant.`,
199
+ );
200
+ }
201
+ template = `${template}${TypeScriptTemplateSuffix}`;
202
+ }
203
+ try {
204
+ await copyTemplate(templatesDir, template, dest);
205
+ } catch (err) {
206
+ console.log(
207
+ `Copying Docusaurus template ${chalk.cyan(template)} failed!`,
208
+ );
209
+ throw err;
210
+ }
211
+ } else {
212
+ throw new Error('Invalid template.');
213
+ }
214
+
215
+ // Update package.json info.
216
+ try {
217
+ await updatePkg(path.join(dest, 'package.json'), {
218
+ name: kebabCase(name),
219
+ version: '0.0.0',
220
+ private: true,
221
+ });
222
+ } catch (err) {
223
+ console.log(chalk.red('Failed to update package.json.'));
224
+ throw err;
225
+ }
226
+
227
+ // We need to rename the gitignore file to .gitignore
228
+ if (
229
+ !fs.pathExistsSync(path.join(dest, '.gitignore')) &&
230
+ fs.pathExistsSync(path.join(dest, 'gitignore'))
231
+ ) {
232
+ await fs.move(path.join(dest, 'gitignore'), path.join(dest, '.gitignore'));
233
+ }
234
+ if (fs.pathExistsSync(path.join(dest, 'gitignore'))) {
235
+ fs.removeSync(path.join(dest, 'gitignore'));
236
+ }
237
+
238
+ const pkgManager = useYarn ? 'yarn' : 'npm';
239
+ if (!cliOptions.skipInstall) {
240
+ console.log(`Installing dependencies with ${chalk.cyan(pkgManager)}...`);
241
+
242
+ try {
243
+ // Use force coloring the output, since the command is invoked by shelljs, which is not the interactive shell
244
+ shell.exec(
245
+ `cd "${name}" && ${useYarn ? 'yarn' : 'npm install --color always'}`,
246
+ {
247
+ env: {
248
+ ...process.env,
249
+ ...(supportsColor.stdout ? {FORCE_COLOR: '1'} : {}),
250
+ },
251
+ },
252
+ );
253
+ } catch (err) {
254
+ console.log(chalk.red('Installation failed.'));
255
+ throw err;
256
+ }
257
+ }
258
+ console.log();
259
+
260
+ // Display the most elegant way to cd.
261
+ const cdpath =
262
+ path.join(process.cwd(), name) === dest
263
+ ? name
264
+ : path.relative(process.cwd(), name);
265
+
266
+ console.log(`
267
+ Successfully created "${chalk.cyan(cdpath)}".
268
+ Inside that directory, you can run several commands:
269
+
270
+ ${chalk.cyan(`${pkgManager} start`)}
271
+ Starts the development server.
272
+
273
+ ${chalk.cyan(`${pkgManager} ${useYarn ? '' : 'run '}build`)}
274
+ Bundles your website into static files for production.
275
+
276
+ ${chalk.cyan(`${pkgManager} ${useYarn ? '' : 'run '}serve`)}
277
+ Serves the built website locally.
278
+
279
+ ${chalk.cyan(`${pkgManager} deploy`)}
280
+ Publishes the website to GitHub pages.
281
+
282
+ We recommend that you begin by typing:
283
+
284
+ ${chalk.cyan('cd')} ${cdpath}
285
+ ${chalk.cyan(`${pkgManager} start`)}
286
+
287
+ Happy building awesome websites!
288
+ `);
289
+ }
@@ -0,0 +1,8 @@
1
+ # Templates
2
+
3
+ Official templates provided by Docusaurus. They are designed to be selected when using the `npx @docusaurus/init init [name] [template]` CLI command.
4
+
5
+ ## Guide to Test Templates for Developer
6
+
7
+ 1. `yarn install` in the root of the repo (one level above this directory).
8
+ 1. Go to any template's directory, example: `cd classic && yarn start`.
@@ -0,0 +1,93 @@
1
+ // @ts-check
2
+ // Note: type annotations allow type checking and IDEs autocompletion
3
+
4
+ /** @type {import('@docusaurus/types').Config} */
5
+ const config = {
6
+ title: 'My Site',
7
+ tagline: 'The tagline of my site',
8
+ url: 'https://your-docusaurus-test-site.com',
9
+ baseUrl: '/',
10
+ onBrokenLinks: 'throw',
11
+ onBrokenMarkdownLinks: 'warn',
12
+ favicon: 'img/favicon.ico',
13
+ organizationName: 'facebook', // Usually your GitHub org/user name.
14
+ 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
+ to: 'docs/intro',
25
+ activeBasePath: 'docs',
26
+ label: 'Docs',
27
+ position: 'left',
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: 'Community',
42
+ items: [
43
+ {
44
+ label: 'Stack Overflow',
45
+ href: 'https://stackoverflow.com/questions/tagged/docusaurus',
46
+ },
47
+ {
48
+ label: 'Discord',
49
+ href: 'https://discordapp.com/invite/docusaurus',
50
+ },
51
+ {
52
+ label: 'Twitter',
53
+ href: 'https://twitter.com/docusaurus',
54
+ },
55
+ ],
56
+ },
57
+ {
58
+ title: 'More',
59
+ items: [
60
+ {
61
+ label: 'Blog',
62
+ to: 'blog/',
63
+ },
64
+ {
65
+ label: 'GitHub',
66
+ href: 'https://github.com/facebook/docusaurus',
67
+ },
68
+ ],
69
+ },
70
+ ],
71
+ copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
72
+ },
73
+ },
74
+ presets: [
75
+ [
76
+ '@docusaurus/preset-bootstrap',
77
+ {
78
+ docs: {
79
+ sidebarPath: require.resolve('./sidebars.js'),
80
+ editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
81
+ },
82
+ blog: {
83
+ showReadingTime: true,
84
+ // Please change this to your repo.
85
+ editUrl:
86
+ 'https://github.com/facebook/docusaurus/edit/main/website/blog/',
87
+ },
88
+ },
89
+ ],
90
+ ],
91
+ };
92
+
93
+ module.exports = config;
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "docusaurus-2-bootstrap-template",
3
+ "version": "2.0.0-beta.6",
4
+ "private": true,
5
+ "scripts": {
6
+ "docusaurus": "docusaurus",
7
+ "start": "docusaurus start",
8
+ "build": "docusaurus build",
9
+ "swizzle": "docusaurus swizzle",
10
+ "deploy": "docusaurus deploy",
11
+ "clear": "docusaurus clear",
12
+ "serve": "docusaurus serve",
13
+ "write-translations": "docusaurus write-translations",
14
+ "write-heading-ids": "docusaurus write-heading-ids"
15
+ },
16
+ "dependencies": {
17
+ "@docusaurus/core": "2.0.0-beta.6",
18
+ "@docusaurus/preset-bootstrap": "2.0.0-beta.6",
19
+ "@mdx-js/react": "^1.6.21",
20
+ "@svgr/webpack": "^5.5.0",
21
+ "clsx": "^1.1.1",
22
+ "file-loader": "^6.2.0",
23
+ "react": "^17.0.1",
24
+ "react-dom": "^17.0.1",
25
+ "url-loader": "^4.1.1"
26
+ },
27
+ "browserslist": {
28
+ "production": [
29
+ ">0.2%",
30
+ "not dead",
31
+ "not op_mini all"
32
+ ],
33
+ "development": [
34
+ "last 1 chrome version",
35
+ "last 1 firefox version",
36
+ "last 1 safari version"
37
+ ]
38
+ }
39
+ }
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+ import Layout from '@theme/Layout';
4
+ import Link from '@docusaurus/Link';
5
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
6
+ import useBaseUrl from '@docusaurus/useBaseUrl';
7
+ import styles from './styles.module.css';
8
+
9
+ const features = [
10
+ {
11
+ title: 'Easy to Use',
12
+ imageUrl: 'img/undraw_docusaurus_mountain.svg',
13
+ description: (
14
+ <>
15
+ Docusaurus was designed from the ground up to be easily installed and
16
+ used to get your website up and running quickly.
17
+ </>
18
+ ),
19
+ },
20
+ {
21
+ title: 'Focus on What Matters',
22
+ imageUrl: 'img/undraw_docusaurus_tree.svg',
23
+ description: (
24
+ <>
25
+ Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
26
+ ahead and move your docs into the <code>docs</code> directory.
27
+ </>
28
+ ),
29
+ },
30
+ {
31
+ title: 'Powered by React',
32
+ imageUrl: 'img/undraw_docusaurus_react.svg',
33
+ description: (
34
+ <>
35
+ Extend or customize your website layout by reusing React. Docusaurus can
36
+ be extended while reusing the same header and footer.
37
+ </>
38
+ ),
39
+ },
40
+ ];
41
+
42
+ function Feature({imageUrl, title, description}) {
43
+ const imgUrl = useBaseUrl(imageUrl);
44
+ return (
45
+ <div className={clsx('col col--4', styles.feature)}>
46
+ {imgUrl && (
47
+ <div className="text--center">
48
+ <img className={styles.featureImage} src={imgUrl} alt={title} />
49
+ </div>
50
+ )}
51
+ <h3>{title}</h3>
52
+ <p>{description}</p>
53
+ </div>
54
+ );
55
+ }
56
+
57
+ export default function Home() {
58
+ const context = useDocusaurusContext();
59
+ const {siteConfig = {}} = context;
60
+
61
+ return (
62
+ <Layout
63
+ title={`Hello from ${siteConfig.title}`}
64
+ description="Description will go into a meta tag in <head />">
65
+ <div className={styles.hero}>
66
+ <header>
67
+ <h1>{siteConfig.title}</h1>
68
+ <p>{siteConfig.tagline}</p>
69
+ <div className={styles.buttons}>
70
+ <Link to={useBaseUrl('docs/')}>Get Started</Link>
71
+ </div>
72
+ </header>
73
+ <main>
74
+ {features && features.length > 0 && (
75
+ <section className={styles.section}>
76
+ <div className={styles.features}>
77
+ {features.map((props, idx) => (
78
+ <Feature key={idx} {...props} />
79
+ ))}
80
+ </div>
81
+ </section>
82
+ )}
83
+ </main>
84
+ </div>
85
+ </Layout>
86
+ );
87
+ }
@@ -0,0 +1,49 @@
1
+ /* stylelint-disable docusaurus/copyright-header */
2
+
3
+ /**
4
+ * CSS files with the .module.css suffix will be treated as CSS modules
5
+ * and scoped locally.
6
+ */
7
+
8
+ .heroBanner {
9
+ padding: 4rem 0;
10
+ text-align: center;
11
+ position: relative;
12
+ overflow: hidden;
13
+ }
14
+
15
+ @media screen and (max-width: 966px) {
16
+ .heroBanner {
17
+ padding: 2rem;
18
+ }
19
+ }
20
+
21
+ .buttons {
22
+ display: flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+ }
26
+
27
+ .hero {
28
+ display: flex;
29
+ flex-direction: column;
30
+ width: 100%;
31
+ align-items: center;
32
+ place-content: center;
33
+ }
34
+
35
+ .section {
36
+ margin: 10rem;
37
+ }
38
+
39
+ .features {
40
+ display: flex;
41
+ align-items: center;
42
+ padding: 2rem 0;
43
+ width: 100%;
44
+ }
45
+
46
+ .featureImage {
47
+ height: 200px;
48
+ width: 200px;
49
+ }
@@ -0,0 +1,118 @@
1
+ // @ts-check
2
+ // Note: type annotations allow type checking and IDEs autocompletion
3
+
4
+ const lightCodeTheme = require('prism-react-renderer/themes/github');
5
+ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
6
+
7
+ /** @type {import('@docusaurus/types').Config} */
8
+ const config = {
9
+ title: 'My Site',
10
+ tagline: 'Dinosaurs are cool',
11
+ url: 'https://your-docusaurus-test-site.com',
12
+ baseUrl: '/',
13
+ onBrokenLinks: 'throw',
14
+ onBrokenMarkdownLinks: 'warn',
15
+ favicon: 'img/favicon.ico',
16
+ organizationName: 'facebook', // Usually your GitHub org/user name.
17
+ projectName: 'docusaurus', // Usually your repo name.
18
+
19
+ presets: [
20
+ [
21
+ '@docusaurus/preset-classic',
22
+ /** @type {import('@docusaurus/preset-classic').Options} */
23
+ ({
24
+ docs: {
25
+ sidebarPath: require.resolve('./sidebars.js'),
26
+ // Please change this to your repo.
27
+ editUrl: 'https://github.com/facebook/docusaurus/edit/main/website/',
28
+ },
29
+ blog: {
30
+ showReadingTime: true,
31
+ // Please change this to your repo.
32
+ editUrl:
33
+ 'https://github.com/facebook/docusaurus/edit/main/website/blog/',
34
+ },
35
+ theme: {
36
+ customCss: require.resolve('./src/css/custom.css'),
37
+ },
38
+ }),
39
+ ],
40
+ ],
41
+
42
+ themeConfig:
43
+ /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
44
+ ({
45
+ navbar: {
46
+ title: 'My Site',
47
+ logo: {
48
+ alt: 'My Site Logo',
49
+ src: 'img/logo.svg',
50
+ },
51
+ items: [
52
+ {
53
+ type: 'doc',
54
+ docId: 'intro',
55
+ position: 'left',
56
+ label: 'Tutorial',
57
+ },
58
+ {to: '/blog', label: 'Blog', position: 'left'},
59
+ {
60
+ href: 'https://github.com/facebook/docusaurus',
61
+ label: 'GitHub',
62
+ position: 'right',
63
+ },
64
+ ],
65
+ },
66
+ footer: {
67
+ style: 'dark',
68
+ links: [
69
+ {
70
+ title: 'Docs',
71
+ items: [
72
+ {
73
+ label: 'Tutorial',
74
+ to: '/docs/intro',
75
+ },
76
+ ],
77
+ },
78
+ {
79
+ title: 'Community',
80
+ items: [
81
+ {
82
+ label: 'Stack Overflow',
83
+ href: 'https://stackoverflow.com/questions/tagged/docusaurus',
84
+ },
85
+ {
86
+ label: 'Discord',
87
+ href: 'https://discordapp.com/invite/docusaurus',
88
+ },
89
+ {
90
+ label: 'Twitter',
91
+ href: 'https://twitter.com/docusaurus',
92
+ },
93
+ ],
94
+ },
95
+ {
96
+ title: 'More',
97
+ items: [
98
+ {
99
+ label: 'Blog',
100
+ to: '/blog',
101
+ },
102
+ {
103
+ label: 'GitHub',
104
+ href: 'https://github.com/facebook/docusaurus',
105
+ },
106
+ ],
107
+ },
108
+ ],
109
+ copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
110
+ },
111
+ prism: {
112
+ theme: lightCodeTheme,
113
+ darkTheme: darkCodeTheme,
114
+ },
115
+ }),
116
+ };
117
+
118
+ module.exports = config;