@apify/docs-theme 1.0.246 → 1.0.248
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 +1 -2
- package/src/theme/ApiLink/index.jsx +17 -0
- package/src/theme.js +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/docs-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.248",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@stackql/docusaurus-plugin-hubspot": "^1.1.0",
|
|
27
27
|
"algoliasearch": "^5.19.0",
|
|
28
28
|
"algoliasearch-helper": "^3.22.6",
|
|
29
|
-
"axios": "^1.16.0",
|
|
30
29
|
"babel-loader": "^10.0.0",
|
|
31
30
|
"docusaurus-gtm-plugin": "^0.0.2",
|
|
32
31
|
"postcss-preset-env": "^11.0.0",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Link from '@docusaurus/Link';
|
|
2
|
+
import { useDocsVersion } from '@docusaurus/plugin-content-docs/client';
|
|
3
|
+
import { usePluginData } from '@docusaurus/useGlobalData';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
export default function ApiLink({ to, children }) {
|
|
7
|
+
const { version, isLast } = useDocsVersion();
|
|
8
|
+
const typedocData = usePluginData('docusaurus-plugin-typedoc-api');
|
|
9
|
+
const routeBasePath = (typedocData?.routeBasePath ?? 'api').replace(/^\/+|\/+$/g, '');
|
|
10
|
+
|
|
11
|
+
if (isLast) {
|
|
12
|
+
return <Link to={`/${routeBasePath}/${to}`}>{children}</Link>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const versionSlug = version === 'current' ? 'next' : version;
|
|
16
|
+
return <Link to={`/${routeBasePath}/${versionSlug}/${to}`}>{children}</Link>;
|
|
17
|
+
}
|
package/src/theme.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const fs = require('node:fs');
|
|
2
2
|
const path = require('node:path');
|
|
3
3
|
|
|
4
|
-
const axios = require('axios');
|
|
5
4
|
const postcssPreset = require('postcss-preset-env');
|
|
6
5
|
|
|
7
6
|
const { updateChangelog } = require('./markdown');
|
|
@@ -26,8 +25,11 @@ function findPathInParentOrThrow(endPath) {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
async function generateChangelogFromGitHubReleases(paths, repo, { displayedSidebar } = {}) {
|
|
29
|
-
const response = await
|
|
30
|
-
|
|
28
|
+
const response = await fetch(`https://api.github.com/repos/${repo}/releases`);
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`GitHub releases request failed with status ${response.status}`);
|
|
31
|
+
}
|
|
32
|
+
const releases = await response.json();
|
|
31
33
|
|
|
32
34
|
let markdown = '';
|
|
33
35
|
if (!Array.isArray(releases) || releases.length === 0) return;
|