Commit graph

20 commits

Author SHA1 Message Date
Joshua Chen
b4d93b9bd0
chore: upgrade to TS 4.7, compile with NodeNext (#7586)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
2022-06-15 19:15:11 +02:00
Joshua Chen
624735bd92
refactor: fix more type-aware linting errors (#7479) 2022-05-24 19:19:24 +08:00
Joshua Chen
3666a2ede5
refactor: remove a lot of implicit anys (#7468) 2022-05-23 15:40:53 +08:00
Joshua Chen
2d94d575a1
refactor: make entire project typecheck with root tsconfig (#7466) 2022-05-23 12:54:25 +08:00
Joshua Chen
a555fd1dcb
refactor: make each tsconfig explicitly declare module and include/exclude (#7443) 2022-05-18 12:48:28 +08:00
Joshua Chen
7613ecb9ea
refactor: use TS project references instead of running tsc multiple times (#7437)
* refactor: use TS project references instead of running tsc multiple times

* deduplicate

* dedup

* eliminate --project

* add swc config

* add target
2022-05-17 15:21:44 +08:00
Joshua Chen
4db0c620de
refactor: enable a few TS flags (#6852)
* refactor: enable a few TS flags

* refactor

* revert to working version

* fix

* better

* change
2022-03-06 13:09:10 +08:00
Joshua Chen
a4dc03edee
chore: upgrade dependencies (#6789)
* chore: upgrade dependencies

* upgrade setup-node
2022-03-01 10:40:34 +08:00
Sébastien Lorber
01adf25b0f
chore(v2): TypeScript, use isolatedModules (#4790)
* Use isolatedModules

* better solution for useDocs?

* fix blog-only mode

* fix bad useDocs import
2021-05-14 15:36:55 +02:00
Reece Dunham
05e7250c08
feat(v2): Webpack 5, PostCSS 8 (#4089)
* Initial webpack 5 work

* It works on my machine (lol)

* Committing a bit more work

* It works - sorta

* Update packages/docusaurus/package.json

* at least fix prettier /shrug

* making more progress. build should work now, css stuff is still a bit broken

* Terser things

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

* Working on things

* Vendor webpack

* Repair chunks, and tests

* Rerun prettier

* Re-add client prefetching

* Update snapshots

* Update snapshots

* I hope this works

* Remove redundant dev server code

* relock

* Trying to reduce memory usage and fix things

* Dead code elim

* Search bar works!!!

* Prefetching should work again

* lock

* ts issue

* Repair snapshot

* Run prettier

* Fix the CI for now

* fix lint-prettier

* clean-css works, now for the other one

* Fix lockfile

* Fixes prettier

* Other css minification works!!!

* Add clean-css options, fix webpack versions

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

* Fix tests and several of the webpack loaders

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

* Re-add support for simple css minifier

* Update other related dependencies

* Fix lockfile

* Dev server fixups

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

* Simplify css things

* Update webpack, try with postcss 7

* Other cssnano repairs

* fix lockfile

* Clean up the babel preset

* Fix lockfile

* Bump RL SSR version

* Fix the build errors

* Lockfile fix

* It works again

* webpack 5 should close compiler after run

* add proper webpack5 persistent caching config

* upgrade webpack deps again

* reduce build perf timeouts to avoid build time regressions

* test if incremental build can run on netlify

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* test

* test

* test

* test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* fix existsSync() calls

* replace @ts-nocheck by a temporary Webpack type

* replace @ts-nocheck by a temporary Webpack type

* replace @ts-nocheck by a temporary Webpack type

* migrate existing stats.warningsFilter to config.ignoreWarnings

* remove stats from postBuild lifecycle data doc, as it is likely unused (we'll add it back if someone ask for it)

* improve build.ts TS issues + move some sync code to async

* cleanup TS of start.ts

* fix TS error

* fix TS issues

* fix TS issues

* fix ts error

* netlify test

* netlify test

* netlify test

* netlify test

* netlify test

* script cleanup

* script cleanup

* re-enable @typescript-eslint/ban-ts-comment

* Deprecate getCacheLoader / getBabelLoader but keep retrocompatibility

* useless TS

* fix and comment gca(chunkName) prefetching function

* remove deprecated mainTemplate.requireFn

* temporarily use react-loadable-ssr-addon-v5-slorber until PR merged: https://github.com/facebook/docusaurus/pull/4089

* comment unsafeCache option

* add explicit and more precise webpack targets

* splitChunks, use new type: "css/mini-extract" as it seems recommended for webpack 5

* webpack error handling:
- log error.details as documented
- keep using react-dev-utils/formatWebpackMessages for now

* fix webpack5 warnings for evalSourceMapMiddleware.js

* typo

* rename webpackHotDevClient

* make all modifications of react-dev-utils explicit with a comment

* revert LogPlugin adapter

* loader-utils update

* add useful share cache comment

* add useful comments regarding the null-loader used in SSR for css files

* upgrade webpack-merge in a retrocompatible way

* use MiniCssExtractPlugin.emit false as recommended

* use @docusaurus/responsive-loader

* revert MiniCssExtractPlugin esModule: false change

* add link to PR for custom CleanWebpackPlugin

* pwa: add fallback to env variable or webpack 5 fails to build

* upgrade to CssMinimizerPlugin 2.0

* only build en locale for windows tests

* line breaks between errors

* add useful comment

* Fix e2e tests with Yarn2 not finding new init template dependencies

* fix bad import

* disable browserslist target as webpack already tries to use browserlists if a config is found, and it is a problem for existing sites

* webpack5 TS fixes

* fix getMinimizer order (even if it does not work yet)

* update postcss to v8, fix cssnano minimizer errors

* add NavbarItem position to types (useful for QuestDB site upgrade to Webpack5)

* add webpack cache env variable to reduce risk of webpack 5 adoption

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-04-30 18:06:53 +02:00
Sébastien Lorber
5543f09ed1
chore: json files should be linted (#4462) 2021-03-18 19:39:50 +01:00
Reece Dunham
76c0b11632
refactor(v2): TS config update: reduce the size of npm modules (#4375)
* feat(v2): Reduce the size of the npm modules

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

* Fix conflicts

* Update search.js

Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-03-17 16:25:42 +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
Orta Therox
33ecc4bb17
chore(v2): tighten up the TypeScript onboarding (#3244)
* Tighten up the TypeScript onboarding

* Extend the API to cover everything used in the classic theme

* Wrap up internal TS support
2020-08-17 18:03:21 +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
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
Sébastien Lorber
201c663318
feat(v2): allow nested sidebar category shorthand syntax (#2444)
* feat(v2): allow sidebar category shorthand syntax also for nested elements

* Update sidebars-category-shorthand.js

* Update sidebars-category-shorthand.js

Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
2020-03-26 00:59:51 +08:00
Endi
421f862701 breaking(v2): required nodejs version >=8.9 -> >=8.10 so we can use es2017 (#2045) 2019-11-24 21:40:57 -08:00
Endi
305e698e6e refactor(v2): migrate core to Typescript ❄️🌀🐋 (#1494)
* refactor(v2): add typing for docusaurus/core

* wip: last working

* refactor(v2): add typing for @docusaurus/core

* prettier

* dont run in parallel otherwise some are uncompiled

* nits

* more typing

* more typing

* nits

* type commands

* nits
2019-05-20 09:59:04 -07:00
Endi
cbd2a589e3 refactor(v2): migrate to Typescript ❄️🌀🐋 (#1490)
* refactor(v2): migrate to typescript

* scripts nits

* fix test

* nits

* nits

* tsconfig tweak
2019-05-18 11:37:35 -07:00