create-docusaurus 3.0.0-alpha.0 → 3.0.0-rc.0

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.
package/bin/index.js CHANGED
@@ -31,7 +31,7 @@ program
31
31
  .arguments('[siteName] [template] [rootDir]')
32
32
  .option(
33
33
  '-p, --package-manager <manager>',
34
- 'The package manager used to install dependencies. One of yarn, npm, and pnpm.',
34
+ 'The package manager used to install dependencies. One of yarn, npm, pnpm, and bun.',
35
35
  )
36
36
  .option(
37
37
  '-s, --skip-install',
package/lib/index.d.ts CHANGED
@@ -14,6 +14,7 @@ declare const lockfileNames: {
14
14
  npm: string;
15
15
  yarn: string;
16
16
  pnpm: string;
17
+ bun: string;
17
18
  };
18
19
  type PackageManager = keyof typeof lockfileNames;
19
20
  declare const gitStrategies: readonly ["deep", "shallow", "copy", "custom"];
package/lib/index.js CHANGED
@@ -20,6 +20,7 @@ const lockfileNames = {
20
20
  npm: 'package-lock.json',
21
21
  yarn: 'yarn.lock',
22
22
  pnpm: 'pnpm-lock.yaml',
23
+ bun: 'bun.lockb',
23
24
  };
24
25
  const packageManagers = Object.keys(lockfileNames);
25
26
  async function findPackageManagerFromLockFile(rootDir) {
@@ -37,10 +38,11 @@ function findPackageManagerFromUserAgent() {
37
38
  async function askForPackageManagerChoice() {
38
39
  const hasYarn = shell.exec('yarn --version', { silent: true }).code === 0;
39
40
  const hasPnpm = shell.exec('pnpm --version', { silent: true }).code === 0;
40
- if (!hasYarn && !hasPnpm) {
41
+ const hasBun = shell.exec('bun --version', { silent: true }).code === 0;
42
+ if (!hasYarn && !hasPnpm && !hasBun) {
41
43
  return 'npm';
42
44
  }
43
- const choices = ['npm', hasYarn && 'yarn', hasPnpm && 'pnpm']
45
+ const choices = ['npm', hasYarn && 'yarn', hasPnpm && 'pnpm', hasBun && 'bun']
44
46
  .filter((p) => Boolean(p))
45
47
  .map((p) => ({ title: p, value: p }));
46
48
  return ((await prompts({
@@ -93,15 +95,6 @@ async function readTemplates() {
93
95
  }
94
96
  async function copyTemplate(template, dest, typescript) {
95
97
  await fs.copy(path.join(templatesDir, 'shared'), dest);
96
- // TypeScript variants will copy duplicate resources like CSS & config from
97
- // base template
98
- if (typescript) {
99
- await fs.copy(template.path, dest, {
100
- filter: async (filePath) => (await fs.stat(filePath)).isDirectory() ||
101
- path.extname(filePath) === '.css' ||
102
- path.basename(filePath) === 'docusaurus.config.js',
103
- });
104
- }
105
98
  await fs.copy(typescript ? template.tsVariantPath : template.path, dest, {
106
99
  // Symlinks don't exist in published npm packages anymore, so this is only
107
100
  // to prevent errors during local testing
@@ -387,7 +380,11 @@ export default async function init(rootDir, reqName, reqTemplate, cliOptions = {
387
380
  if (!cliOptions.skipInstall) {
388
381
  shell.cd(dest);
389
382
  logger.info `Installing dependencies with name=${pkgManager}...`;
390
- if (shell.exec(pkgManager === 'yarn' ? 'yarn' : `${pkgManager} install --color always`, {
383
+ if (shell.exec(pkgManager === 'yarn'
384
+ ? 'yarn'
385
+ : pkgManager === 'bun'
386
+ ? 'bun install'
387
+ : `${pkgManager} install --color always`, {
391
388
  env: {
392
389
  ...process.env,
393
390
  // Force coloring the output, since the command is invoked by
@@ -404,19 +401,21 @@ export default async function init(rootDir, reqName, reqTemplate, cliOptions = {
404
401
  }
405
402
  }
406
403
  const useNpm = pkgManager === 'npm';
404
+ const useBun = pkgManager === 'bun';
405
+ const useRunCommand = useNpm || useBun;
407
406
  logger.success `Created name=${cdpath}.`;
408
407
  logger.info `Inside that directory, you can run several commands:
409
408
 
410
409
  code=${`${pkgManager} start`}
411
410
  Starts the development server.
412
411
 
413
- code=${`${pkgManager} ${useNpm ? 'run ' : ''}build`}
412
+ code=${`${pkgManager} ${useRunCommand ? 'run ' : ''}build`}
414
413
  Bundles your website into static files for production.
415
414
 
416
- code=${`${pkgManager} ${useNpm ? 'run ' : ''}serve`}
415
+ code=${`${pkgManager} ${useRunCommand ? 'run ' : ''}serve`}
417
416
  Serves the built website locally.
418
417
 
419
- code=${`${pkgManager} deploy`}
418
+ code=${`${pkgManager} ${useRunCommand ? 'run ' : ''}deploy`}
420
419
  Publishes the website to GitHub pages.
421
420
 
422
421
  We recommend that you begin by typing:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-docusaurus",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-rc.0",
4
4
  "description": "Create Docusaurus apps easily.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -22,22 +22,22 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@docusaurus/logger": "3.0.0-alpha.0",
26
- "@docusaurus/utils": "3.0.0-alpha.0",
25
+ "@docusaurus/logger": "3.0.0-rc.0",
26
+ "@docusaurus/utils": "3.0.0-rc.0",
27
27
  "commander": "^5.1.0",
28
- "fs-extra": "^11.1.0",
28
+ "fs-extra": "^11.1.1",
29
29
  "lodash": "^4.17.21",
30
30
  "prompts": "^2.4.2",
31
- "semver": "^7.3.8",
31
+ "semver": "^7.5.4",
32
32
  "shelljs": "^0.8.5",
33
- "supports-color": "^9.3.1",
34
- "tslib": "^2.5.0"
33
+ "supports-color": "^9.4.0",
34
+ "tslib": "^2.6.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/supports-color": "^8.1.1"
38
38
  },
39
39
  "engines": {
40
- "node": ">=16.14"
40
+ "node": ">=18.0"
41
41
  },
42
- "gitHead": "7327f7ff880ed97ad7855744e59c9c55d467a950"
42
+ "gitHead": "e66dfe04d2972edce66f431908470c61340f8ffc"
43
43
  }
@@ -4,8 +4,7 @@
4
4
  // There are various equivalent ways to declare your Docusaurus config.
5
5
  // See: https://docusaurus.io/docs/api/docusaurus-config
6
6
 
7
- const lightCodeTheme = require('prism-react-renderer/themes/github');
8
- const darkCodeTheme = require('prism-react-renderer/themes/dracula');
7
+ import {themes as prismThemes} from 'prism-react-renderer';
9
8
 
10
9
  /** @type {import('@docusaurus/types').Config} */
11
10
  const config = {
@@ -14,7 +13,7 @@ const config = {
14
13
  favicon: 'img/favicon.ico',
15
14
 
16
15
  // Set the production url of your site here
17
- url: 'https://your-docusaurus-test-site.com',
16
+ url: 'https://your-docusaurus-site.example.com',
18
17
  // Set the /<baseUrl>/ pathname under which your site is served
19
18
  // For GitHub pages deployment, it is often '/<projectName>/'
20
19
  baseUrl: '/',
@@ -41,7 +40,7 @@ const config = {
41
40
  /** @type {import('@docusaurus/preset-classic').Options} */
42
41
  ({
43
42
  docs: {
44
- sidebarPath: require.resolve('./sidebars.js'),
43
+ sidebarPath: './sidebars.js',
45
44
  // Please change this to your repo.
46
45
  // Remove this to remove the "edit this page" links.
47
46
  editUrl:
@@ -55,7 +54,7 @@ const config = {
55
54
  'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
56
55
  },
57
56
  theme: {
58
- customCss: require.resolve('./src/css/custom.css'),
57
+ customCss: './src/css/custom.css',
59
58
  },
60
59
  }),
61
60
  ],
@@ -133,10 +132,10 @@ const config = {
133
132
  copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
134
133
  },
135
134
  prism: {
136
- theme: lightCodeTheme,
137
- darkTheme: darkCodeTheme,
135
+ theme: prismThemes.github,
136
+ darkTheme: prismThemes.dracula,
138
137
  },
139
138
  }),
140
139
  };
141
140
 
142
- module.exports = config;
141
+ export default config;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-2-classic-template",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-rc.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "docusaurus": "docusaurus",
@@ -14,16 +14,17 @@
14
14
  "write-heading-ids": "docusaurus write-heading-ids"
15
15
  },
16
16
  "dependencies": {
17
- "@docusaurus/core": "3.0.0-alpha.0",
18
- "@docusaurus/preset-classic": "3.0.0-alpha.0",
17
+ "@docusaurus/core": "3.0.0-rc.0",
18
+ "@docusaurus/preset-classic": "3.0.0-rc.0",
19
19
  "@mdx-js/react": "^2.3.0",
20
20
  "clsx": "^1.2.1",
21
- "prism-react-renderer": "^1.3.5",
21
+ "prism-react-renderer": "^2.1.0",
22
22
  "react": "^18.0.0",
23
23
  "react-dom": "^18.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@docusaurus/module-type-aliases": "3.0.0-alpha.0"
26
+ "@docusaurus/module-type-aliases": "3.0.0-rc.0",
27
+ "@docusaurus/types": "3.0.0-rc.0"
27
28
  },
28
29
  "browserslist": {
29
30
  "production": [
@@ -32,12 +33,12 @@
32
33
  "not op_mini all"
33
34
  ],
34
35
  "development": [
35
- "last 1 chrome version",
36
- "last 1 firefox version",
37
- "last 1 safari version"
36
+ "last 3 chrome version",
37
+ "last 3 firefox version",
38
+ "last 5 safari version"
38
39
  ]
39
40
  },
40
41
  "engines": {
41
- "node": ">=16.14"
42
+ "node": ">=18.0"
42
43
  }
43
44
  }
@@ -30,4 +30,4 @@ const sidebars = {
30
30
  */
31
31
  };
32
32
 
33
- module.exports = sidebars;
33
+ export default sidebars;
@@ -0,0 +1,133 @@
1
+ import {themes as prismThemes} from 'prism-react-renderer';
2
+ import type {Config} from '@docusaurus/types';
3
+ import type * as Preset from '@docusaurus/preset-classic';
4
+
5
+ const config: Config = {
6
+ title: 'My Site',
7
+ tagline: 'Dinosaurs are cool',
8
+ favicon: 'img/favicon.ico',
9
+
10
+ // Set the production url of your site here
11
+ url: 'https://your-docusaurus-site.example.com',
12
+ // Set the /<baseUrl>/ pathname under which your site is served
13
+ // For GitHub pages deployment, it is often '/<projectName>/'
14
+ baseUrl: '/',
15
+
16
+ // GitHub pages deployment config.
17
+ // If you aren't using GitHub pages, you don't need these.
18
+ organizationName: 'facebook', // Usually your GitHub org/user name.
19
+ projectName: 'docusaurus', // Usually your repo name.
20
+
21
+ onBrokenLinks: 'throw',
22
+ onBrokenMarkdownLinks: 'warn',
23
+
24
+ // Even if you don't use internationalization, you can use this field to set
25
+ // useful metadata like html lang. For example, if your site is Chinese, you
26
+ // may want to replace "en" with "zh-Hans".
27
+ i18n: {
28
+ defaultLocale: 'en',
29
+ locales: ['en'],
30
+ },
31
+
32
+ presets: [
33
+ [
34
+ 'classic',
35
+ {
36
+ docs: {
37
+ sidebarPath: './sidebars.ts',
38
+ // Please change this to your repo.
39
+ // Remove this to remove the "edit this page" links.
40
+ editUrl:
41
+ 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
42
+ },
43
+ blog: {
44
+ showReadingTime: true,
45
+ // Please change this to your repo.
46
+ // Remove this to remove the "edit this page" links.
47
+ editUrl:
48
+ 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
49
+ },
50
+ theme: {
51
+ customCss: './src/css/custom.css',
52
+ },
53
+ } satisfies Preset.Options,
54
+ ],
55
+ ],
56
+
57
+ themeConfig: {
58
+ // Replace with your project's social card
59
+ image: 'img/docusaurus-social-card.jpg',
60
+ navbar: {
61
+ title: 'My Site',
62
+ logo: {
63
+ alt: 'My Site Logo',
64
+ src: 'img/logo.svg',
65
+ },
66
+ items: [
67
+ {
68
+ type: 'docSidebar',
69
+ sidebarId: 'tutorialSidebar',
70
+ position: 'left',
71
+ label: 'Tutorial',
72
+ },
73
+ {to: '/blog', label: 'Blog', position: 'left'},
74
+ {
75
+ href: 'https://github.com/facebook/docusaurus',
76
+ label: 'GitHub',
77
+ position: 'right',
78
+ },
79
+ ],
80
+ },
81
+ footer: {
82
+ style: 'dark',
83
+ links: [
84
+ {
85
+ title: 'Docs',
86
+ items: [
87
+ {
88
+ label: 'Tutorial',
89
+ to: '/docs/intro',
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ title: 'Community',
95
+ items: [
96
+ {
97
+ label: 'Stack Overflow',
98
+ href: 'https://stackoverflow.com/questions/tagged/docusaurus',
99
+ },
100
+ {
101
+ label: 'Discord',
102
+ href: 'https://discordapp.com/invite/docusaurus',
103
+ },
104
+ {
105
+ label: 'Twitter',
106
+ href: 'https://twitter.com/docusaurus',
107
+ },
108
+ ],
109
+ },
110
+ {
111
+ title: 'More',
112
+ items: [
113
+ {
114
+ label: 'Blog',
115
+ to: '/blog',
116
+ },
117
+ {
118
+ label: 'GitHub',
119
+ href: 'https://github.com/facebook/docusaurus',
120
+ },
121
+ ],
122
+ },
123
+ ],
124
+ copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
125
+ },
126
+ prism: {
127
+ theme: prismThemes.github,
128
+ darkTheme: prismThemes.dracula,
129
+ },
130
+ } satisfies Preset.ThemeConfig,
131
+ };
132
+
133
+ export default config;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-2-classic-typescript-template",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-rc.0",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "docusaurus": "docusaurus",
@@ -15,18 +15,19 @@
15
15
  "typecheck": "tsc"
16
16
  },
17
17
  "dependencies": {
18
- "@docusaurus/core": "3.0.0-alpha.0",
19
- "@docusaurus/preset-classic": "3.0.0-alpha.0",
18
+ "@docusaurus/core": "3.0.0-rc.0",
19
+ "@docusaurus/preset-classic": "3.0.0-rc.0",
20
20
  "@mdx-js/react": "^2.3.0",
21
21
  "clsx": "^1.2.1",
22
- "prism-react-renderer": "^1.3.5",
22
+ "prism-react-renderer": "^2.1.0",
23
23
  "react": "^18.0.0",
24
24
  "react-dom": "^18.0.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@docusaurus/module-type-aliases": "3.0.0-alpha.0",
28
- "@docusaurus/tsconfig": "3.0.0-alpha.0",
29
- "typescript": "^5.0.4"
27
+ "@docusaurus/module-type-aliases": "3.0.0-rc.0",
28
+ "@docusaurus/tsconfig": "3.0.0-rc.0",
29
+ "@docusaurus/types": "3.0.0-rc.0",
30
+ "typescript": "~5.2.2"
30
31
  },
31
32
  "browserslist": {
32
33
  "production": [
@@ -35,12 +36,12 @@
35
36
  "not op_mini all"
36
37
  ],
37
38
  "development": [
38
- "last 1 chrome version",
39
- "last 1 firefox version",
40
- "last 1 safari version"
39
+ "last 3 chrome version",
40
+ "last 3 firefox version",
41
+ "last 5 safari version"
41
42
  ]
42
43
  },
43
44
  "engines": {
44
- "node": ">=16.14"
45
+ "node": ">=18.0"
45
46
  }
46
47
  }
@@ -0,0 +1,31 @@
1
+ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
2
+
3
+ /**
4
+ * Creating a sidebar enables you to:
5
+ - create an ordered group of docs
6
+ - render a sidebar for each doc of that group
7
+ - provide next/previous navigation
8
+
9
+ The sidebars can be generated from the filesystem, or explicitly defined here.
10
+
11
+ Create as many sidebars as you want.
12
+ */
13
+ const sidebars: SidebarsConfig = {
14
+ // By default, Docusaurus generates a sidebar from the docs folder structure
15
+ tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
16
+
17
+ // But you can create a sidebar manually
18
+ /*
19
+ tutorialSidebar: [
20
+ 'intro',
21
+ 'hello',
22
+ {
23
+ type: 'category',
24
+ label: 'Tutorial',
25
+ items: ['tutorial-basics/create-a-document'],
26
+ },
27
+ ],
28
+ */
29
+ };
30
+
31
+ export default sidebars;
@@ -14,7 +14,7 @@ Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new
14
14
 
15
15
  ### What you'll need
16
16
 
17
- - [Node.js](https://nodejs.org/en/download/) version 16.14 or above:
17
+ - [Node.js](https://nodejs.org/en/download/) version 18.0 or above:
18
18
  - When installing Node.js, you are recommended to check all checkboxes related to dependencies.
19
19
 
20
20
  ## Generate a new site
@@ -42,7 +42,7 @@ This is my **first Docusaurus document**!
42
42
  It is also possible to create your sidebar explicitly in `sidebars.js`:
43
43
 
44
44
  ```js title="sidebars.js"
45
- module.exports = {
45
+ export default {
46
46
  tutorialSidebar: [
47
47
  'intro',
48
48
  // highlight-next-line
@@ -28,7 +28,7 @@ To navigate seamlessly across versions, add a version dropdown.
28
28
  Modify the `docusaurus.config.js` file:
29
29
 
30
30
  ```js title="docusaurus.config.js"
31
- module.exports = {
31
+ export default {
32
32
  themeConfig: {
33
33
  navbar: {
34
34
  items: [
@@ -11,7 +11,7 @@ Let's translate `docs/intro.md` to French.
11
11
  Modify `docusaurus.config.js` to add support for the `fr` locale:
12
12
 
13
13
  ```js title="docusaurus.config.js"
14
- module.exports = {
14
+ export default {
15
15
  i18n: {
16
16
  defaultLocale: 'en',
17
17
  locales: ['en', 'fr'],
@@ -54,7 +54,7 @@ To navigate seamlessly across languages, add a locale dropdown.
54
54
  Modify the `docusaurus.config.js` file:
55
55
 
56
56
  ```js title="docusaurus.config.js"
57
- module.exports = {
57
+ export default {
58
58
  themeConfig: {
59
59
  navbar: {
60
60
  items: [