Skip to content

Commit 11322b5

Browse files
committed
fixup!
1 parent b63f452 commit 11322b5

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@node-core/doc-kit",
33
"type": "module",
4-
"version": "1.3.1",
4+
"version": "1.3.2",
55
"repository": {
66
"type": "git",
77
"url": "git+https://github.com/nodejs/doc-kit.git"

src/generators/web/ui/components/SearchBox/index.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import SearchResults from '@node-core/ui-components/Common/Search/Results';
88
import SearchHit from '@node-core/ui-components/Common/Search/Results/Hit';
99

1010
import styles from './index.module.css';
11+
import { relative } from '../../../../../utils/url.mjs';
1112
import useOrama from '../../hooks/useOrama.mjs';
1213

1314
const SearchBox = ({ pathname }) => {
@@ -18,7 +19,14 @@ const SearchBox = ({ pathname }) => {
1819
<div className={styles.searchResultsContainer}>
1920
<SearchResults
2021
noResultsTitle="No results found for"
21-
onHit={hit => <SearchHit document={hit.document} />}
22+
onHit={hit => (
23+
<SearchHit
24+
document={{
25+
...hit.document,
26+
href: relative(hit.document.href, pathname),
27+
}}
28+
/>
29+
)}
2230
/>
2331
</div>
2432

src/generators/web/utils/config.mjs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,29 @@ export function buildLanguageDisplayNameMap() {
7272
* @returns {string} JavaScript source code string with named exports
7373
*/
7474
export default function createConfigSource(input) {
75-
const {
76-
version: versionMeta,
77-
changelog,
78-
editURL: editURLTemplate,
79-
pageURL: pageURLTemplate,
80-
...rest
81-
} = getConfig('web');
75+
const config = getConfig('web');
8276

83-
const version = `v${versionMeta.version}`;
84-
const editURL = populate(editURLTemplate, { ...rest, version });
85-
const pageURL = populate(pageURLTemplate, rest);
77+
const version = `v${config.version.version}`;
78+
const editURL = populate(config.editURL, { ...config, version });
79+
const pageURL = populate(config.pageURL, config);
8680

87-
const lines = [];
81+
const exports = {
82+
...Object.fromEntries(
83+
Object.entries(config).filter(
84+
([, v]) => v === null || typeof v !== 'object'
85+
)
86+
),
87+
version,
88+
versions: buildVersionEntries(config.changelog, pageURL),
89+
editURL,
90+
pages: buildPageList(input),
91+
};
8892

89-
for (const [k, v] of Object.entries(rest)) {
90-
if (v === null || typeof v !== 'object') {
91-
lines.push(`export const ${k} = ${JSON.stringify(v)};`);
92-
}
93-
}
93+
const lines = Object.entries(exports).map(
94+
([k, v]) => `export const ${k} = ${JSON.stringify(v)};`
95+
);
9496

9597
lines.push(
96-
`export const version = ${JSON.stringify(version)};`,
97-
`export const versions = ${JSON.stringify(buildVersionEntries(changelog, pageURL))};`,
98-
`export const editURL = ${JSON.stringify(editURL)};`,
99-
`export const pages = ${JSON.stringify(buildPageList(input))};`,
10098
`export const languageDisplayNameMap = new Map(${JSON.stringify(buildLanguageDisplayNameMap())});`
10199
);
102100

0 commit comments

Comments
 (0)