chore: upgrade docsearch-react to v3 stable, bump dependencies (#6752)

* chore: upgrade dependencies

* revert

* validation

* fix blog

* reformat
This commit is contained in:
Joshua Chen 2022-02-24 19:39:32 +08:00 committed by GitHub
parent a70514205d
commit dcbf9f644e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 687 additions and 496 deletions

View file

@ -83,10 +83,6 @@ jobs:
# https://yarnpkg.com/features/pnp#fallback-mode
yarn config set pnpFallbackMode none
# Patch package so that peer deps are provided. This has been fixed in terser by making acorn a direct dependency
# TODO watch out for the next terser release. Commit: https://github.com/terser/terser/commit/05b23eeb682d732484ad51b19bf528258fd5dc2a
yarn config set packageExtensions --json '{"terser-webpack-plugin@*": {"dependencies": {"acorn": "^8.6.0"}}, "html-minifier-terser@*": {"dependencies": {"acorn": "^8.6.0"}}}'
yarn install
working-directory: ../test-website
env:

View file

@ -9,6 +9,6 @@
"@netlify/functions": "^1.0.0"
},
"devDependencies": {
"netlify-cli": "^9.4.0"
"netlify-cli": "^9.8.0"
}
}

View file

@ -58,28 +58,28 @@
"lock:update": "npx yarn-deduplicate"
},
"devDependencies": {
"@babel/cli": "^7.17.3",
"@babel/cli": "^7.17.6",
"@babel/core": "^7.17.5",
"@babel/preset-typescript": "^7.16.7",
"@crowdin/cli": "^3.7.8",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.178",
"@types/node": "^17.0.18",
"@types/node": "^17.0.21",
"@types/prompts": "^2.0.14",
"@types/react": "^17.0.39",
"@types/react-dev-utils": "^9.0.10",
"@types/react-test-renderer": "^17.0.1",
"@types/semver": "^7.3.9",
"@types/shelljs": "^0.8.11",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"@typescript-eslint/eslint-plugin": "^5.12.1",
"@typescript-eslint/parser": "^5.12.1",
"concurrently": "^7.0.0",
"cross-env": "^7.0.3",
"cspell": "^5.18.5",
"eslint": "^8.9.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.3.0",
"eslint-config-prettier": "^8.4.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.1",
@ -92,7 +92,7 @@
"lerna": "^4.0.0",
"lerna-changelog": "^2.2.0",
"lint-staged": "^12.3.4",
"netlify-cli": "^9.6.5",
"netlify-cli": "^9.8.0",
"nodemon": "^2.0.15",
"prettier": "^2.5.1",
"react": "^17.0.2",
@ -101,7 +101,7 @@
"remark-parse": "^8.0.2",
"rimraf": "^3.0.2",
"sharp": "^0.30.1",
"stylelint": "^14.5.1",
"stylelint": "^14.5.3",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^25.0.0",
"typescript": "^4.5.5",

View file

@ -24,7 +24,7 @@
"dependencies": {
"@docusaurus/logger": "2.0.0-beta.15",
"commander": "^5.1.0",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"lodash": "^4.17.21",
"prompts": "^2.4.2",
"semver": "^7.3.5",

View file

@ -29,14 +29,14 @@
"@babel/eslint-parser": "^7.16.3",
"eslint": "^8.8.0",
"eslint-config-airbnb": "^19.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-prettier": "^8.4.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.27.0",
"eslint-plugin-react-hooks": "^4.3.0",
"prettier": "^2.5.1",
"stylelint": "^14.3.0"
"stylelint": "^14.5.3"
},
"browserslist": {
"production": [

View file

@ -25,7 +25,7 @@
"@mdx-js/mdx": "^1.6.22",
"escape-html": "^1.0.3",
"file-loader": "^6.2.0",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"image-size": "^1.0.1",
"mdast-util-to-string": "^2.0.0",
"remark-emoji": "^2.1.0",

View file

@ -29,7 +29,7 @@
"@mapbox/hast-util-to-jsx": "^2.0.0",
"color": "^4.0.1",
"commander": "^5.1.0",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"hast-util-to-string": "^1.0.4",
"html-tags": "^3.1.0",
"import-fresh": "^3.3.0",

View file

@ -24,7 +24,7 @@
"@docusaurus/utils-common": "2.0.0-beta.15",
"@docusaurus/utils-validation": "2.0.0-beta.15",
"eta": "^1.12.3",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"lodash": "^4.17.21",
"tslib": "^2.3.1"
},

View file

@ -26,7 +26,7 @@
"@docusaurus/utils-validation": "2.0.0-beta.15",
"cheerio": "^1.0.0-rc.10",
"feed": "^4.2.2",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"lodash": "^4.17.21",
"reading-time": "^1.5.0",
"remark-admonitions": "^1.2.1",

View file

@ -29,7 +29,7 @@
"@docusaurus/utils": "2.0.0-beta.15",
"@docusaurus/utils-validation": "2.0.0-beta.15",
"combine-promises": "^1.1.0",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"import-fresh": "^3.3.0",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",

View file

@ -22,7 +22,7 @@
"@docusaurus/mdx-loader": "2.0.0-beta.15",
"@docusaurus/utils": "2.0.0-beta.15",
"@docusaurus/utils-validation": "2.0.0-beta.15",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"remark-admonitions": "^1.2.1",
"tslib": "^2.3.1",
"webpack": "^5.69.1"

View file

@ -20,7 +20,7 @@
"dependencies": {
"@docusaurus/core": "2.0.0-beta.15",
"@docusaurus/utils": "2.0.0-beta.15",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"react-json-view": "^1.21.3",
"tslib": "^2.3.1"
},

View file

@ -35,7 +35,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.15",
"@docusaurus/types": "2.0.0-beta.15",
"fs-extra": "^10.0.0"
"fs-extra": "^10.0.1"
},
"peerDependencies": {
"jimp": "*",

View file

@ -34,13 +34,13 @@
"tslib": "^2.3.1",
"webpack": "^5.69.1",
"webpack-merge": "^5.8.0",
"workbox-build": "^6.4.2",
"workbox-precaching": "^6.1.1",
"workbox-window": "^6.4.2"
"workbox-build": "^6.5.0",
"workbox-precaching": "^6.5.0",
"workbox-window": "^6.5.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.15",
"fs-extra": "^10.0.0"
"fs-extra": "^10.0.1"
},
"peerDependencies": {
"react": "^16.8.4 || ^17.0.0",

View file

@ -22,7 +22,7 @@
"@docusaurus/utils": "2.0.0-beta.15",
"@docusaurus/utils-common": "2.0.0-beta.15",
"@docusaurus/utils-validation": "2.0.0-beta.15",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"sitemap": "^7.1.1",
"tslib": "^2.3.1"
},

View file

@ -48,7 +48,7 @@
"@types/prismjs": "^1.26.0",
"@types/rtlcss": "^3.1.2",
"cross-env": "^7.0.3",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"react-test-renderer": "^17.0.2",
"utility-types": "^3.10.0"
},

