@apify/docs-theme 1.0.42 → 1.0.43

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/theme.js +11 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
package/src/theme.js CHANGED
@@ -25,7 +25,9 @@ function updateChangelog(changelogPath) {
25
25
  const changelog = fs.readFileSync(changelogPath, 'utf-8');
26
26
  const updated = `---
27
27
  title: Changelog
28
+ sidebar_label: Changelog
28
29
  ---
30
+
29
31
  ${changelog.replaceAll(/\n#[^#]/g, '\n## ')}`;
30
32
  fs.writeFileSync(changelogPath, updated, 'utf-8');
31
33
  }
@@ -35,6 +37,8 @@ async function copyChangelogFromReleases(paths, repo) {
35
37
  const releases = response.data;
36
38
 
37
39
  let markdown = '';
40
+ if (!Array.isArray(releases) || releases.length === 0) return;
41
+
38
42
  releases.forEach((release, i, a) => {
39
43
  markdown += release.tag_name && a[i + 1]?.tag_name
40
44
  ? `## [${release.name}](https://github.com/${repo}/compare/${a[i + 1].tag_name}...${release.tag_name})\n`
@@ -88,7 +92,13 @@ function theme(
88
92
  for (const p of pathsToCopyChangelog) {
89
93
  // the changelog page has to exist for the sidebar to work - async loadContent() is (apparently) not awaited for by sidebar
90
94
  if (fs.existsSync(path.join(p, 'changelog.md'))) continue;
91
- fs.writeFileSync(`${p}/changelog.md`, 'Changelog placeholder. Please wait...');
95
+ fs.writeFileSync(`${p}/changelog.md`, `---
96
+ title: Changelog
97
+ sidebar_label: Changelog
98
+ ---
99
+ It seems that the changelog is not available.
100
+ This either means that your Docusaurus setup is misconfigured, or that your GitHub repository contains no releases yet.
101
+ `);
92
102
  }
93
103
 
94
104
  if (options.changelogFromRoot) {