create-docusaurus 2.0.0-beta.18 → 2.0.0-beta.19

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/lib/index.js CHANGED
@@ -37,11 +37,11 @@ function findPackageManagerFromUserAgent() {
37
37
  }
38
38
  async function askForPackageManagerChoice() {
39
39
  const hasYarn = shell.exec('yarn --version', { silent: true }).code === 0;
40
- const hasPNPM = shell.exec('pnpm --version', { silent: true }).code === 0;
41
- if (!hasYarn && !hasPNPM) {
40
+ const hasPnpm = shell.exec('pnpm --version', { silent: true }).code === 0;
41
+ if (!hasYarn && !hasPnpm) {
42
42
  return 'npm';
43
43
  }
44
- const choices = ['npm', hasYarn && 'yarn', hasPNPM && 'pnpm']
44
+ const choices = ['npm', hasYarn && 'yarn', hasPnpm && 'pnpm']
45
45
  .filter((p) => Boolean(p))
46
46
  .map((p) => ({ title: p, value: p }));
47
47
  return (await prompts({
@@ -66,8 +66,7 @@ function isValidGitRepoUrl(gitRepoUrl) {
66
66
  return ['https://', 'git@'].some((item) => gitRepoUrl.startsWith(item));
67
67
  }
68
68
  async function updatePkg(pkgPath, obj) {
69
- const content = await fs.readFile(pkgPath, 'utf-8');
70
- const pkg = JSON.parse(content);
69
+ const pkg = await fs.readJSON(pkgPath);
71
70
  const newPkg = Object.assign(pkg, obj);
72
71
  await fs.outputFile(pkgPath, `${JSON.stringify(newPkg, null, 2)}\n`);
73
72
  }
@@ -110,7 +109,7 @@ async function copyTemplate(templatesDir, template, dest) {
110
109
  });
111
110
  }
112
111
  await fs.copy(path.resolve(templatesDir, template), dest, {
113
- // Symlinks don't exist in published NPM packages anymore, so this is only
112
+ // Symlinks don't exist in published npm packages anymore, so this is only
114
113
  // to prevent errors during local testing
115
114
  filter: async (filePath) => !(await fs.lstat(filePath)).isSymbolicLink(),
116
115
  });
@@ -192,7 +191,7 @@ export default async function init(rootDir, siteName, reqTemplate, cliOptions =
192
191
  return logger.red('Invalid repository URL');
193
192
  },
194
193
  message: logger.interpolate `Enter a repository URL from GitHub, Bitbucket, GitLab, or any other public repo.
195
- (e.g: path=${'https://github.com/ownerName/repoName.git'})`,
194
+ (e.g: url=${'https://github.com/ownerName/repoName.git'})`,
196
195
  });
197
196
  ({ gitStrategy } = await prompts({
198
197
  type: 'select',
@@ -234,7 +233,7 @@ export default async function init(rootDir, siteName, reqTemplate, cliOptions =
234
233
  }
235
234
  logger.info('Creating new Docusaurus project...');
236
235
  if (isValidGitRepoUrl(template)) {
237
- logger.info `Cloning Git template path=${template}...`;
236
+ logger.info `Cloning Git template url=${template}...`;
238
237
  if (!gitStrategies.includes(gitStrategy)) {
239
238
  logger.error `Invalid git strategy: name=${gitStrategy}. Value must be one of ${gitStrategies.join(', ')}.`;
240
239
  process.exit(1);
@@ -252,7 +251,7 @@ export default async function init(rootDir, siteName, reqTemplate, cliOptions =
252
251
  // Docusaurus templates.
253
252
  if (useTS) {
254
253
  if (!(await hasTS(template))) {
255
- logger.error `Template name=${template} doesn't provide the Typescript variant.`;
254
+ logger.error `Template name=${template} doesn't provide the TypeScript variant.`;
256
255
  process.exit(1);
257
256
  }
258
257
  template = `${template}${TypeScriptTemplateSuffix}`;
@@ -322,7 +321,7 @@ export default async function init(rootDir, siteName, reqTemplate, cliOptions =
322
321
  }
323
322
  }
324
323
  const useNpm = pkgManager === 'npm';
325
- logger.success `Created path=${cdpath}.`;
324
+ logger.success `Created name=${cdpath}.`;
326
325
  logger.info `Inside that directory, you can run several commands:
327
326
 
328
327
  code=${`${pkgManager} start`}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-docusaurus",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "description": "Create Docusaurus apps easily.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -22,15 +22,15 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@docusaurus/logger": "2.0.0-beta.18",
25
+ "@docusaurus/logger": "2.0.0-beta.19",
26
26
  "commander": "^5.1.0",
27
- "fs-extra": "^10.0.1",
27
+ "fs-extra": "^10.1.0",
28
28
  "lodash": "^4.17.21",
29
29
  "prompts": "^2.4.2",
30
- "semver": "^7.3.5",
30
+ "semver": "^7.3.7",
31
31
  "shelljs": "^0.8.5",
32
- "supports-color": "^9.2.1",
33
- "tslib": "^2.3.1"
32
+ "supports-color": "^9.2.2",
33
+ "tslib": "^2.4.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/supports-color": "^8.1.1"
@@ -38,5 +38,5 @@
38
38
  "engines": {
39
39
  "node": ">=14"
40
40
  },
41
- "gitHead": "1a945d06993d53376e61bed2c942799fe07dc336"
41
+ "gitHead": "a71e60a49cce93c1006ef10c41ac03187f057102"
42
42
  }
@@ -13,9 +13,20 @@ const config = {
13
13
  onBrokenLinks: 'throw',
14
14
  onBrokenMarkdownLinks: 'warn',
15
15
  favicon: 'img/favicon.ico',
16
+
17
+ // GitHub pages deployment config.
18
+ // If you aren't using GitHub pages, you don't need these.
16
19
  organizationName: 'facebook', // Usually your GitHub org/user name.
17
20
  projectName: 'docusaurus', // Usually your repo name.
18
21
 
22
+ // Even if you don't use internalization, you can use this field to set useful
23
+ // metadata like html lang. For example, if your site is Chinese, you may want
24
+ // to replace "en" with "zh-Hans".
25
+ i18n: {
26
+ defaultLocale: 'en',
27
+ locales: ['en'],
28
+ },
29
+
19
30
  presets: [
20
31
  [
21
32
  'classic',
@@ -24,11 +35,14 @@ const config = {
24
35
  docs: {
25
36
  sidebarPath: require.resolve('./sidebars.js'),
26
37
  // Please change this to your repo.
27
- editUrl: 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
38
+ // Remove this to remove the "edit this page" links.
39
+ editUrl:
40
+ 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
28
41
  },
29
42
  blog: {
30
43
  showReadingTime: true,
31
44
  // Please change this to your repo.
45
+ // Remove this to remove the "edit this page" links.
32
46
  editUrl:
33
47
  'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
34
48
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-2-classic-template",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "docusaurus": "docusaurus",
@@ -14,14 +14,17 @@
14
14
  "write-heading-ids": "docusaurus write-heading-ids"
15
15
  },
16
16
  "dependencies": {
17
- "@docusaurus/core": "2.0.0-beta.18",
18
- "@docusaurus/preset-classic": "2.0.0-beta.18",
17
+ "@docusaurus/core": "2.0.0-beta.19",
18
+ "@docusaurus/preset-classic": "2.0.0-beta.19",
19
19
  "@mdx-js/react": "^1.6.22",
20
20
  "clsx": "^1.1.1",
21
21
  "prism-react-renderer": "^1.3.1",
22
22
  "react": "^17.0.2",
23
23
  "react-dom": "^17.0.2"
24
24
  },
25
+ "devDependencies": {
26
+ "@docusaurus/module-type-aliases": "2.0.0-beta.19"
27
+ },
25
28
  "browserslist": {
26
29
  "production": [
27
30
  ">0.5%",
@@ -14,6 +14,7 @@
14
14
  --ifm-color-primary-lighter: #359962;
15
15
  --ifm-color-primary-lightest: #3cad6e;
16
16
  --ifm-code-font-size: 95%;
17
+ --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
17
18
  }
18
19
 
19
20
  /* For readability concerns, you should choose a lighter palette in dark mode. */
@@ -25,15 +26,5 @@
25
26
  --ifm-color-primary-light: #29d5b0;
26
27
  --ifm-color-primary-lighter: #32d8b4;
27
28
  --ifm-color-primary-lightest: #4fddbf;
28
- }
29
-
30
- .docusaurus-highlight-code-line {
31
- background-color: rgba(0, 0, 0, 0.1);
32
- display: block;
33
- margin: 0 calc(-1 * var(--ifm-pre-padding));
34
- padding: 0 var(--ifm-pre-padding);
35
- }
36
-
37
- [data-theme='dark'] .docusaurus-highlight-code-line {
38
- background-color: rgba(0, 0, 0, 0.3);
29
+ --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
39
30
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-2-classic-typescript-template",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "docusaurus": "docusaurus",
@@ -15,8 +15,8 @@
15
15
  "typecheck": "tsc"
16
16
  },
17
17
  "dependencies": {
18
- "@docusaurus/core": "2.0.0-beta.18",
19
- "@docusaurus/preset-classic": "2.0.0-beta.18",
18
+ "@docusaurus/core": "2.0.0-beta.19",
19
+ "@docusaurus/preset-classic": "2.0.0-beta.19",
20
20
  "@mdx-js/react": "^1.6.22",
21
21
  "clsx": "^1.1.1",
22
22
  "prism-react-renderer": "^1.3.1",
@@ -24,9 +24,9 @@
24
24
  "react-dom": "^17.0.2"
25
25
  },
26
26
  "devDependencies": {
27
- "@docusaurus/module-type-aliases": "2.0.0-beta.18",
27
+ "@docusaurus/module-type-aliases": "2.0.0-beta.19",
28
28
  "@tsconfig/docusaurus": "^1.0.5",
29
- "typescript": "^4.6.3"
29
+ "typescript": "^4.6.4"
30
30
  },
31
31
  "browserslist": {
32
32
  "production": [
@@ -18,6 +18,9 @@ const config = {
18
18
  onBrokenLinks: 'throw',
19
19
  onBrokenMarkdownLinks: 'warn',
20
20
  favicon: 'img/favicon.ico',
21
+
22
+ // GitHub pages deployment config.
23
+ // If you aren't using GitHub pages, you don't need these.
21
24
  organizationName: 'facebook', // Usually your GitHub org/user name.
22
25
  projectName: 'docusaurus', // Usually your repo name.
23
26
 
@@ -29,12 +32,14 @@ const config = {
29
32
  docs: {
30
33
  sidebarPath: require.resolve('./sidebars.js'),
31
34
  // Please change this to your repo.
35
+ // Remove this to remove the "edit this page" links.
32
36
  editUrl:
33
37
  'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
34
38
  },
35
39
  blog: {
36
40
  showReadingTime: true,
37
41
  // Please change this to your repo.
42
+ // Remove this to remove the "edit this page" links.
38
43
  editUrl:
39
44
  'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
40
45
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docusaurus-2-facebook-template",
3
- "version": "2.0.0-beta.18",
3
+ "version": "2.0.0-beta.19",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "docusaurus": "docusaurus",
@@ -18,8 +18,8 @@
18
18
  "format:diff": "prettier --config .prettierrc --list-different \"**/*.{js,jsx,ts,tsx,md,mdx}\""
19
19
  },
20
20
  "dependencies": {
21
- "@docusaurus/core": "2.0.0-beta.18",
22
- "@docusaurus/preset-classic": "2.0.0-beta.18",
21
+ "@docusaurus/core": "2.0.0-beta.19",
22
+ "@docusaurus/preset-classic": "2.0.0-beta.19",
23
23
  "@mdx-js/react": "^1.6.22",
24
24
  "clsx": "^1.1.1",
25
25
  "react": "^17.0.2",
@@ -27,16 +27,16 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@babel/eslint-parser": "^7.17.0",
30
- "eslint": "^8.11.0",
30
+ "eslint": "^8.14.0",
31
31
  "eslint-config-airbnb": "^19.0.4",
32
32
  "eslint-config-prettier": "^8.5.0",
33
33
  "eslint-plugin-header": "^3.1.1",
34
- "eslint-plugin-import": "^2.25.4",
34
+ "eslint-plugin-import": "^2.26.0",
35
35
  "eslint-plugin-jsx-a11y": "^6.5.1",
36
36
  "eslint-plugin-react": "^7.29.4",
37
- "eslint-plugin-react-hooks": "^4.3.0",
38
- "prettier": "^2.6.0",
39
- "stylelint": "^14.6.0"
37
+ "eslint-plugin-react-hooks": "^4.5.0",
38
+ "prettier": "^2.6.2",
39
+ "stylelint": "^14.8.1"
40
40
  },
41
41
  "browserslist": {
42
42
  "production": [
@@ -35,10 +35,3 @@
35
35
  --ifm-color-primary-lighter: #32d8b4;
36
36
  --ifm-color-primary-lightest: #4fddbf;
37
37
  }
38
-
39
- .docusaurus-highlight-code-line {
40
- background-color: rgb(72, 77, 91);
41
- display: block;
42
- margin: 0 calc(-1 * var(--ifm-pre-padding));
43
- padding: 0 var(--ifm-pre-padding);
44
- }
@@ -1,4 +1,8 @@
1
1
  {
2
2
  "label": "Tutorial - Basics",
3
- "position": 2
3
+ "position": 2,
4
+ "link": {
5
+ "type": "generated-index",
6
+ "description": "5 minutes to learn the most important Docusaurus concepts."
7
+ }
4
8
  }
@@ -43,7 +43,7 @@ Let's see how to [Create a page](./create-a-page.md).
43
43
 
44
44
  Regular Markdown images are supported.
45
45
 
46
- Add an image at `static/img/docusaurus.png` and display it in Markdown:
46
+ You can use absolute paths to reference images in the static directory (`static/img/docusaurus.png`):
47
47
 
48
48
  ```md
49
49
  ![Docusaurus logo](/img/docusaurus.png)
@@ -51,6 +51,8 @@ Add an image at `static/img/docusaurus.png` and display it in Markdown:
51
51
 
52
52
  ![Docusaurus logo](/img/docusaurus.png)
53
53
 
54
+ You can reference images relative to the current file as well, as shown in [the extra guides](../tutorial-extras/manage-docs-versions.md).
55
+
54
56
  ## Code Blocks
55
57
 
56
58
  Markdown code blocks are supported with Syntax highlighting.
@@ -1,4 +1,7 @@
1
1
  {
2
2
  "label": "Tutorial - Extras",
3
- "position": 3
3
+ "position": 3,
4
+ "link": {
5
+ "type": "generated-index"
6
+ }
4
7
  }
@@ -45,7 +45,7 @@ module.exports = {
45
45
 
46
46
  The docs version dropdown appears in your navbar:
47
47
 
48
- ![Docs Version Dropdown](/img/tutorial/docsVersionDropdown.png)
48
+ ![Docs Version Dropdown](./img/docsVersionDropdown.png)
49
49
 
50
50
  ## Update an existing version
51
51
 
@@ -71,7 +71,7 @@ module.exports = {
71
71
 
72
72
  The locale dropdown now appears in your navbar:
73
73
 
74
- ![Locale Dropdown](/img/tutorial/localeDropdown.png)
74
+ ![Locale Dropdown](./img/localeDropdown.png)
75
75
 
76
76
  ## Build your localized site
77
77