View file

@ -32,7 +32,7 @@
"@docusaurus/core": "2.0.0-beta.15",
"@docusaurus/types": "2.0.0-beta.15",
"@testing-library/react-hooks": "^7.0.2",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"lodash": "^4.17.21"
},
"peerDependencies": {

View file

@ -27,7 +27,7 @@
"@docusaurus/utils-validation": "2.0.0-beta.15",
"@philpl/buble": "^0.19.7",
"clsx": "^1.1.1",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"react-live": "2.2.3",
"tslib": "^2.3.1"
},

View file

@ -25,7 +25,7 @@
"build:format": "prettier --config ../../.prettierrc --write \"lib/**/*.js\""
},
"dependencies": {
"@docsearch/react": "^3.0.0-alpha.50",
"@docsearch/react": "^3.0.0",
"@docusaurus/core": "2.0.0-beta.15",
"@docusaurus/logger": "2.0.0-beta.15",
"@docusaurus/theme-common": "2.0.0-beta.15",
@ -36,7 +36,7 @@
"algoliasearch-helper": "^3.7.0",
"clsx": "^1.1.1",
"eta": "^1.12.3",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"lodash": "^4.17.21",
"tslib": "^2.3.1",
"utility-types": "^3.10.0"

View file

@ -27,6 +27,7 @@ describe('validateThemeConfig', () => {
const algolia = {
indexName: 'index',
apiKey: 'apiKey',
appId: 'BH4D9OD16A',
};
expect(testValidateThemeConfig({algolia})).toEqual({
algolia: {
@ -41,6 +42,7 @@ describe('validateThemeConfig', () => {
indexName: 'index',
apiKey: 'apiKey',
unknownKey: 'unknownKey',
appId: 'BH4D9OD16A',
};
expect(testValidateThemeConfig({algolia})).toEqual({
algolia: {
@ -67,15 +69,8 @@ describe('validateThemeConfig', () => {
);
});
test('empty config', () => {
const algolia = {};
expect(() =>
testValidateThemeConfig({algolia}),
).toThrowErrorMatchingInlineSnapshot(`"\\"algolia.apiKey\\" is required"`);
});
test('missing indexName config', () => {
const algolia = {apiKey: 'apiKey'};
const algolia = {apiKey: 'apiKey', appId: 'BH4D9OD16A'};
expect(() =>
testValidateThemeConfig({algolia}),
).toThrowErrorMatchingInlineSnapshot(
@ -84,14 +79,24 @@ describe('validateThemeConfig', () => {
});
test('missing apiKey config', () => {
const algolia = {indexName: 'indexName'};
const algolia = {indexName: 'indexName', appId: 'BH4D9OD16A'};
expect(() =>
testValidateThemeConfig({algolia}),
).toThrowErrorMatchingInlineSnapshot(`"\\"algolia.apiKey\\" is required"`);
});
test('missing appId config', () => {
const algolia = {indexName: 'indexName', apiKey: 'apiKey'};
expect(() =>
testValidateThemeConfig({algolia}),
).toThrowErrorMatchingInlineSnapshot(
`"\\"algolia.appId\\" is required. If you haven't migrated to the new DocSearch infra, please refer to the blog post for instructions: https://docusaurus.io/blog/2021/11/21/algolia-docsearch-migration"`,
);
});
test('contextualSearch config', () => {
const algolia = {
appId: 'BH4D9OD16A',
indexName: 'index',
apiKey: 'apiKey',
contextualSearch: true,
@ -106,6 +111,7 @@ describe('validateThemeConfig', () => {
test('externalUrlRegex config', () => {
const algolia = {
appId: 'BH4D9OD16A',
indexName: 'index',
apiKey: 'apiKey',
externalUrlRegex: 'http://external-domain.com',
@ -120,6 +126,7 @@ describe('validateThemeConfig', () => {
test('searchParameters.facetFilters search config', () => {
const algolia = {
appId: 'BH4D9OD16A',
indexName: 'index',
apiKey: 'apiKey',
searchParameters: {

View file

@ -13,10 +13,6 @@ export const DEFAULT_CONFIG = {
// see also https://github.com/facebook/docusaurus/issues/5880
contextualSearch: true,
// By default, all Docusaurus sites are using the same AppId
// This has been designed on purpose with Algolia.
appId: 'BH4D9OD16A',
searchParameters: {},
searchPagePath: 'search',
};
@ -27,7 +23,10 @@ export const Schema = Joi.object({
contextualSearch: Joi.boolean().default(DEFAULT_CONFIG.contextualSearch),
externalUrlRegex: Joi.string().optional(),
// Algolia attributes
appId: Joi.string().default(DEFAULT_CONFIG.appId),
appId: Joi.string().required().messages({
'any.required':
'"algolia.appId" is required. If you haven\'t migrated to the new DocSearch infra, please refer to the blog post for instructions: https://docusaurus.io/blog/2021/11/21/algolia-docsearch-migration',
}),
apiKey: Joi.string().required(),
indexName: Joi.string().required(),
searchParameters: Joi.object()

View file

@ -19,7 +19,7 @@
"update": "node ./update.js"
},
"dependencies": {
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"tslib": "^2.3.1"
},
"devDependencies": {

View file

@ -21,7 +21,7 @@
"@docusaurus/logger": "2.0.0-beta.15",
"@svgr/webpack": "^6.0.0",
"file-loader": "^6.2.0",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"github-slugger": "^1.4.0",
"globby": "^11.0.4",
"gray-matter": "^4.0.3",

View file

@ -53,7 +53,7 @@
"autoprefixer": "^10.4.2",
"babel-loader": "^8.2.3",
"babel-plugin-dynamic-import-node": "2.3.0",
"boxen": "^5.1.2",
"boxen": "^6.2.1",
"chokidar": "^3.5.3",
"clean-css": "^5.2.4",
"combine-promises": "^1.1.0",
@ -68,7 +68,7 @@
"escape-html": "^1.0.3",
"eta": "^1.12.3",
"file-loader": "^6.2.0",
"fs-extra": "^10.0.0",
"fs-extra": "^10.0.1",
"html-minifier-terser": "^6.1.0",
"html-tags": "^3.1.0",
"html-webpack-plugin": "^5.5.0",

View file

@ -11,6 +11,6 @@
"directory": "packages/stylelint-copyright"
},
"dependencies": {
"stylelint": "^14.5.0"
"stylelint": "^14.5.3"
}
}

View file

@ -43,7 +43,8 @@ module.exports = {
themeConfig: {
image: 'img/docusaurus-soc.png',
algolia: {
apiKey: '47ecd3b21be71c5822571b9f59e52544',
appId: 'X1Z85QJPUV',
apiKey: 'bf7211c161e8205da2f933a02534105a',
indexName: 'docusaurus-2',
contextualSearch: true,
},

View file

@ -94,7 +94,6 @@ const config = {
loader: require.resolve('esbuild-loader'),
options: {
loader: 'tsx',
format: isServer ? 'cjs' : undefined,
target: isServer ? 'node12' : 'es2017',
},
}),

View file

@ -46,7 +46,7 @@
"axios": "^0.26.0",
"clsx": "^1.1.1",
"color": "^4.2.1",
"esbuild-loader": "2.16.0",
"esbuild-loader": "2.18.0",
"netlify-plugin-cache": "^1.0.3",
"raw-loader": "^4.0.2",
"react": "^17.0.2",
@ -56,8 +56,8 @@
"rehype-katex": "^6.0.2",
"remark-math": "^3.0.1",
"unist-util-visit": "^2.0.2",
"workbox-routing": "^6.4.2",
"workbox-strategies": "^6.4.2"
"workbox-routing": "^6.5.0",
"workbox-strategies": "^6.5.0"
},
"browserslist": {
"production": [
@ -73,8 +73,8 @@
},
"devDependencies": {
"@tsconfig/docusaurus": "^1.0.4",
"@types/jest": "^27.4.0",
"@types/jest": "^27.4.1",
"cross-env": "^7.0.3",
"fs-extra": "^10.0.0"
"fs-extra": "^10.0.1"
}
}

1061
yarn.lock

File diff suppressed because it is too large Load diff