Commit graph

381 commits

Author SHA1 Message Date
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
Sébastien Lorber
e949f4c52a
chore(v2): remove useless stylelint-copyright peerDependency (#3800) 2020-11-23 16:10:07 +03:00
Bartosz Kaszubowski
d9ed20ebcf
chore: match fs-events version across the workspace (#3795) 2020-11-21 18:49:48 +03:00
Alexey Pyltsyn
643a1ffd7e
chore(v2): upgrade ESLint deps (#3767)
* chore(v2): upgrade ESLint deps

* Fix for no-redeclare rule
2020-11-18 17:52:50 +01:00
Alexey Pyltsyn
d5c8a0ca79
chore(v2): fix several npm warnings (#3766) 2020-11-17 11:22:51 +01:00
Sébastien Lorber
f26d478f2d
fix(v2): codesandbox generated examples should use published init package (#3760)
* Fix codesandbox generated examples to use published init script instead of local one

* Fix codesandbox generated examples to use published init script instead of local one
2020-11-16 17:09:44 +01:00
sammychinedu2ky
bb33f54ba8
feat(v2): official CodeSandbox support (#3717)
* feat:added support for codesandbox

* added sandbox config file

* feat:added script to generate template for codesandbox

* added examples:generate script to package.json file

* added failing path to eslintignore

* added script to eslintignore

* added cleaning feature to script

* deleted sandbox script in root

* changed comment in codesandboxscript file

* update codesandboxscript.js + revert bad package.json changes

* eslint should check codesandboxscript

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-11-16 16:20:16 +01:00
Bartosz Kaszubowski
73f151d04c
chore(internal): add yarn deduplicate script, cleanup lock (#3738)
* chore(internal): add yarn deduplicate script, cleanup lock

* add lock cleanup to postinstall, install run and optimize lock again
2020-11-13 14:21:04 +01:00
Bartosz Kaszubowski
5d9b090b9a
fix(internal): fix clear script from the main package.json (#3732) 2020-11-12 19:37:22 +01:00
Alexey Pyltsyn
049634a927
chore(v2): upgrade dependencies (#3727)
* chore(v2): upgrade dependencies

* Update loader-utils

* Update MDX packages

* Update Babel packages

* Various updates
2020-11-12 12:30:14 +01: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
b27d3529dd
chore(v2): fix/upgrade react types (#3586) 2020-10-14 16:25:38 +02: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
Sébastien Lorber
e6704733e4
fix(v1): v1 deploy preview should be available (#3517)
* v1 deploy preview

* Add /v1-migrated deployment
2020-10-02 14:58:06 +02:00
Henry Vélez
cc31567459
feat(v2): new docusaurus clear command (#3446)
* feat: new docusaurus clear command

* Update packages/docusaurus/bin/docusaurus.js

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

* docs: new docusaurus clear command

* fix doc

* update monorepo clear cmd

* make clear async function wait for deletes to complete + factorize a bit

* prettier fix

* better clear docs

Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
Co-authored-by: slorber <lorber.sebastien@gmail.com>
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
2020-09-28 16:33:35 +02:00
Sébastien Lorber
5359d61d9e
fix(v2): allow using classic theme/preset without the docs plugin (#3382)
* deprecated nextVersionLabel option

* useActivePlugin failfast option

* remove deprecated option nextVersionLabel

* routeBasePath: '' should be forbidden

* routeBasePath: '' should be forbidden

* Docs: do not show version badge if there is only 1 version: https://github.com/facebook/docusaurus/issues/3362

* allow sidebars file to not exist: fallback to empty sidebars
https://githu.com/facebook/docusaurus/issues/3366

* Ability to use classic theme/preset while not using docs/pages without trouble.
https://github.com/facebook/docusaurus/issues/3360

* fix netlify redirects

* do not throw if useDocs do not load?

* netlify deploy typo

* try to fix useDocs

* docs(v2): update Deploy to Vercel guide (#3344)

* filter annoying useDocs conditional require warning

* netlify deploy preview homepage

* typo

* try to trigger again CLA bot

Co-authored-by: Sam Ko <sam@vercel.com>
2020-09-01 19:38:11 +02:00
Fanny
8c05aa8e94
feat(v2): bootstrap theme, preset, template, CI previews (#2981)
* fix(v2): doc sidebar

* chore(v2): prettier

* fix(v2): docs navbar path

* fix(v2): fix error about activepath

* chore(v2): prettier

* feat(v2): change active color

* feat(v2): Add bootstrap doc

* docs(v2): Update preset

* doc(v2): finish bootstrap documentation

* chore(v2): run lint

* doc(v2): update hook

* fix theme bootstrap layout (far from perfect)

* Try to fix bootstrap theme and deploy it!

* fix netlify error

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2020-08-17 20:18:37 +02:00
Sébastien Lorber
cf53584abd
chore(v2): fix slow commits due to lint-staged (#3259)
* test

* test

* test

* test
2020-08-11 16:51:32 +02:00
Sébastien Lorber
3b16fb15e9
docs(v2): publish changes after release (#3116) 2020-07-27 12:17:59 +02:00
Sébastien Lorber
a0ef8939a1
chore(v2): ability to test the migration cli easily (#3113)
* ability to test the migration cli easily

* add node scripts to help test migration cli (locally + CI)

* add test for frontmatter quotify

* more tests for shouldQuotifyFrontMatter

* typo

* updated yarn lock
2020-07-24 15:07:24 +02:00
Sébastien Lorber
336c3e54da
fix(v2): netlify.toml shouldn't affect v1 site deployment config (#3099)
* netlify.toml shouldn't affect v1 site deployment config

* try to fix netlify setup

* try to fix netlify setup

* try to fix netlify setup
2020-07-23 11:51:28 +02:00
Sébastien Lorber
811c7ae4e9
fix(v2): fix recent baseurl issues (#3093)
* try to fix the baseUrl related issues

* fix some newly detected broken links

* fix baseurl and broken link issues

* try to configure netlify to use baseUrl deployment

* add proper netlify settings?

* add proper netlify settings?

* add proper netlify settings?

* test commit

* try to fix the redirects

* cleanup working conf

* minor redirect fix
2020-07-22 19:55:40 +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
Jeremy Asuncion
9b3da59886
feat(v2): Plugin for Offline/PWA support (#2205)
* implement PWA plugin

* added pwa support for docusaurus website

* moved sw registration to client module

* moved compile function to webpack util

* build sw using webpack and render pwa popup

* implement @theme/PwaReloadPopup

* update website sw to use modules

* updated pwa readme

* fix header lint errors

* apply code formatting

* cache files only for mobile, saveData, or installed pwa

* added comments about clearing registrations

* fixed prettier error

* updated pwa README

* fix README JS

* move /blog => /blog/index.html logic to else branch

* add `alwaysPrecache` option

* updated docusaurus-plugin-pwa version

* added pwa to using-plugins.md

* review fixes

* re-disable restricted-globals to use self in service worker

* useless doc

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

Co-authored-by: Reece Dunham <me@rdil.rocks>

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

* update a bit pwa doc + minor refactors

* minor refactors + add workbox debug mode

* env PWA_ prefix

* typo

* minor refactor

* fix file output

* add serve:v2:ssl yarn command

* minor pwa fixes

* typo

* add dynamic import comment in SW

* comment

* let the PWA plugin implement its reload popup on his own

* pwa: add Joi options validation

* pwa plugin should have its own webpack/babel custom setup

* PWA:
- debug logs
- better SW params system
- offline mode activation strategies
- docs

* add pwa install gif

* pwa: popup -> reloadPopup + minor refactors

* fix process.env reading + better debug log

* minor fixes

* minor changes

* minor changes

Co-authored-by: slorber <lorber.sebastien@gmail.com>
Co-authored-by: Sébastien Lorber <slorber@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
2020-07-08 12:32:41 +02:00
Sébastien Lorber
9265de982b
chore(v2): refactor scripts + add theme-classic watchmode (#2998) 2020-07-01 18:30:44 +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
Sam Zhou
6e43c9bd34
chore(v2): Fix more eslint errors (#2976) 2020-06-21 15:09:00 +08:00
Sébastien Lorber
72884a0c1a
chore(v2): fix eslint TS setup (#2949)
* update eslint parser

* fix yarn lint script

* lint-staged, lint ts files

* fix TS eslint configuration + fix some lint errors (https://github.com/facebook/docusaurus/pull/2949)

* eslint root + separate linting in 2 scripts

* test commit

* test commit

* test commit

* fix /// TS directive
2020-06-18 17:37:48 +08:00
Sébastien Lorber
b5d7c3a111
misc(v2): better dx: yarn clear, yarn watch, yarn serve (#2922)
* add clear + serve scripts

* add ability to launch all TS projects in --watch mode

* attempt to create a watch plugin

* use rimraf for clear script

* update watch plugin poc

* add start:v2:watch

* remove the watch plugin
2020-06-16 20:40:46 +08:00
Sam Zhou
33b60c6ba4
fix(v2): Consistently use 10.15.1 as the minimum required node version (#2819) 2020-05-27 23:18:48 +08:00
Bartosz Kaszubowski
980f1041dc
refactor(v2): import lqip-loader, fix build on Node 13 (#2544) 2020-04-06 02:55:36 +08:00
Yangshun Tay
b07507c9cc
chore(v2): upgrade devDependencies (#2538)
* chore(v2): upgrade devDependencies

* chore(v2): upgrade devDependencies

* chore: prettier
2020-04-05 19:07:44 +08:00
Bartosz Kaszubowski
5d65facc81
refactor(v2): replace Lodash with single methods packages in utils (#2536) 2020-04-05 18:32:28 +08:00
Yangshun Tay
ff5029893e misc(v2): add Lodash TypeScript typedefs 2020-04-05 18:17:06 +08:00
Bartosz Kaszubowski
b4acb89888
chore(v2): use single method Lodash packages in docs plugin (#2519)
* chore(v2): use single method Lodash packages in docs plugin

* reorder packages

* TS types nightmare
2020-04-04 01:24:30 +08:00
Alexey Pyltsyn
9cff1bb9e4
chore(v2): upgrade deps (#2508) 2020-04-02 19:05:03 +08:00
Alexey Pyltsyn
18d31b5f5f
misc: add instructions about test release (#2486)
* misc: add instructions about test release

* Fix tests

* Rebuild yarn.lock

* Fixes

* Fixes

* Upd
2020-04-02 15:11:19 +08:00
Alexey Pyltsyn
37288a5995
fix(v2): specify proper version for stylelint-copyright (#2383)
* fix(v2): specify proper version for stylelint-copyright

* Update package.json

* Update package.json
2020-03-09 03:57:02 +08:00
Yangshun Tay
6cc0aa2e75
fix(v2): improve stylelint copyright header rule (#2363)
* fix(v2): improve stylelint copyright header rule

* Whitelist stylelint-copyright from Jest
2020-03-07 11:49:52 +08:00
Scott Lee
ae78c1e6dd
chore(v2): add stylelint (#2361)
* Add stylelint

* Add custom stylelint plugin for copyright

* Add stylelint to FB template
2020-03-06 20:10:26 +08:00
Yangshun Tay
a38125a718
chore: drop support for node <10.9 (#2207)
* drop node <10.9 on 2020

* misc: add nvmrc

Co-authored-by: Endi <endiliey@gmail.com>
2020-01-12 13:24:11 +08:00
Endi
9b5266aa7e docs(v2): fix pages routing inaccurate info (#2110)
* docs(v2): fix pages routing inaccurate info

* fix CI
2019-12-10 12:47:13 -08:00
Yangshun Tay
55e676cb25
misc: add command to run prettier on docs (#2102)
* misc: add command to run prettier on docs

* Fix GH issue template

* Fix tests

* Add prettier-docs command to precommit
2019-12-07 21:56:30 -08:00
Endi
97491c5cfb
feat(v2): injectHtmlTags API to inject head and/or body html tags (#2057)
* wip: define html tag definition

* feat(v2): implement injectHtmlTags api

* remove useless file

* nits

* documentation

* allow string, use prebodyTags and postBodyTags

* typo

* refactor typing

* chore(v2): bump deps
2019-11-30 11:52:26 +07:00
Endi
05a2f46a9b
chore(v2): bump deps and run yarn upgrade (#2044) 2019-11-24 23:06:25 +07:00
Endi
9862a6821a feat(v2): allow non sidebar category to be first item of sidebar (#2032)
* feat(v2): allow non sidebar category to be first item of sidebar

* better error messages

* edit the react component

* Update website/docs/sidebar.md

* nits

* add @babel/plugin-transform-runtime
2019-11-23 20:08:19 -08:00
Endi
2d15fadf16
chore(v2): bump deps and remove unused deps (#2029)
* chore(v2): deps bump

* remove unused deps
2019-11-22 17:55:22 +07:00
Endi
088606653d
chore: bump & remove unused deps (#2015) 2019-11-19 16:04:23 +07:00
Endi
cf4037ef91
chore(v2): update dependencies (#1985)
* chore(v2): update dependencies

* use forked ideal image deps. omgg
2019-11-13 23:04:13 +07:00
Endi
3be2e86546
chore: bump dev dependencies (#1955)
* chore: bump devdeps

* upd infima url
2019-11-11 17:44:26 +07:00