From 1d9269a263bf90e2792516acc4061ae1241032dc Mon Sep 17 00:00:00 2001 From: Thad Guidry Date: Fri, 28 Apr 2023 13:19:14 +0800 Subject: [PATCH 1/4] Add note about default config convention --- .../templates/classic/docusaurus.config.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/create-docusaurus/templates/classic/docusaurus.config.js b/packages/create-docusaurus/templates/classic/docusaurus.config.js index d67f3df37769..7ae64880eed9 100644 --- a/packages/create-docusaurus/templates/classic/docusaurus.config.js +++ b/packages/create-docusaurus/templates/classic/docusaurus.config.js @@ -1,10 +1,23 @@ // @ts-check -// Note: type annotations allow type checking and IDEs autocompletion +// Note: @type annotations throughout allow type checking and IDEs autocompletion + +// NOTE: In this default config, we declare a JS constant 'const config =' +// to further help your IDE give TypeScript hints while editing this file. +// 'module.exports =' at the very bottom is the syntax that uses +// that 'config' constant. There is not a single way/syntax to declare +// your config within this file. In fact, you have the full power of +// Node.js, as long as you return an object that matches the shape we +// expect with 'module.exports =' (or a function that creates that object). +// Our docs give examples of putting things inside 'module.exports = { }' +// which in this file is equivalent to putting into 'config = { }' instead, +// It's completely your choice. +// See also: https://docusaurus.io/docs/api/docusaurus-config#overview const lightCodeTheme = require('prism-react-renderer/themes/github'); const darkCodeTheme = require('prism-react-renderer/themes/dracula'); /** @type {import('@docusaurus/types').Config} */ +// 'config' gets used at the bottom of this file with 'module.exports =' const config = { title: 'My Site', tagline: 'Dinosaurs are cool', From 242d6fdfa8bcd5a4133d06de46f182c53e4ddbae Mon Sep 17 00:00:00 2001 From: Thad Guidry Date: Fri, 28 Apr 2023 13:25:28 +0800 Subject: [PATCH 2/4] oops forgot to add quoting --- .../create-docusaurus/templates/classic/docusaurus.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-docusaurus/templates/classic/docusaurus.config.js b/packages/create-docusaurus/templates/classic/docusaurus.config.js index 7ae64880eed9..5817ebf328dc 100644 --- a/packages/create-docusaurus/templates/classic/docusaurus.config.js +++ b/packages/create-docusaurus/templates/classic/docusaurus.config.js @@ -1,5 +1,5 @@ // @ts-check -// Note: @type annotations throughout allow type checking and IDEs autocompletion +// Note: '@type' annotations throughout allow type checking and IDEs autocompletion // NOTE: In this default config, we declare a JS constant 'const config =' // to further help your IDE give TypeScript hints while editing this file. From 4ad260d19d6565f7755449dcf2c09a9b068fa8ae Mon Sep 17 00:00:00 2001 From: Thad Guidry Date: Sat, 29 Apr 2023 09:38:54 +0800 Subject: [PATCH 3/4] Remove wall of text and extras as suggested --- .../templates/classic/docusaurus.config.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/create-docusaurus/templates/classic/docusaurus.config.js b/packages/create-docusaurus/templates/classic/docusaurus.config.js index 5817ebf328dc..699c8ca22d23 100644 --- a/packages/create-docusaurus/templates/classic/docusaurus.config.js +++ b/packages/create-docusaurus/templates/classic/docusaurus.config.js @@ -1,23 +1,13 @@ // @ts-check // Note: '@type' annotations throughout allow type checking and IDEs autocompletion -// NOTE: In this default config, we declare a JS constant 'const config =' -// to further help your IDE give TypeScript hints while editing this file. -// 'module.exports =' at the very bottom is the syntax that uses -// that 'config' constant. There is not a single way/syntax to declare -// your config within this file. In fact, you have the full power of -// Node.js, as long as you return an object that matches the shape we -// expect with 'module.exports =' (or a function that creates that object). -// Our docs give examples of putting things inside 'module.exports = { }' -// which in this file is equivalent to putting into 'config = { }' instead, -// It's completely your choice. -// See also: https://docusaurus.io/docs/api/docusaurus-config#overview +// There are various equivalent ways to declare your Docusaurus config. +// https://docusaurus.io/docs/api/docusaurus-config const lightCodeTheme = require('prism-react-renderer/themes/github'); const darkCodeTheme = require('prism-react-renderer/themes/dracula'); /** @type {import('@docusaurus/types').Config} */ -// 'config' gets used at the bottom of this file with 'module.exports =' const config = { title: 'My Site', tagline: 'Dinosaurs are cool', From 429c29bd59cdc30b81526028ed4889af91214935 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Fri, 28 Apr 2023 23:26:01 -0400 Subject: [PATCH 4/4] Update packages/create-docusaurus/templates/classic/docusaurus.config.js --- .../templates/classic/docusaurus.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/create-docusaurus/templates/classic/docusaurus.config.js b/packages/create-docusaurus/templates/classic/docusaurus.config.js index 699c8ca22d23..d8e50d95a02e 100644 --- a/packages/create-docusaurus/templates/classic/docusaurus.config.js +++ b/packages/create-docusaurus/templates/classic/docusaurus.config.js @@ -1,8 +1,8 @@ // @ts-check -// Note: '@type' annotations throughout allow type checking and IDEs autocompletion - +// `@type` JSDoc annotations allow editor autocompletion and type checking +// (when paired with `@ts-check`). // There are various equivalent ways to declare your Docusaurus config. -// https://docusaurus.io/docs/api/docusaurus-config +// See: https://docusaurus.io/docs/api/docusaurus-config const lightCodeTheme = require('prism-react-renderer/themes/github'); const darkCodeTheme = require('prism-react-renderer/themes/dracula');