Browse Source

add default typesense search bar to docs site

pull/6481/head
starbirdtech383 1 year ago
parent
commit
a8d5e9eb0c
  1. 23
      packages/noco-docs/docusaurus.config.js
  2. 226
      packages/noco-docs/package-lock.json
  3. 1
      packages/noco-docs/package.json
  4. 40
      packages/noco-docs/src/css/custom.scss

23
packages/noco-docs/docusaurus.config.js

@ -61,9 +61,32 @@ const config = {
],
],
themes: ['docusaurus-theme-search-typesense'],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
typesense: {
// Replace this with the name of your index/collection.
// It should match the "index_name" entry in the scraper's "config.json" file.
typesenseCollectionName: 'nocodb-oss-docs-index',
typesenseServerConfig: {
nodes: [
{
host: 'rqf5uvajyeczwt3xp-1.a1.typesense.net',
port: 443,
protocol: 'https',
}
],
apiKey: 'lNKDTZdJrE76Sg8WEyeN9mXT29l1xq7Q',
},
// Optional: Typesense search parameters: https://typesense.org/docs/0.24.0/api/search.html#search-parameters
typesenseSearchParameters: {},
// Optional
contextualSearch: true,
},
// Replace with your project's social card
image: 'img/docusaurus-social-card.jpg',
navbar: {

226
packages/noco-docs/package-lock.json generated

@ -14,6 +14,7 @@
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"docusaurus-plugin-sass": "^0.2.5",
"docusaurus-theme-search-typesense": "^0.12.0-0",
"nc-analytics": "^0.0.3",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",
@ -5626,6 +5627,36 @@
"sass": "^1.30.0"
}
},
"node_modules/docusaurus-theme-search-typesense": {
"version": "0.12.0-0",
"resolved": "https://registry.npmjs.org/docusaurus-theme-search-typesense/-/docusaurus-theme-search-typesense-0.12.0-0.tgz",
"integrity": "sha512-Vj09X3cSdB/AjKuzYR/sHP6PoIK7yr6Ww+T9EKO+T8etAjDumkQnwEf8qpvrBzqypWoGKs05fdZ8Xr/7WEscUA==",
"dependencies": {
"@docusaurus/logger": "2.4.1",
"@docusaurus/plugin-content-docs": "2.4.1",
"@docusaurus/theme-translations": "2.4.1",
"@docusaurus/utils": "2.4.1",
"@docusaurus/utils-validation": "2.4.1",
"algoliasearch-helper": "^3.10.0",
"clsx": "^1.2.1",
"eta": "^2.0.0",
"fs-extra": "^10.1.0",
"lodash": "^4.17.21",
"tslib": "^2.4.0",
"typesense-docsearch-react": "^3.4.0",
"typesense-instantsearch-adapter": "^2.6.0",
"utility-types": "^3.10.0"
},
"engines": {
"node": ">=16.14"
},
"peerDependencies": {
"@docusaurus/core": "2.4.1",
"@docusaurus/theme-common": "2.4.1",
"react": "^16.8.4 || ^17.0.2",
"react-dom": "^16.8.4 || ^17.0.2"
}
},
"node_modules/dom-converter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",
@ -7868,6 +7899,18 @@
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
"integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ=="
},
"node_modules/loglevel": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==",
"engines": {
"node": ">= 0.6.0"
},
"funding": {
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/loglevel"
}
},
"node_modules/loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -11606,6 +11649,96 @@
"node": ">=4.2.0"
}
},
"node_modules/typesense": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/typesense/-/typesense-1.7.1.tgz",
"integrity": "sha512-RVtwprXDyU8MfAtLZ3PyH9WWRpEFGwij5BTu9I3VBjPIWtIvM/hbi2ogL/UK9dPXFECaxY8HlHrZz9djhJDZtg==",
"dependencies": {
"axios": "^0.26.0",
"loglevel": "^1.8.0"
},
"peerDependencies": {
"@babel/runtime": "^7.17.2"
}
},
"node_modules/typesense-docsearch-css": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/typesense-docsearch-css/-/typesense-docsearch-css-0.4.0.tgz",
"integrity": "sha512-hVTJC1Rg2BnNB4kl2Qi4GcgjFmPZY8YGu0aJ5V6iM6vK62yvtE7jObnAc1maYOp33NWFVLPgl/9PlBfWBlN0Dw=="
},
"node_modules/typesense-docsearch-react": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/typesense-docsearch-react/-/typesense-docsearch-react-3.4.0.tgz",
"integrity": "sha512-87M0ktGiSmJ4m9VpJKC3gD6w31ZhctdB34c6aguLJXsiLDydNF+ipBYuCYE26D47rx/KLk82rsiZwovjaagZnw==",
"dependencies": {
"@algolia/autocomplete-core": "1.8.2",
"@algolia/autocomplete-preset-algolia": "1.8.2",
"typesense": "^1.4.0-3",
"typesense-docsearch-css": "^0.4.0",
"typesense-instantsearch-adapter": "^2.4.2-1"
},
"peerDependencies": {
"@types/react": ">= 16.8.0 < 19.0.0",
"react": ">= 16.8.0 < 19.0.0",
"react-dom": ">= 16.8.0 < 19.0.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
}
},
"node_modules/typesense-docsearch-react/node_modules/@algolia/autocomplete-core": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.8.2.tgz",
"integrity": "sha512-mTeshsyFhAqw/ebqNsQpMtbnjr+qVOSKXArEj4K0d7sqc8It1XD0gkASwecm9mF/jlOQ4Z9RNg1HbdA8JPdRwQ==",
"dependencies": {
"@algolia/autocomplete-shared": "1.8.2"
}
},
"node_modules/typesense-docsearch-react/node_modules/@algolia/autocomplete-preset-algolia": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.8.2.tgz",
"integrity": "sha512-J0oTx4me6ZM9kIKPuL3lyU3aB8DEvpVvR6xWmHVROx5rOYJGQcZsdG4ozxwcOyiiu3qxMkIbzntnV1S1VWD8yA==",
"dependencies": {
"@algolia/autocomplete-shared": "1.8.2"
},
"peerDependencies": {
"@algolia/client-search": ">= 4.9.1 < 6",
"algoliasearch": ">= 4.9.1 < 6"
}
},
"node_modules/typesense-docsearch-react/node_modules/@algolia/autocomplete-shared": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.8.2.tgz",
"integrity": "sha512-b6Z/X4MczChMcfhk6kfRmBzPgjoPzuS9KGR4AFsiLulLNRAAqhP+xZTKtMnZGhLuc61I20d5WqlId02AZvcO6g=="
},
"node_modules/typesense-instantsearch-adapter": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/typesense-instantsearch-adapter/-/typesense-instantsearch-adapter-2.7.1.tgz",
"integrity": "sha512-GSEwkNzXoVcL4iSV/LDiZvjx/knctqfGLLKUNRe5twgzFprnoU07UUh2mQ5Z0/aP1moY/UpBF1bMKhTU6ECoAQ==",
"hasInstallScript": true,
"dependencies": {
"typesense": "^1.7.0"
},
"peerDependencies": {
"@babel/runtime": "^7.17.2"
}
},
"node_modules/typesense/node_modules/axios": {
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
"dependencies": {
"follow-redirects": "^1.14.8"
}
},
"node_modules/ua-parser-js": {
"version": "1.0.35",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.35.tgz",
@ -16855,6 +16988,27 @@
"sass-loader": "^10.1.1"
}
},
"docusaurus-theme-search-typesense": {
"version": "0.12.0-0",
"resolved": "https://registry.npmjs.org/docusaurus-theme-search-typesense/-/docusaurus-theme-search-typesense-0.12.0-0.tgz",
"integrity": "sha512-Vj09X3cSdB/AjKuzYR/sHP6PoIK7yr6Ww+T9EKO+T8etAjDumkQnwEf8qpvrBzqypWoGKs05fdZ8Xr/7WEscUA==",
"requires": {
"@docusaurus/logger": "2.4.1",
"@docusaurus/plugin-content-docs": "2.4.1",
"@docusaurus/theme-translations": "2.4.1",
"@docusaurus/utils": "2.4.1",
"@docusaurus/utils-validation": "2.4.1",
"algoliasearch-helper": "^3.10.0",
"clsx": "^1.2.1",
"eta": "^2.0.0",
"fs-extra": "^10.1.0",
"lodash": "^4.17.21",
"tslib": "^2.4.0",
"typesense-docsearch-react": "^3.4.0",
"typesense-instantsearch-adapter": "^2.6.0",
"utility-types": "^3.10.0"
}
},
"dom-converter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",
@ -18489,6 +18643,11 @@
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
"integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ=="
},
"loglevel": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz",
"integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg=="
},
"loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@ -21131,6 +21290,73 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g=="
},
"typesense": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/typesense/-/typesense-1.7.1.tgz",
"integrity": "sha512-RVtwprXDyU8MfAtLZ3PyH9WWRpEFGwij5BTu9I3VBjPIWtIvM/hbi2ogL/UK9dPXFECaxY8HlHrZz9djhJDZtg==",
"requires": {
"axios": "^0.26.0",
"loglevel": "^1.8.0"
},
"dependencies": {
"axios": {
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
"requires": {
"follow-redirects": "^1.14.8"
}
}
}
},
"typesense-docsearch-css": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/typesense-docsearch-css/-/typesense-docsearch-css-0.4.0.tgz",
"integrity": "sha512-hVTJC1Rg2BnNB4kl2Qi4GcgjFmPZY8YGu0aJ5V6iM6vK62yvtE7jObnAc1maYOp33NWFVLPgl/9PlBfWBlN0Dw=="
},
"typesense-docsearch-react": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/typesense-docsearch-react/-/typesense-docsearch-react-3.4.0.tgz",
"integrity": "sha512-87M0ktGiSmJ4m9VpJKC3gD6w31ZhctdB34c6aguLJXsiLDydNF+ipBYuCYE26D47rx/KLk82rsiZwovjaagZnw==",
"requires": {
"@algolia/autocomplete-core": "1.8.2",
"@algolia/autocomplete-preset-algolia": "1.8.2",
"typesense": "^1.4.0-3",
"typesense-docsearch-css": "^0.4.0",
"typesense-instantsearch-adapter": "^2.4.2-1"
},
"dependencies": {
"@algolia/autocomplete-core": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.8.2.tgz",
"integrity": "sha512-mTeshsyFhAqw/ebqNsQpMtbnjr+qVOSKXArEj4K0d7sqc8It1XD0gkASwecm9mF/jlOQ4Z9RNg1HbdA8JPdRwQ==",
"requires": {
"@algolia/autocomplete-shared": "1.8.2"
}
},
"@algolia/autocomplete-preset-algolia": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.8.2.tgz",
"integrity": "sha512-J0oTx4me6ZM9kIKPuL3lyU3aB8DEvpVvR6xWmHVROx5rOYJGQcZsdG4ozxwcOyiiu3qxMkIbzntnV1S1VWD8yA==",
"requires": {
"@algolia/autocomplete-shared": "1.8.2"
}
},
"@algolia/autocomplete-shared": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.8.2.tgz",
"integrity": "sha512-b6Z/X4MczChMcfhk6kfRmBzPgjoPzuS9KGR4AFsiLulLNRAAqhP+xZTKtMnZGhLuc61I20d5WqlId02AZvcO6g=="
}
}
},
"typesense-instantsearch-adapter": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/typesense-instantsearch-adapter/-/typesense-instantsearch-adapter-2.7.1.tgz",
"integrity": "sha512-GSEwkNzXoVcL4iSV/LDiZvjx/knctqfGLLKUNRe5twgzFprnoU07UUh2mQ5Z0/aP1moY/UpBF1bMKhTU6ECoAQ==",
"requires": {
"typesense": "^1.7.0"
}
},
"ua-parser-js": {
"version": "1.0.35",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.35.tgz",

1
packages/noco-docs/package.json

@ -33,6 +33,7 @@
"@mdx-js/react": "^1.6.22",
"clsx": "^1.2.1",
"docusaurus-plugin-sass": "^0.2.5",
"docusaurus-theme-search-typesense": "^0.12.0-0",
"nc-analytics": "^0.0.3",
"prism-react-renderer": "^1.3.5",
"react": "^17.0.2",

40
packages/noco-docs/src/css/custom.scss

@ -31,3 +31,43 @@
--ifm-color-primary-lightest: #4fcbe9;
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
}
[data-theme='light'] .DocSearch {
/* --docsearch-primary-color: var(--ifm-color-primary); */
/* --docsearch-text-color: var(--ifm-font-color-base); */
--docsearch-muted-color: var(--ifm-color-secondary-darkest);
--docsearch-container-background: rgba(94, 100, 112, 0.7);
/* Modal */
--docsearch-modal-background: var(--ifm-color-secondary-lighter);
/* Search box */
--docsearch-searchbox-background: var(--ifm-color-secondary);
--docsearch-searchbox-focus-background: var(--ifm-color-white);
/* Hit */
--docsearch-hit-color: var(--ifm-font-color-base);
--docsearch-hit-active-color: var(--ifm-color-white);
--docsearch-hit-background: var(--ifm-color-white);
/* Footer */
--docsearch-footer-background: var(--ifm-color-white);
}
[data-theme='dark'] .DocSearch {
--docsearch-text-color: var(--ifm-font-color-base);
--docsearch-muted-color: var(--ifm-color-secondary-darkest);
--docsearch-container-background: rgba(47, 55, 69, 0.7);
/* Modal */
--docsearch-modal-background: var(--ifm-background-color);
/* Search box */
--docsearch-searchbox-background: var(--ifm-background-color);
--docsearch-searchbox-focus-background: var(--ifm-color-black);
/* Hit */
--docsearch-hit-color: var(--ifm-font-color-base);
--docsearch-hit-active-color: var(--ifm-color-white);
--docsearch-hit-background: var(--ifm-color-emphasis-100);
/* Footer */
--docsearch-footer-background: var(--ifm-background-surface-color);
--docsearch-key-gradient: linear-gradient(
-26.5deg,
var(--ifm-color-emphasis-200) 0%,
var(--ifm-color-emphasis-100) 100%
);
}
Loading…
Cancel
Save