@apify/docs-theme 1.0.24 → 1.0.26

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.24",
3
+ "version": "1.0.26",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
@@ -182,6 +182,7 @@ html.plugin-pages .main-wrapper {
182
182
 
183
183
  .main-wrapper > div {
184
184
  max-width: var(--max-layout-width);
185
+ margin: auto;
185
186
  }
186
187
 
187
188
  aside > div > a {
@@ -591,27 +592,3 @@ html[data-theme='dark'] .actionLink:hover::after {
591
592
  background-image: url('/img/arrow-right-primary.svg');
592
593
  margin-left: 8px;
593
594
  }
594
-
595
-
596
- pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}/*!
597
- Theme: GitHub
598
- Description: Light theme as seen on github.com
599
- Author: github.com
600
- Maintainer: @Hirse
601
- Updated: 2021-05-15
602
-
603
- Outdated base version: https://github.com/primer/github-syntax-light
604
- Current colors taken from GitHub's CSS
605
- */
606
- .hljs{color:#24292e;background:#fff}.hljs-doctag,.hljs-keyword,.hljs-meta .hljs-keyword,.hljs-template-tag,.hljs-template-variable,.hljs-type,.hljs-variable.language_{color:#d73a49}.hljs-title,.hljs-title.class_,.hljs-title.class_.inherited__,.hljs-title.function_{color:#6f42c1}.hljs-attr,.hljs-attribute,.hljs-literal,.hljs-meta,.hljs-number,.hljs-operator,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-variable{color:#005cc5}.hljs-meta .hljs-string,.hljs-regexp,.hljs-string{color:#032f62}.hljs-built_in,.hljs-symbol{color:#e36209}.hljs-code,.hljs-comment,.hljs-formula{color:#6a737d}.hljs-name,.hljs-quote,.hljs-selector-pseudo,.hljs-selector-tag{color:#22863a}.hljs-subst{color:#24292e}.hljs-section{color:#005cc5;font-weight:700}.hljs-bullet{color:#735c0f}.hljs-emphasis{color:#24292e;font-style:italic}.hljs-strong{color:#24292e;font-weight:700}.hljs-addition{color:#22863a;background-color:#f0fff4}.hljs-deletion{color:#b31d28;background-color:#ffeef0}
607
-
608
- /*!
609
- Theme: GitHub Dark Dimmed
610
- Description: Dark dimmed theme as seen on github.com
611
- Author: github.com
612
- Maintainer: @Hirse
613
- Updated: 2021-05-15
614
-
615
- Colors taken from GitHub's CSS
616
- */
617
- html[data-theme="dark"] .hljs{color:#adbac7;background:#22272e}html[data-theme="dark"] .hljs-doctag,html[data-theme="dark"] .hljs-keyword,html[data-theme="dark"] .hljs-meta .hljs-keyword,html[data-theme="dark"] .hljs-template-tag,html[data-theme="dark"] .hljs-template-variable,html[data-theme="dark"] .hljs-type,html[data-theme="dark"] .hljs-variable.language_{color:#f47067}html[data-theme="dark"] .hljs-title,html[data-theme="dark"] .hljs-title.class_,html[data-theme="dark"] .hljs-title.class_.inherited__,html[data-theme="dark"] .hljs-title.function_{color:#dcbdfb}html[data-theme="dark"] .hljs-attr,html[data-theme="dark"] .hljs-attribute,html[data-theme="dark"] .hljs-literal,html[data-theme="dark"] .hljs-meta,html[data-theme="dark"] .hljs-number,html[data-theme="dark"] .hljs-operator,html[data-theme="dark"] .hljs-selector-attr,html[data-theme="dark"] .hljs-selector-class,html[data-theme="dark"] .hljs-selector-id,html[data-theme="dark"] .hljs-variable{color:#6cb6ff}html[data-theme="dark"] .hljs-meta .hljs-string,html[data-theme="dark"] .hljs-regexp,html[data-theme="dark"] .hljs-string{color:#96d0ff}html[data-theme="dark"] .hljs-built_in,html[data-theme="dark"] .hljs-symbol{color:#f69d50}html[data-theme="dark"] .hljs-code,html[data-theme="dark"] .hljs-comment,html[data-theme="dark"] .hljs-formula{color:#768390}html[data-theme="dark"] .hljs-name,html[data-theme="dark"] .hljs-quote,html[data-theme="dark"] .hljs-selector-pseudo,html[data-theme="dark"] .hljs-selector-tag{color:#8ddb8c}html[data-theme="dark"] .hljs-subst{color:#adbac7}html[data-theme="dark"] .hljs-section{color:#316dca;font-weight:700}html[data-theme="dark"] .hljs-bullet{color:#eac55f}html[data-theme="dark"] .hljs-emphasis{color:#adbac7;font-style:italic}html[data-theme="dark"] .hljs-strong{color:#adbac7;font-weight:700}html[data-theme="dark"] .hljs-addition{color:#b4f1b4;background-color:#1b4721}html[data-theme="dark"] .hljs-deletion{color:#ffd8d3;background-color:#78191b}
package/src/theme.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const path = require('path');
2
2
  const fs = require('fs');
3
3
 
4
- function findPathToParent(endPath) {
4
+ function findPathInParent(endPath) {
5
5
  let parentPath = __dirname;
6
6
  while (parentPath !== path.join(parentPath, '..')) {
7
7
  const filePath = path.join(parentPath, endPath);
@@ -11,7 +11,13 @@ function findPathToParent(endPath) {
11
11
  const filePath = path.join(parentPath, endPath);
12
12
  if (fs.existsSync(filePath)) return filePath;
13
13
 
14
- throw new Error('Could not find CHANGELOG.md in any parent directory');
14
+ return false;
15
+ }
16
+
17
+ function findPathInParentOrThrow(endPath) {
18
+ const filePath = findPathInParent(endPath);
19
+ if (!filePath) throw new Error(`Could not find ${endPath} in any parent directory`);
20
+ return filePath;
15
21
  }
16
22
 
17
23
  function updateChangelog(changelogPath) {
@@ -40,13 +46,24 @@ function theme(
40
46
  },
41
47
  async loadContent() {
42
48
  try {
43
- const docsPath = findPathToParent('docs');
44
- const changelogPath = findPathToParent('CHANGELOG.md');
45
- if (fs.existsSync(path.join(docsPath, 'changelog.md') || fs.statSync(
46
- path.join(docsPath, 'changelog.md')).mtime >= fs.statSync(changelogPath).mtime,
47
- )) return;
48
- fs.copyFileSync(changelogPath, path.join(docsPath, 'changelog.md'));
49
- updateChangelog(path.join(docsPath, 'changelog.md'));
49
+ const changelogPath = findPathInParentOrThrow('CHANGELOG.md');
50
+ const versioned = findPathInParent('website/versioned_docs');
51
+
52
+ const pathsToCopyChangelog = [
53
+ findPathInParentOrThrow('docs'),
54
+ ...(versioned
55
+ ? fs.readdirSync(versioned).map((version) => path.join(versioned, version))
56
+ : []
57
+ ),
58
+ ];
59
+
60
+ for (const docsPath of pathsToCopyChangelog) {
61
+ if (fs.existsSync(path.join(docsPath, 'changelog.md')) && fs.statSync(
62
+ path.join(docsPath, 'changelog.md')).mtime >= fs.statSync(changelogPath).mtime) continue;
63
+ fs.copyFileSync(changelogPath, path.join(docsPath, 'changelog.md'));
64
+ console.log(`copied ${changelogPath} to ${path.join(docsPath, 'changelog.md')}`);
65
+ updateChangelog(path.join(docsPath, 'changelog.md'));
66
+ }
50
67
  } catch (e) {
51
68
  console.warn(`Changelog page could not be initialized: ${e.message}`);
52
69
  }