@apify/docs-theme 1.0.130 → 1.0.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/docs-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.132",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,13 +19,12 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@apify/docs-search-modal": "^1.0
|
|
23
|
-
"@docusaurus/theme-common": "^
|
|
22
|
+
"@apify/docs-search-modal": "^1.1.0",
|
|
23
|
+
"@docusaurus/theme-common": "^3.5.2",
|
|
24
24
|
"@stackql/docusaurus-plugin-hubspot": "^1.1.0",
|
|
25
25
|
"axios": "^1.7.4",
|
|
26
26
|
"babel-loader": "^9.1.3",
|
|
27
27
|
"docusaurus-gtm-plugin": "^0.0.2",
|
|
28
|
-
"docusaurus-plugin-smartlook": "^1.0.2",
|
|
29
28
|
"postcss-preset-env": "^9.3.0",
|
|
30
29
|
"prism-react-renderer": "^2.0.6"
|
|
31
30
|
},
|
package/src/config.js
CHANGED
|
@@ -13,7 +13,6 @@ const themeConfig = ({
|
|
|
13
13
|
hideable: true,
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
-
smartlook: { projectKey: process.env.SMARTLOOK_PROJECT_KEY || '-' },
|
|
17
16
|
navbar: {
|
|
18
17
|
title: 'Apify Docs',
|
|
19
18
|
logo: {
|
|
@@ -266,7 +265,6 @@ const themeConfig = ({
|
|
|
266
265
|
});
|
|
267
266
|
|
|
268
267
|
const plugins = [
|
|
269
|
-
'docusaurus-plugin-smartlook',
|
|
270
268
|
[
|
|
271
269
|
'docusaurus-gtm-plugin',
|
|
272
270
|
{
|
package/src/markdown.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
function updateChangelog(changelog) {
|
|
2
|
-
changelog =
|
|
2
|
+
changelog = addFrontmatter(changelog);
|
|
3
3
|
changelog = pushHeadings(changelog);
|
|
4
|
-
changelog =
|
|
5
|
-
changelog =
|
|
4
|
+
changelog = fixUserLinks(changelog);
|
|
5
|
+
changelog = fixPRLinks(changelog);
|
|
6
|
+
changelog = escapeMDXCharacters(changelog);
|
|
6
7
|
return changelog;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
function
|
|
10
|
+
function addFrontmatter(changelog, header = 'Changelog') {
|
|
10
11
|
return `---
|
|
11
12
|
title: ${header}
|
|
12
13
|
sidebar_label: ${header}
|
|
@@ -19,14 +20,22 @@ function pushHeadings(changelog) {
|
|
|
19
20
|
return changelog.replaceAll(/\n#[^#]/g, '\n## ');
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
function
|
|
23
|
+
function fixUserLinks(changelog) {
|
|
23
24
|
return changelog.replaceAll(/by @([a-zA-Z0-9-]+)/g, 'by [@$1](https://github.com/$1)');
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
function
|
|
27
|
+
function fixPRLinks(changelog) {
|
|
27
28
|
return changelog.replaceAll(/(((https?:\/\/)?(www.)?)?github.com\/[^\s]*?\/pull\/([0-9]+))/g, '[#$5]($1)');
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
function escapeMDXCharacters(changelog) {
|
|
32
|
+
return changelog.replaceAll(/<|>/g, (match) => {
|
|
33
|
+
return match === '<' ? '<' : '>';
|
|
34
|
+
}).replaceAll(/\{|\}/g, (match) => {
|
|
35
|
+
return match === '{' ? '{' : '}';
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
module.exports = {
|
|
31
40
|
updateChangelog,
|
|
32
41
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Link from '@docusaurus/Link';
|
|
2
|
-
import { ThemeClassNames } from '@docusaurus/theme-common';
|
|
3
2
|
import {
|
|
4
3
|
useSidebarBreadcrumbs,
|
|
5
|
-
|
|
6
|
-
} from '@docusaurus/theme-common
|
|
4
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
5
|
+
import { ThemeClassNames } from '@docusaurus/theme-common';
|
|
6
|
+
import { useHomePageRoute } from '@docusaurus/theme-common/internal';
|
|
7
7
|
import { translate } from '@docusaurus/Translate';
|
|
8
8
|
import HomeBreadcrumbItem from '@theme/DocBreadcrumbs/Items/Home';
|
|
9
9
|
import clsx from 'clsx';
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { ThemeClassNames } from '@docusaurus/theme-common';
|
|
5
5
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
6
|
-
import { isActiveSidebarItem } from '@docusaurus/
|
|
6
|
+
import { isActiveSidebarItem } from '@docusaurus/plugin-content-docs/client';
|
|
7
7
|
import Link from '@docusaurus/Link';
|
|
8
8
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
9
9
|
import IconExternalLink from '@theme/Icon/ExternalLink';
|
|
@@ -6,7 +6,7 @@ import HtmlNavbarItem from '@theme/NavbarItem/HtmlNavbarItem';
|
|
|
6
6
|
import DocSidebarNavbarItem from '@theme/NavbarItem/DocSidebarNavbarItem';
|
|
7
7
|
import DocsVersionNavbarItem from '@theme/NavbarItem/DocsVersionNavbarItem';
|
|
8
8
|
import DocsVersionDropdownNavbarItem from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
|
|
9
|
-
import { useDocsVersion, useLayoutDoc } from '@docusaurus/
|
|
9
|
+
import { useDocsVersion, useLayoutDoc } from '@docusaurus/plugin-content-docs/client';
|
|
10
10
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
11
11
|
import React from 'react';
|
|
12
12
|
|
package/src/theme.js
CHANGED
|
@@ -25,7 +25,7 @@ function findPathInParentOrThrow(endPath) {
|
|
|
25
25
|
return filePath;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async function
|
|
28
|
+
async function generateChangelogFromGitHubReleases(paths, repo) {
|
|
29
29
|
const response = await axios.get(`https://api.github.com/repos/${repo}/releases`);
|
|
30
30
|
const releases = response.data;
|
|
31
31
|
|
|
@@ -81,6 +81,12 @@ function theme(
|
|
|
81
81
|
),
|
|
82
82
|
];
|
|
83
83
|
|
|
84
|
+
if (options.changelogFromRoot) {
|
|
85
|
+
copyChangelogFromRoot(pathsToCopyChangelog);
|
|
86
|
+
} else {
|
|
87
|
+
await generateChangelogFromGitHubReleases(pathsToCopyChangelog, `${context.siteConfig.organizationName}/${context.siteConfig.projectName}`);
|
|
88
|
+
}
|
|
89
|
+
|
|
84
90
|
for (const p of pathsToCopyChangelog) {
|
|
85
91
|
// the changelog page has to exist for the sidebar to work - async loadContent() is (apparently) not awaited for by sidebar
|
|
86
92
|
if (fs.existsSync(path.join(p, 'changelog.md'))) continue;
|
|
@@ -92,12 +98,6 @@ It seems that the changelog is not available.
|
|
|
92
98
|
This either means that your Docusaurus setup is misconfigured, or that your GitHub repository contains no releases yet.
|
|
93
99
|
`);
|
|
94
100
|
}
|
|
95
|
-
|
|
96
|
-
if (options.changelogFromRoot) {
|
|
97
|
-
copyChangelogFromRoot(pathsToCopyChangelog);
|
|
98
|
-
} else {
|
|
99
|
-
await copyChangelogFromReleases(pathsToCopyChangelog, `${context.siteConfig.organizationName}/${context.siteConfig.projectName}`);
|
|
100
|
-
}
|
|
101
101
|
} catch (e) {
|
|
102
102
|
// eslint-disable-next-line no-console
|
|
103
103
|
console.warn(`Changelog page could not be initialized: ${e.message}`);
|