Commit graph

111 commits

Author SHA1 Message Date
Sam Zhou
83d043ecb3
chore(v2): Fix more linter warnings (#4450) 2021-03-18 18:05:09 +01:00
Sébastien Lorber
806fdbaf27
feat(v2): infer default i18n locale config from locale code (#4449)
* improve locale default config

* remove localeConfigs from i18n tutorial

* better i18n types, tests and Intl.DisplayNames integration
2021-03-18 11:43:07 +01:00
Alexey Pyltsyn
f8fda885fc
chore(v2): prepare v2.0.0.alpha-72 release (#4440)
* chore(v2): prepare v2.0.0.alpha-72 release

* v2.0.0-alpha.72
2021-03-16 14:30:54 +03:00
Armano
abae86f283
refactor(v2): use correct plugin types (#4418) 2021-03-15 19:08:44 +01:00
Sébastien Lorber
986de6b214
chore(v2): prepare v2.0.0.alpha-71 release (#4376)
* prepare release

* v2.0.0-alpha.71
2021-03-09 18:45:05 +01:00
Long Ho
f46adffa17
feat(v2): add --config option to CLI (#4308)
* feat: add --config & --generated-files-dir option to CLI

* revert --generated-files-dir option + some refactors

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-03-02 17:34:23 +01:00
Bartosz Kaszubowski
bd3e66d706
chore(v2): bump/align deps in monorepo: commander, semver, fs-extra (#4264) 2021-02-22 19:05:25 +01:00
Sébastien Lorber
6a94ad989c
feat(v2): Add i18n default code translation bundles (#4215)
* Add default code translation bundles

* fix tests
2021-02-12 11:35:09 +01:00
Alexey Pyltsyn
0ac34b75c5
feat(v2): add support for RTL direction (#4140)
* feat(v2): add support for RTL

* Move to i18n config

* Move direction to localeConfigs

* Create RTL styles for Docusaurus styles (via new hook)

* update infima to alpha 19

* fix minor type error

* Fix build

* Cleanup

* polish RTL support

* polish RTL support

* revert english rtl dir

* minor RTL fix

* minor doc updates

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-02-10 10:52:26 +01:00
Alexey Pyltsyn
2fb642d9ee
feat(v2): allow extend PostCSS config (#4185)
* feat(v2): allow extend PostCSS config

* polish the configurePostCss system

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-02-09 20:02:54 +01:00
Reece Dunham
0252d01ebb
docs(v2): Add READMEs to v2 packages (#4034)
* docs(v2): Add READMEs to v2 packages

Signed-off-by: Reece Dunham <me@rdil.rocks>

* Update packages/docusaurus-remark-plugin-npm2yarn/package.json

* Update packages/docusaurus/README.md

* Update packages/docusaurus-plugin-sitemap/README.md

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2021-01-14 17:16:26 +01:00
Reece Dunham
66cc7364cd
feat(v2): Allow plugins to consume webpack stats (#4021)
* refactor(v2): Allow plugins to consume webpack stats

Signed-off-by: Reece Dunham <me@rdil.rocks>

* Warn level only

* Fix issue

* Revert start.ts change
2021-01-11 15:34:42 +01:00
Sébastien Lorber
3fc29f4b14
chore(v2): prepare v2.0.0.alpha-70 release (#3933)
* add alpha 70 changes

* v2.0.0-alpha.70
2020-12-17 20:08:20 +01:00
Sébastien Lorber
aff656182c
feat(v2): Add localeDropdown navbar item type + i18n localeConfigs field (#3916)
* Add localeDropdown navbar item type

* fix type + add localeConfigs test
2020-12-14 18:28:39 +01:00
Sébastien Lorber
41ef333e47
feat(v2): inline table-of-contents + refactor TOC (#3904)
* Add TOCInline theme component

* Add TOCInline theme component doc + migration guide

* remove useless getPathsToWatch on classic theme

* rename rightToc to toc

* add temp theme-bootstrap TOCInline comp to fix build issue
2020-12-11 16:30:53 +01:00
Bartosz Kaszubowski
ad31facb32
chore(v2): fix several lint warnings, add missing types, cleanup (#3844)
* fix several lint warnings, add missing types, cleanup

* fix EnumChangefreq issue

* better utilization of EnumChangefreq type

* update test snapshot
2020-11-30 16:42:58 +01:00
Sébastien Lorber
3166fab307
feat(v2): core v2 i18n support + Docusaurus site Crowdin integration (#3325)
* docs i18n initial poc

* docs i18n initial poc

* docs i18n initial poc

* docs i18n initial poc

* crowdin-v2 attempt

* fix source

* use crowdin env variable

* try to install crowdin on netlify

* try to install crowdin on netlify

* try to use crowdin jar directly

* try to curl the crowdin jar

* add java version cmd

* try to run crowdin jar in netlify

* fix translatedDocsDirPath

* fix loadContext issue due to site baseUrl not being modified in generted config file

* real validateLocalesFile

* add locale option to deploy command

* better LocalizationFile type

* create util getPluginI18nPath

* better core localization context loading code

* More explicit VersionMetadata type for localized docs folders

* Ability to translate blog posts with Crowdin!

* blog: refactor markdown loader + report broken links + try to get linkify working better

* upgrade crowdin config to upload all docs folder files except source code related files

* try to support translated pages

* make markdown pages translation work

* add write-translations cli command template

* fix site not  reloaded with correct options

* refactor a bit the read/write of @generated/i18n.json file

* Add <Translate> + translate() API + use it on the docusaurus homepage

* watch locale translation dir

* early POC of adding babel parsing for translation extraction

* fs.stat => pathExists

* add install:fast script

* TSC: noUnusedLocals false as it's already checked  by eslint

* POC of extracting translations from source code

* minor typo

* fix extracted key to code

* initial docs extracted translations

* stable plugin translations POC

* add crowdin commands

* quickfix for i18n deployment

* POC  of themeConfig translation

* add ability to have localized site without path prefix

* sidebar typo

* refactor translation system to output multiple translation files

* translate properly  the docs plugin

* improve theme classic translation

* rework translation extractor to handle new Chrome I18n JSON format (include id/description)

* writeTranslations: allow to pass locales cli arg

* fix ThemeConfig TS issues

* fix localizePath errors

* temporary add write-translations to netlify deploy preview

* complete example of french translated folder

* update fr folder

* remove all translations from repo

* minor translation  refactors

* fix all docs-related tests

* fix blog feed tests

* fix last blog tests

* refactor i18n context a bit, extract codeTranslations in an extra generated file

* improve @generated/i18n type

* fix some i18n todos

* minor refactor

* fix logo typing issue after merge

* move i18n.json to siteConfig instead

* try to fix windows CI build

* fix config test

* attempt to fix windows non-posix path

* increase v1 minify css jest timeout due to flaky test

* proper support for localizePath on windows

* remove non-functional install:fast

* docs, fix docsDirPathLocalized

* fix Docs i18n / md linkify issues

* ensure theme-classic swizzling will use "nextjs" sources (transpiled less aggressively, to make them human readable)

* fix some snapshots

* improve themeConfig translation code

* refactor a bit getPluginI18nPath

* readTranslationFileContent => ensure files are valid, fail fast

* fix versions tests

* add extractSourceCodeAstTranslations comments/resource links

* ignore eslint: packages/docusaurus-theme-classic/lib-next/

* fix windows CI with cross-env

* crowdin ignore .DS_Store

* improve writeTranslations + add exhaustive tests for translations.ts

* remove typo

* Wire currentLocale to algolia search

* improve i18n locale error

* Add tests for translationsExtractor.ts

* better code translation extraction regarding statically evaluable code

* fix typo

* fix typo

* improve theme-classic transpilation

* refactor  +  add i18n tests

* typo

* test new utils

* add missing snapshots

* fix snapshot

* blog onBrokenMarkdownLink

* add sidebars tests

* theme-classic index should now use ES modules

* tests for theme-classic translations

* useless comment

* add more translation tests

* simplify/cleanup writeTranslations

* try to fix Netlify fr deployment

* blog: test translated md is used during feed generation

* blog: better i18n tests regarding editUrl + md translation application

* more i18n tests for docs plugin

* more i18n tests for docs plugin

* Add tests for pages i18n

* polish docusaurus build i18n logs
2020-11-26 12:16:46 +01:00
Alexey Pyltsyn
d25a54f61d
chore(v2): prepare v2.0.0.alpha-69 release (#3808)
* chore(v2): prepare v2.0.0.alpha-69 release

* v2.0.0-alpha.69
2020-11-24 13:51:15 +03:00
Sébastien Lorber
746a19f25b
feat(v2): add baseUrlIssueBanner configuration to disable banner (#3802)
* add baseUrlIssueBanner configuration

* handle review
2020-11-23 20:54:13 +03:00
Sébastien Lorber
d1e51f7e3b
chore(v2): prepare v2.0.0.alpha-68 release (#3779)
* changelog

* add alpha 68 docs

* add missing publishConfig

* update publish doc + v1 private package system

* add version files

* v2.0.0-alpha.68
2020-11-18 20:02:06 +01:00
iAmir
8f2d898f22
feat(v2): onBrokenMarkdownLinks config (#3658)
* refactor(v2): move `reportMessage` from `core/src/server/utils` to `utils` package

* feat(v2): handle broken markdown links by using onBrokenLinks prop from siteconfig

* feat(v2): add a new site config prop called `onBrokenMarkdownLinks`

works like onBrokenLinks, but only for markdown links

* feat(v2): add `onBrokenMarkdownLinks` to API docs

* some changes regarding test issues after adding `onBrokenMarkdownLink`

* Update website/versioned_docs/version-2.0.0-alpha.66/api/docusaurus.config.js.md

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2020-10-31 18:04:56 +01:00
Sébastien Lorber
44535f7555
fix(v2): docusaurus start --poll 500 should work + better config load failure error (#3622)
* start --poll 500 should be accepted + better error message when siteDir is wrongly passed as a cli arg and lead to config loading failure

* docusaurus start --poll 500  option should also be used for chokidar

* config error message: relative path for reliable tests

* update snapshot

* document start --poll [interval]
2020-10-21 19:16:53 +02:00
Rhys Arkins
6930e91508
fix: add repository metadata to all packages (#3613)
* fix: add repository metadata to all packages

* empty commit for cla bot

* move validate-package-json.test.ts + add glob devDependency

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-10-21 15:05:01 +02:00
Sébastien Lorber
14447707c2
chore(v2): prepare v2.0.0.alpha-66 release (#3608)
* release alpha 66

* v2.0.0-alpha.66
2020-10-19 19:44:26 +02:00
Hamza Hamidi
e0c644e623
feat(v2): Add themeConfig.noIndex option #3528 (#3573)
* feat(v2): Add themeConfig.noIndex option #3528

* feat(v2): Add themeConfig.noIndex optionthrough ssrTemplate

* feat(v2): Include themeConfig.noIndex in CLI migration v1 to v2

* feat(v2): Remove themeConfig.noIndex from env dev
2020-10-14 11:14:16 +02:00
Sébastien Lorber
5b79f2ebc2
feat(v2): site client modules (#3545)
* site client modules

* Update website/docs/api/docusaurus.config.js.md

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2020-10-07 14:44:14 +03:00
Umair Kamran
10973476ff
fix(v2): Fixes serve cli --port option (#3531)
* fix(v2): Fixes serve cli --port option

* refactor a bit the start/serve cli options management

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-10-05 15:20:03 +02:00
Alexey Pyltsyn
f5f2064656
chore(v2): prepare v2.0.0.alpha-65 release (#3525)
* chore(v2): prepare v2.0.0.alpha-65 release

* v2.0.0-alpha.65
2020-10-02 17:09:16 +03:00
Bartosz Kaszubowski
c0d8238c49
feat(v2): add ability to set custom title delimiter in config (#3460)
* feat(v2): add custom title delimiter to the theme classic

* fix validation tests

* remove title delimiter fallback

* move titleDelimiter to main config, update theme-bootstrap

* remove test value from config

* update test snapshot

* Improve docs

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
2020-09-26 00:25:19 +03:00
Sébastien Lorber
9bf4dfb275
chore(v2): prepare v2.0.0.alpha-64 release (#3440)
* add 2.0.0 alpha 64 files

* v2.0.0-alpha.64
2020-09-11 20:35:05 +02:00
Sébastien Lorber
8af3ad4250
chore(v2): prepare v2.0.0.alpha-63 release (#3400)
* add alpha 63 + remove +3month old versions

* update publish guide

* v2.0.0-alpha.63
2020-09-03 18:52:03 +02:00
Méril
3ace60043b
feat(v2): allow users to specify a custom ssr HTML template (#3387)
* feat(v2): allow users to specify a custom ssr HTML template

* docs(v2): add ssrTemplate property to docusaurus.config.js page
2020-09-02 19:29:04 +02:00
Sébastien Lorber
ab3ebdad39
chore(v2): pin exact dependency versions (#3386)
* Attempt to pin all dependency versions exactly for https://github.com/facebook/docusaurus/issues/3371

* warn if @docusaurus package versions mismatch

* fix yarn lock
2020-09-02 11:42:17 +02:00
Sébastien Lorber
4f448bd54b
chore(v2): prepare v2.0.0.alpha-62 release (#3359)
* Add alpha 62

* v2.0.0-alpha.62
2020-08-28 19:17:56 +02:00
Sam Zhou
16ae3bf462
fix(v2): Add missing dependencies to packages (#3355) 2020-08-28 15:04:44 +02:00
Sam Zhou
b38f562322
chore(v2): Define type for markdown right table of contents (#3306) 2020-08-20 17:57:19 +02:00
Sébastien Lorber
fe281a8ebe
feat(v2): debug pages + debug layout + ability to debug content (#3229)
* improve debug plugin:
- add multiple debug pages + debug layout
- ability to debug plugin contentLoaded data

* add missing dependency

* fix broken test

* improve content rendering a bit

* create basic DebugJsonView

* fix ReactJson SSR issues
2020-08-07 11:47:43 +02:00
Anshul Goyal
ef9314e5a4
feat(v2): update swizzle command to suggest component/theme (#3021)
* update swizzle command

* change messages

* fix formatting

* add docs

* fix component lisiting

* allow themes to provide a list for safe swizzle components

* support both commanjs and ES exports

* fix debug plugin doesn't swizzle

* add dos

* remove unsed file

* fix docs plugin not swizzle properly

* fix console.log

* use new validate

* fix linting

* use config options for plugin

* rerun test

* fix type

* add a comment

* Update packages/docusaurus/src/commands/swizzle.ts

* Update packages/docusaurus/src/commands/swizzle.ts

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2020-08-06 13:53:03 +02:00
Sébastien Lorber
48b996773c
chore(v2): prepare v2.0.0.alpha-61 release (#3182)
* alpha 61 release

* doc prettier

* v2.0.0-alpha.61
2020-08-01 15:24:46 +02:00
Teik Jun
300aecb8bc
feat(v2): warn user when there are conflicting routes (#3083)
* feat(v2): add warning for path override

* feat(v2): check all routes recursively

* docs(v2): add docs for conflicting routes

* style(v2): improve comments in code

* refactor(v2): remove unused lifecycle method from docs plugin

* Revert "refactor(v2): remove unused lifecycle method from docs plugin"

This reverts commit 8b2caaa091.

* feat(v2): add option for changing duplicate path behavior

* feat(v2): decouple logging from logic and detect duplicate routes in one pass

* test(v2): fix failing tests

* test(v2): add tests for duplicateRoutes

* test(v2): add test for handleDuplicateRoutes

* style(v2): add else statement

* docs(v2): modify documentation for duplicate routes

* docs(v2): move doc into guides folder

* fix(v2): fix broken links

* docs(v2): move docs for docusaurus config into api folder

* style(v2): add comments

* refactor(v2): extract getFinalRoutes

* refactor(v2): scope getFinalRoutes to docusaurus package

* test(v2): remove obsolete snapshots

* docs(v2): remove some docs

* fix(v2): rerun github actions

* docs(v2): change slug of docs in api folder

* refactor(v2): extract out a reportMessage method

* refactor(v2): extract getAllFinalRoutes

* test(v2): replace snapshots with actual value

* style(v2): remove unnecessary comment and change type

* chore(v2): remove unused dependency

* style(v2): remove unused code

* Update packages/docusaurus/src/server/utils.ts

* Update website/docs/guides/creating-pages.md

Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2020-07-31 21:14:49 +02:00
Sébastien Lorber
1083454dbd
chore(v2): prepare v2.0.0.alpha-60 release (#3154)
* alpha 60

* v2.0.0-alpha.60

* update publish guide
2020-07-29 17:45:54 +02:00
Sébastien Lorber
d25d4b08f6
fix(v2): remove buggy routesLoaded + deprecate routesLoaded lifecycle (#3141)
* remove bad deletion of docs / if conflicting with a page

* deprecate routesLoaded
2020-07-28 14:28:14 +02:00
Sébastien Lorber
0eb9c207cf
chore(v2): v2.0.0.alpha-59 release (#3114)
* alpha 59 release preparation

* v2.0.0-alpha.59
2020-07-24 16:22:51 +02:00
Sébastien Lorber
8ff28e3fe4
feat(v2): broken links detection (#3059)
* add broken links checker

* polish

* finalize broken links detection feature

* note broken links is only for prod build

* fix broken link on template

* fix test snapshot

* fix bad merge
2020-07-21 19:13:34 +02:00
Sébastien Lorber
15e73daae7
feat(v2): global data + useGlobalData + docs versions dropdown (#2971)
* doc components initial simplification

* doc components initial simplification

* add docContext test

* Add poc of global data system + use it in the theme

* Revert "doc components initial simplification"

This reverts commit f657b4c4

* revert useless changes

* avoid loosing context on docs switch

* fix docs tests

* fix @generated/globalData ts declaration / es import

* typo

* revert bad commit

* refactor navbar in multiple parts + add navbar item types validation + try to fix remaining merge bugs

* add missing watch mode for plugin debug

* fix docs global data integration, move related hooks to docs plugin + convert to TS

* change versions link label

* fix activeClassName react warning

* improve docs global data system + contextual navbar dropdown

* fix bug preventing the deployment

* refactor the global data system to namespace automatically by plugin name + plugin id

* proper NavbarItem comp

* fix tests

* fix snapshot

* extract theme config schema in separate file + rename navbar links to navbar items

* minor typos

* polish docs components/api

* polish useDocs api surface

* fix the docs version suggestions comp + data

* refactors + add docsClientUtils unit tests

* Add documentation

* typo

* Add check for duplicate plugin ids detection

* multi-instance: createData plugin data should be namespaced by plugin instance id

* remove attempt for multi-instance support
2020-07-21 11:16:08 +02:00
Sébastien Lorber
1272ab83fb
feat(v2): useDocusaurusContext().siteMetadata (#3058) 2020-07-16 12:46:21 +02:00
Sébastien Lorber
8aa6ef47e4
feat(v2): configureWebpack merge strategy + use file-loader for common asset types (#2994)
* Add some default asset loaders
Add webpack merge strategy feature to enable plugins to prepend some webpack configuration (like the ideal image plugin that should override the default image loader)

* Add documentation for using assets from markdown

* add path prefix for webpack file loader

* renaming

* document Merge strategies

* rename mergeStrategies -> mergeStrategy
2020-07-01 19:06:02 +02:00
Teik Jun
0f59cd1599
feat(v2): add option validation for remaining official plugins (#2970)
* feat(v2): add option validation lifecycle method

* chore(v2): add dependencies

* chore(v2): add yup dependency

* feat(v2): add option validation for plugin-content-docs

* chore(v2): add facebook copyright

* refactor(v2): remove unused variable

* chore(v2): add dependencies

* chore(v2): add copyright

* fix(v2): use strict for option validation

* feat(v2): add option validation for plugin-content-pages

* feat(v2): add schema for plugin-google-analytics and plugin-google-gtag

* feat(v2): add option validation for plugin-sitemap

* chore(v2): add dependency for yup

* fix(v2): remove strict to allow normalization

* refactor(v2): refactor validate method

* feat(v2): modify existing tests

* feat(v2): add tests for plugin normalization

* style(v2): use a more descriptive filename for schema

* feat(v2): add normalization tests

* feat(v2): add more tests for option validation

* refactor(v2): remove unused code

* refactor(v2): remove unused code

* refactor(v2): refactor methods and types

* feat(v2): replace Yup with Joi

* fix(v2): fix plugin-content-docs schema

* feat(v2): modify tests for plugin-content-docs

* fix(v2): fix a typo

* refactor(v2): improve tests and refactor code

* feat(v2): support both commonjs and ES modules

* refactor(v2): refactor validateOption method

* style(v2): fix eslint errors and typo in types

* chore(v2): remove unused yup dependency

* style(v2): standardize naming across official plugins

* chore(v2): update test snapshots

* chore(v2): remove obsolete snapshots

* chore(v2): fix a typo and check test

* feat(v2): add validation for new field

* feat(v2): add test for new field
2020-06-26 15:14:59 +02:00
Sam Zhou
5ccd24cc1f
feat(v2): Support swizzling TypeScript components (#2671)
* feat(v2): Support swizzling TypeScript components

* Add tsc --noEmit to tsc script in theme-classic

Now everything can pass the type checker! (although still a lot of any)

* Add tsconfig and types.d.ts to website

Improve developer experience.

As an example, I converted NotFound to tsx

* Apply type annotation suggestions

* Do not fallback to `getThemePath` if getTypeScriptThemePath is undefined

* Fix tsc

* Add module declaration for @theme-original/*

* Move babel cli to root package.json
2020-06-25 16:07:30 +02:00
Anshul Goyal
81d855355e
feat(v2): option and config validation life cycle method for official plugins (#2943)
* add validation for blog plugin

* fix wrong default component

* fix test and add yup to package.json

* remove console.log

* add validation for classic theme and code block theme

* add yup to packages

* remove console.log

* fix build

* fix logo required

* replaced yup with joi

* fix test

* remove hapi from docusuars core

* replace joi with @hapi/joi

* fix eslint

* fix remark plugin type

* change remark plugin validation to match documentation

* move schema to it's own file

* allow unknown only on outer theme object

* fix type for schema type

* fix yarn.lock

* support both commonjs and ES modules

* add docs for new lifecycle method
2020-06-24 20:08:16 +02:00