@diplodoc/cli-tests 5.24.0 → 5.24.2

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.
@@ -4,6 +4,7 @@ exports[`Static files from _assets directory > Download link should be enabled >
4
4
  "[
5
5
  "_assets/test.yaml",
6
6
  "index.md",
7
+ "pc-index.yaml",
7
8
  "toc.yaml"
8
9
  ]"
9
10
  `;
@@ -12,6 +13,7 @@ exports[`Static files from _assets directory > Download link should be enabled >
12
13
  "[
13
14
  "_assets/test.yaml",
14
15
  "index.html",
16
+ "pc-index.html",
15
17
  "toc.js"
16
18
  ]"
17
19
  `;
@@ -31,17 +33,59 @@ vcsPath: index.md
31
33
  Текс <a href="_assets/test.yaml" download="Config">Скачать</a> потом текст
32
34
 
33
35
  Текс [Download](_assets/test.yaml){download="Config"} потом текст
34
- "
36
+
37
+ [Link to pc page](./pc-index.yaml)"
35
38
  `;
36
39
 
37
40
  exports[`Static files from _assets directory > Download link should be enabled 2`] = `
41
+ "description: []
42
+ meta:
43
+ metadata:
44
+ - name: generator
45
+ content: Diplodoc Platform vDIPLODOC-VERSION
46
+ keywords:
47
+ - keyword: '{{ datalens-name }}'
48
+ - keyword: '{{ datalens-full-name }}'
49
+ - keyword: Сервис {{ datalens-name }}
50
+ - keyword: Сервис для бизнес аналитики
51
+ - keyword: BI аналитика
52
+ - keyword: Визуализация данных в {{ yandex-cloud }}
53
+ - keyword: Как подключиться к источнику данных
54
+ - keyword: бизнес-метрики в {{ yandex-cloud }}
55
+ - keyword: Аналитика {{ yandex-cloud }}
56
+ vcsPath: pc-index.yaml
57
+ links:
58
+ - title: Подключения
59
+ description: Подключайте различные источники данных
60
+ href: concepts/connection
61
+ - title: Датасеты
62
+ description: Описывайте структуру данных, полученных из источника
63
+ href: dataset/
64
+ - title: Чарты
65
+ description: >-
66
+ Стройте чарты с помощью Self-service-конструктора визуализаций или
67
+ используйте JavaScript-кастомизацию
68
+ href: concepts/chart/
69
+ - title: Дашборды
70
+ description: Собирайте свои чарты на одной странице
71
+ href: concepts/dashboard
72
+ - title: Управление доступом
73
+ description: Какие права доступа нужны для работы с сервисом
74
+ href: security/
75
+ "
76
+ `;
77
+
78
+ exports[`Static files from _assets directory > Download link should be enabled 3`] = `
38
79
  "title: Test123
39
80
  href: index.md
40
81
  path: toc.yaml
82
+ items:
83
+ - name: Yaml index
84
+ href: pc-index.yaml
41
85
  "
42
86
  `;
43
87
 
44
- exports[`Static files from _assets directory > Download link should be enabled 3`] = `
88
+ exports[`Static files from _assets directory > Download link should be enabled 4`] = `
45
89
  "<!DOCTYPE html>
46
90
  <html lang="ru" dir="ltr">
47
91
  <head>
@@ -56,7 +100,36 @@ exports[`Static files from _assets directory > Download link should be enabled 3
56
100
  <body class="g-root g-root_theme_light">
57
101
  <div id="root"></div>
58
102
  <script type="application/json" id="diplodoc-state">
59
- {"data":{"leading":false,"html":"&lt;h3 id=\\"download-static-file\\"&gt;&lt;a href=\\"index.html#download-static-file\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Download static file&lt;/span&gt;&lt;/a&gt;Download static file&lt;/h3&gt;/n&lt;p&gt;Текст &lt;a href=\\"_assets/test.yaml\\" download=\\"Configuration File\\" class=\\"yfm-file\\"&gt;&lt;span class=\\"yfm-file__icon\\"&gt;&lt;/span&gt;Configuration File&lt;/a&gt; потом текст&lt;/p&gt;/n&lt;p&gt;Текс &lt;a href=\\"_assets/test.yaml\\" download=\\"Config\\"&gt;Скачать&lt;/a&gt; потом текст&lt;/p&gt;/n&lt;p&gt;Текс &lt;a href=\\"_assets/test.yaml\\" download=\\"Config\\"&gt;Download&lt;/a&gt; потом текст&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/file-extension.css"],"vcsPath":"index.md"},"headings":[],"title":""},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
103
+ {"data":{"leading":false,"html":"&lt;h3 id=\\"download-static-file\\"&gt;&lt;a href=\\"index.html#download-static-file\\" class=\\"yfm-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Download static file&lt;/span&gt;&lt;/a&gt;Download static file&lt;/h3&gt;/n&lt;p&gt;Текст &lt;a href=\\"_assets/test.yaml\\" download=\\"Configuration File\\" class=\\"yfm-file\\"&gt;&lt;span class=\\"yfm-file__icon\\"&gt;&lt;/span&gt;Configuration File&lt;/a&gt; потом текст&lt;/p&gt;/n&lt;p&gt;Текс &lt;a href=\\"_assets/test.yaml\\" download=\\"Config\\"&gt;Скачать&lt;/a&gt; потом текст&lt;/p&gt;/n&lt;p&gt;Текс &lt;a href=\\"_assets/test.yaml\\" download=\\"Config\\"&gt;Download&lt;/a&gt; потом текст&lt;/p&gt;/n&lt;p&gt;&lt;a href=\\"pc-index.html\\"&gt;Link to pc page&lt;/a&gt;&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/file-extension.css"],"vcsPath":"index.md"},"headings":[],"title":""},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
104
+ </script>
105
+ <script type="application/javascript">
106
+ const data = document.querySelector('script#diplodoc-state');
107
+ window.__DATA__ = JSON.parse((function unescape(string) {
108
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
109
+ })(data.innerText));
110
+ window.STATIC_CONTENT = false;
111
+ </script>
112
+ <script type="application/javascript" defer src="toc.js"></script>
113
+ </body>
114
+ </html>"
115
+ `;
116
+
117
+ exports[`Static files from _assets directory > Download link should be enabled 5`] = `
118
+ "<!DOCTYPE html>
119
+ <html lang="ru" dir="ltr">
120
+ <head>
121
+ <meta charset="utf-8">
122
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
123
+ <base href="./" />
124
+ <title>Test123</title>
125
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
126
+ <meta name="keywords" content="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]">
127
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
128
+ </head>
129
+ <body class="g-root g-root_theme_light">
130
+ <div id="root"></div>
131
+ <script type="application/json" id="diplodoc-state">
132
+ {"data":{"leading":true,"data":{"description":[],"links":[{"title":"Подключения","description":"Подключайте различные источники данных","href":"concepts/connection/index.html"},{"title":"Датасеты","description":"Описывайте структуру данных, полученных из источника","href":"dataset/index.html"},{"title":"Чарты","description":"Стройте чарты с помощью Self-service-конструктора визуализаций или используйте JavaScript-кастомизацию","href":"concepts/chart/index.html"},{"title":"Дашборды","description":"Собирайте свои чарты на одной странице","href":"concepts/dashboard/index.html"},{"title":"Управление доступом","description":"Какие права доступа нужны для работы с сервисом","href":"security/index.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"keywords":[{"keyword":"{{ datalens-name }}"},{"keyword":"{{ datalens-full-name }}"},{"keyword":"Сервис {{ datalens-name }}"},{"keyword":"Сервис для бизнес аналитики"},{"keyword":"BI аналитика"},{"keyword":"Визуализация данных в {{ yandex-cloud }}"},{"keyword":"Как подключиться к источнику данных"},{"keyword":"бизнес-метрики в {{ yandex-cloud }}"},{"keyword":"Аналитика {{ yandex-cloud }}"}],"vcsPath":"pc-index.yaml"},"title":""},"router":{"pathname":"pc-index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
60
133
  </script>
61
134
  <script type="application/javascript">
62
135
  const data = document.querySelector('script#diplodoc-state');
@@ -70,4 +143,4 @@ exports[`Static files from _assets directory > Download link should be enabled 3
70
143
  </html>"
71
144
  `;
72
145
 
73
- exports[`Static files from _assets directory > Download link should be enabled 4`] = `"window.__DATA__.data.toc = {"title":"Test123","href":"index.html","path":"toc.yaml","id":"UUID"};"`;
146
+ exports[`Static files from _assets directory > Download link should be enabled 6`] = `"window.__DATA__.data.toc = {"title":"Test123","href":"index.html","path":"toc.yaml","items":[{"name":"Yaml index","href":"pc-index.html","id":"UUID"}],"id":"UUID"};"`;
@@ -0,0 +1,67 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Include with Meta > Build with PAGE_PROCESS_CONCURRENCY=1 should preserve meta information in includes > filelist 1`] = `
4
+ "[
5
+ "included.md",
6
+ "index.md",
7
+ "toc.yaml"
8
+ ]"
9
+ `;
10
+
11
+ exports[`Include with Meta > Build with PAGE_PROCESS_CONCURRENCY=1 should preserve meta information in includes 1`] = `
12
+ "---
13
+ metadata:
14
+ - name: generator
15
+ content: Diplodoc Platform vDIPLODOC-VERSION
16
+ title: Included Page Title
17
+ description: This is the description for the included page
18
+ vcsPath: included.md
19
+ ---
20
+
21
+ # Included Page
22
+
23
+ This is the content of the included page.
24
+
25
+ ## Section 1
26
+
27
+ Some content in section 1.
28
+
29
+ ## Section 2
30
+
31
+ Some content in section 2.
32
+ "
33
+ `;
34
+
35
+ exports[`Include with Meta > Build with PAGE_PROCESS_CONCURRENCY=1 should preserve meta information in includes 2`] = `
36
+ "---
37
+ metadata:
38
+ - name: generator
39
+ content: Diplodoc Platform vDIPLODOC-VERSION
40
+ title: Main Page Title
41
+ description: This is the description for the main page
42
+ vcsPath: index.md
43
+ ---
44
+
45
+ # Main Page
46
+
47
+ This is the main page content.
48
+
49
+ ## Including another page
50
+
51
+ Here we include the content from the included page:
52
+
53
+ [Included Page](./included.md)
54
+
55
+ "
56
+ `;
57
+
58
+ exports[`Include with Meta > Build with PAGE_PROCESS_CONCURRENCY=1 should preserve meta information in includes 3`] = `
59
+ "items:
60
+ - name: Main Page
61
+ href: index.md
62
+ items:
63
+ - name: Included Page
64
+ href: included.md
65
+ path: toc.yaml
66
+ "
67
+ `;
@@ -0,0 +1,20 @@
1
+ import {describe, test} from 'vitest';
2
+
3
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
+
5
+ describe('Include with Meta', () => {
6
+ test('Build with PAGE_PROCESS_CONCURRENCY=1 should preserve meta information in includes', async () => {
7
+ const {inputPath, outputPath} = getTestPaths('mocks/include-with-meta');
8
+
9
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
10
+ md2md: true,
11
+ md2html: false,
12
+ args: '-j 2',
13
+ env: {
14
+ PAGE_PROCESS_CONCURRENCY: '1',
15
+ },
16
+ });
17
+
18
+ await compareDirectories(outputPath);
19
+ });
20
+ });
@@ -7,6 +7,7 @@ export interface BuildRunArgs {
7
7
  md2md?: boolean;
8
8
  md2html?: boolean;
9
9
  args?: string;
10
+ env?: Record<string, string>;
10
11
  }
11
12
 
12
13
  export interface TranslateRunArgs {
@@ -23,16 +24,11 @@ class Build {
23
24
  this.runner = runner;
24
25
  }
25
26
 
26
- run(input: string, output: string, args: string[]) {
27
- return this.runner.runYfmDocs([
28
- '--input',
29
- input,
30
- '--output',
31
- output,
32
- '--quiet',
33
- '--allowHTML',
34
- ...args,
35
- ]);
27
+ run(input: string, output: string, args: string[], env?: Record<string, string>) {
28
+ return this.runner.runYfmDocs(
29
+ ['--input', input, '--output', output, '--quiet', '--allowHTML', ...args],
30
+ env,
31
+ );
36
32
  }
37
33
  }
38
34
 
@@ -43,17 +39,11 @@ class Extract {
43
39
  this.runner = runner;
44
40
  }
45
41
 
46
- run(input: string, output: string, args: string[]) {
47
- return this.runner.runYfmDocs([
48
- 'translate',
49
- 'extract',
50
- '--input',
51
- input,
52
- '--output',
53
- output,
54
- '--quiet',
55
- ...args,
56
- ]);
42
+ run(input: string, output: string, args: string[], env?: Record<string, string>) {
43
+ return this.runner.runYfmDocs(
44
+ ['translate', 'extract', '--input', input, '--output', output, '--quiet', ...args],
45
+ env,
46
+ );
57
47
  }
58
48
  }
59
49
 
@@ -67,7 +57,7 @@ export class CliTestAdapter {
67
57
  async testBuildPass(
68
58
  inputPath: string,
69
59
  outputPath: string,
70
- {md2md = true, md2html = true, args = ''}: BuildRunArgs = {},
60
+ {md2md = true, md2html = true, args = '', env}: BuildRunArgs = {},
71
61
  ): Promise<void> {
72
62
  await cleanupDirectory(outputPath);
73
63
  await cleanupDirectory(`${outputPath}-md`);
@@ -78,14 +68,16 @@ export class CliTestAdapter {
78
68
  const tasks = [];
79
69
 
80
70
  if (md2md && md2html) {
81
- tasks.push(() => this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'md']));
71
+ tasks.push(() => this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'md'], env));
82
72
  tasks.push(() =>
83
- this.build.run(inputPath, `${outputPath}-html`, [...baseArgs, '-f', 'html']),
73
+ this.build.run(inputPath, `${outputPath}-html`, [...baseArgs, '-f', 'html'], env),
84
74
  );
85
75
  } else if (md2md) {
86
- tasks.push(() => this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'md']));
76
+ tasks.push(() => this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'md'], env));
87
77
  } else {
88
- tasks.push(() => this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'html']));
78
+ tasks.push(() =>
79
+ this.build.run(inputPath, outputPath, [...baseArgs, '-f', 'html'], env),
80
+ );
89
81
  }
90
82
 
91
83
  for (const task of tasks) {
@@ -10,8 +10,12 @@ export class BinaryRunner implements Runner {
10
10
  this.binaryPath = binaryPath;
11
11
  }
12
12
 
13
- async runYfmDocs(argv: string[]) {
14
- const {stderr, exitCode} = await execa(this.binaryPath, argv, {all: true, reject: false});
13
+ async runYfmDocs(argv: string[], env?: Record<string, string>) {
14
+ const {stderr, exitCode} = await execa(this.binaryPath, argv, {
15
+ all: true,
16
+ reject: false,
17
+ env: {...process.env, ...env},
18
+ });
15
19
  const report = {
16
20
  code: exitCode || 0,
17
21
  warns: fillLog(/^WARN/, stderr),
@@ -5,5 +5,5 @@ export type Report = {
5
5
  };
6
6
 
7
7
  export interface Runner {
8
- runYfmDocs(argv: string[]): Promise<Report>;
8
+ runYfmDocs(argv: string[], env?: Record<string, string>): Promise<Report>;
9
9
  }
@@ -6,3 +6,5 @@
6
6
  Текс <a href="_assets/test.yaml" download="Config">Скачать</a> потом текст
7
7
 
8
8
  Текс [Download](_assets/test.yaml){download="Config"} потом текст
9
+
10
+ [Link to pc page](./pc-index.yaml)
@@ -0,0 +1,70 @@
1
+ title:
2
+ - text: Yandex DataLens
3
+ when: product == "yandex-cloud"
4
+ description:
5
+ - text:
6
+ - Yandex DataLens — это сервис бизнес-аналитики для визуализации ваших данных. Подключайтесь к различным источникам и визуализируйте данные, собирайте дашборды и формируйте отчеты в виде интерактивных презентаций.
7
+ - Отслеживайте ключевые продуктовые и бизнес-метрики в реальном времени, делитесь результатами с командой и принимайте обоснованные решения.
8
+ - Используйте Нейроаналитика для автоматического анализа данных, получения инсайтов, создания и редактирования визуализаций.
9
+ when: product == "yandex-cloud"
10
+ meta:
11
+ title:
12
+ - text: Yandex DataLens
13
+ when: product == "yandex-cloud"
14
+ description:
15
+ - text: "Yandex DataLens — сервис бизнес-аналитики для визуализации данных. Подключайтесь к различным источникам и визуализируйте данные, собирайте дашборды, формируйте отчеты в виде интерактивных презентаций и принимайте решения на основе данных с помощью Нейроаналитика."
16
+ when: product == "yandex-cloud"
17
+ keywords:
18
+ - keyword: "{{ datalens-name }}"
19
+ - keyword: "{{ datalens-full-name }}"
20
+ - keyword: "Сервис {{ datalens-name }}"
21
+ - keyword: Сервис для бизнес аналитики
22
+ - keyword: BI аналитика
23
+ - keyword: "Визуализация данных в {{ yandex-cloud }}"
24
+ - keyword: Как подключиться к источнику данных
25
+ - keyword: "бизнес-метрики в {{ yandex-cloud }}"
26
+ - keyword: "Аналитика {{ yandex-cloud }}"
27
+ links:
28
+ - title: Начало работы
29
+ description: Как начать работать с DataLens
30
+ when: audience == "external"
31
+ href: quickstart
32
+ - title: Нейроаналитик
33
+ description: Поможет интерпретировать ваши данные и написать код
34
+ href: concepts/neuroanalyst
35
+ when: product == "yandex-cloud"
36
+ - title: Подключения
37
+ description: Подключайте различные источники данных
38
+ href: concepts/connection
39
+ - title: Датасеты
40
+ description: Описывайте структуру данных, полученных из источника
41
+ href: dataset/
42
+ - title: Чарты
43
+ description: Стройте чарты с помощью Self-service-конструктора визуализаций или используйте JavaScript-кастомизацию
44
+ href: concepts/chart/
45
+ - title: Дашборды
46
+ description: Собирайте свои чарты на одной странице
47
+ href: concepts/dashboard
48
+ - title: Отчеты
49
+ description: Готовьте многостраничные документы для печати
50
+ when: product == "yandex-cloud" or product == "dlent"
51
+ href: reports/
52
+ - title: Квоты и лимиты
53
+ description: Технические и организационные ограничения сервиса
54
+ when: audience == "external"
55
+ href: concepts/limits
56
+ - title: Управление доступом
57
+ description: Какие права доступа нужны для работы с сервисом
58
+ href: security/
59
+ - title: Правила тарификации
60
+ description: Цены и правила расчета стоимости услуг сервиса
61
+ when: product == "yandex-cloud" and audience == "external"
62
+ href: pricing
63
+ - title: Обучающие курсы
64
+ description: Информация о доступных программах обучения
65
+ href: training
66
+ when: product == "yandex-cloud"
67
+ - title: DataLens Gallery
68
+ description: Готовые дашборды для вдохновения и решения бизнес-задач
69
+ href: concepts/gallery
70
+ when: product == "yandex-cloud" and audience == "external"
@@ -1,3 +1,6 @@
1
1
  title: Test123
2
2
  href: index.md
3
3
  path: toc.yaml
4
+ items:
5
+ - name: Yaml index
6
+ href: pc-index.yaml
@@ -0,0 +1,16 @@
1
+ ---
2
+ title: Included Page Title
3
+ description: This is the description for the included page
4
+ ---
5
+
6
+ # Included Page
7
+
8
+ This is the content of the included page.
9
+
10
+ ## Section 1
11
+
12
+ Some content in section 1.
13
+
14
+ ## Section 2
15
+
16
+ Some content in section 2.
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Main Page Title
3
+ description: This is the description for the main page
4
+ ---
5
+
6
+ # Main Page
7
+
8
+ This is the main page content.
9
+
10
+ ## Including another page
11
+
12
+ Here we include the content from the included page:
13
+
14
+ [{#T}](./included.md)
15
+
@@ -0,0 +1,6 @@
1
+ items:
2
+ - name: Main Page
3
+ href: index.md
4
+ items:
5
+ - name: Included Page
6
+ href: included.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.24.0",
3
+ "version": "5.24.2",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },