-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(theme-search-algolia): migrate package to TS (#5935)
- Loading branch information
Showing
20 changed files
with
301 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/docusaurus-theme-search-algolia/copyUntypedFiles.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
|
||
/** | ||
* Copy all untyped and static assets files to lib. | ||
*/ | ||
const srcDir = path.resolve(__dirname, 'src'); | ||
const libDir = path.resolve(__dirname, 'lib'); | ||
fs.copySync(srcDir, libDir, { | ||
filter(filepath) { | ||
return !/__tests__/.test(filepath) && !/\.tsx?$/.test(filepath); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/docusaurus-theme-search-algolia/src/theme-search-algolia.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
declare module '@docusaurus/theme-search-algolia' { | ||
export type Options = never; | ||
} | ||
|
||
declare module '@theme/hooks/useSearchQuery' { | ||
export interface SearchQuery { | ||
searchQuery: string; | ||
|
||
setSearchQuery(newSearchQuery: string): void; | ||
|
||
generateSearchPageLink(targetSearchQuery: string): string; | ||
} | ||
|
||
export default function useSearchQuery(): SearchQuery; | ||
} | ||
|
||
declare module '@theme/hooks/useAlgoliaContextualFacetFilters' { | ||
export type useAlgoliaContextualFacetFiltersReturns = [string, string[]]; | ||
|
||
export default function useAlgoliaContextualFacetFilters(): useAlgoliaContextualFacetFiltersReturns; | ||
} | ||
|
||
declare module '@theme/SearchPage' { | ||
const SearchPage: () => JSX.Element; | ||
export default SearchPage; | ||
} | ||
|
||
declare module '@theme/SearchMetadata' { | ||
export type SearchMetadataProps = { | ||
readonly locale?: string; | ||
readonly version?: string; | ||
readonly tag?: string; | ||
}; | ||
|
||
const SearchMetadata: (props: SearchMetadataProps) => JSX.Element; | ||
export default SearchMetadata; | ||
} | ||
|
||
declare module '@theme/SearchBar' { | ||
const SearchBar: () => JSX.Element; | ||
export default SearchBar; | ||
} |
Oops, something went wrong.