Skip to content

Commit

Permalink
chore: Update dependencies
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The lowest supported Node.js version is now 18.18.
  • Loading branch information
cmfcmf committed Nov 9, 2024
1 parent 9c4f5f7 commit a9188ca
Show file tree
Hide file tree
Showing 12 changed files with 2,234 additions and 1,250 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [16.x, 18.x, 20.x, 22.x]
node-version: [18.x, 20.x, 22.x]
docusaurus-version:
- "v2.4.3"
- "v2.4.1"
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
11 changes: 5 additions & 6 deletions .syncpackrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versionGroups": [
{
"label": "All dependencies should use the same Node.js types.",
"dependencies": ["@types/node"],
"pinVersion": "^18"
},
{
"label": "Example Docs must always use the local version of the search plugin",
"packages": ["example-docs"],
Expand All @@ -19,12 +24,6 @@
"dependencies": ["@docusaurus/**"],
"dependencyTypes": ["peer"],
"pinVersion": "^2.0.0"
},
{
"label": "All dependencies should follow the versions of the search plugin",
"packages": ["**"],
"dependencies": ["**"],
"snapTo": ["@cmfcmf/docusaurus-search-local"]
}
]
}
3,314 changes: 2,148 additions & 1,166 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"dependencies": {
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@types/node": "^16.18.12",
"commit-and-tag-version": "^11.1.0",
"@types/node": "^18",
"commit-and-tag-version": "^12.5.0",
"git-branch-is": "^4.0.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"prettier": "^2.8.4",
"syncpack": "^9.8.4",
"prettier": "^3.3.3",
"syncpack": "^13.0.0",
"turbo": "^1.8.2"
},
"scripts": {
Expand All @@ -37,8 +37,8 @@
]
},
"engines": {
"node": ">=16.14",
"npm": ">=8"
"node": ">=18.18",
"npm": ">=10"
},
"packageManager": "npm@8.11.0"
"packageManager": "npm@10.9.0"
}
4 changes: 2 additions & 2 deletions packages/docusaurus-search-local/e2e-tests/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ test("basic search works", async ({ page }) => {
async function expectDocVersion(page: Page, version: string) {
await expect(
page.locator(
`.dsla-search-field[data-tags="default,docs-default-${version}"]`
)
`.dsla-search-field[data-tags="default,docs-default-${version}"]`,
),
).toHaveCount(1);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function tokenize(input: string): string[];

type lunr = ((
config: import("lunr").ConfigFunction
config: import("lunr").ConfigFunction,
) => import("lunr").Index) & {
Index: { load: (index: object) => import("lunr").Index };
} & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const EMPTY_INDEX = {

async function fetchIndex(
baseUrl: string,
tag: string
tag: string,
): Promise<IndexWithDocuments> {
if (SEARCH_INDEX_AVAILABLE) {
let json;
Expand Down Expand Up @@ -88,12 +88,12 @@ const SearchBar = () => {
const [isDarkTheme, setIsDarkTheme] = useState(() =>
isBrowser
? document.documentElement.getAttribute("data-theme") === "dark"
: false
: false,
);
useEffect(() => {
const observer = new MutationObserver(() => {
setIsDarkTheme(
document.documentElement.getAttribute("data-theme") === "dark"
document.documentElement.getAttribute("data-theme") === "dark",
);
});

Expand Down Expand Up @@ -303,7 +303,7 @@ const SearchBar = () => {
async getItems() {
const tags = tagsRef.current;
const indexes = await Promise.all(
tags.map((tag) => getIndex(tag))
tags.map((tag) => getIndex(tag)),
);

const terms = tokenize(input);
Expand Down Expand Up @@ -355,11 +355,11 @@ const SearchBar = () => {
.slice(0, maxSearchResults)
.map((result) => ({
document: documents.find(
(document) => document.id.toString() === result.ref
(document) => document.id.toString() === result.ref,
)!,
score: result.score,
terms,
}))
})),
)
.sort((a, b) => b.score - a.score)
.slice(0, maxSearchResults);
Expand Down
10 changes: 5 additions & 5 deletions packages/docusaurus-search-local/src/server/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ const DEFAULT_OPTIONS = {

it("validates options correctly", () => {
expect(() =>
validateOptions({ options: { foo: 123 }, validate })
validateOptions({ options: { foo: 123 }, validate }),
).toThrowErrorMatchingInlineSnapshot(`""foo" is not allowed"`);

expect(() =>
validateOptions({ options: { style: "modern" }, validate })
validateOptions({ options: { style: "modern" }, validate }),
).toThrowErrorMatchingInlineSnapshot(`""style" must be [none]"`);

expect(validateOptions({ options: {}, validate })).toEqual(DEFAULT_OPTIONS);

expect(
validateOptions({ options: { language: ["en", "de"] }, validate })
validateOptions({ options: { language: ["en", "de"] }, validate }),
).toEqual({
...DEFAULT_OPTIONS,
language: ["en", "de"],
Expand All @@ -51,8 +51,8 @@ it("validates options correctly", () => {
validateOptions({
options: { indexDocSidebarParentCategories: value },
validate,
})
).toThrowError()
}),
).toThrowError(),
);

const options = {
Expand Down
Loading

0 comments on commit a9188ca

Please sign in to comment.