@diplodoc/cli-tests 5.43.2 → 5.44.0

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.
@@ -35,12 +35,6 @@ path: active/toc.yaml
35
35
  `;
36
36
 
37
37
  exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 5`] = `
38
- "default:
39
- empty_var: empty_value
40
- "
41
- `;
42
-
43
- exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 6`] = `
44
38
  "---
45
39
  metadata:
46
40
  - name: generator
@@ -54,13 +48,13 @@ This is the main page content.
54
48
  Root variable: {{root_var}}"
55
49
  `;
56
50
 
57
- exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 7`] = `
51
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 6`] = `
58
52
  "default:
59
53
  root_var: root_value
60
54
  "
61
55
  `;
62
56
 
63
- exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 8`] = `
57
+ exports[`Cleanup empty directories with stage filtering > should cleanup directories that contain only presets.yaml when TOC is ignored by stage 7`] = `
64
58
  "title: Test Documentation
65
59
  href: index.md
66
60
  items:
@@ -0,0 +1,257 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html > filelist 1`] = `
4
+ "[
5
+ ".yfm",
6
+ "api.md",
7
+ "index.md",
8
+ "llms-full.txt",
9
+ "llms.txt",
10
+ "start.md",
11
+ "toc.yaml"
12
+ ]"
13
+ `;
14
+
15
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html > filelist 2`] = `
16
+ "[
17
+ ".yfm",
18
+ "api.html",
19
+ "index.html",
20
+ "llms-full.txt",
21
+ "llms.txt",
22
+ "start.html",
23
+ "toc.js"
24
+ ]"
25
+ `;
26
+
27
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 1`] = `
28
+ "allowHtml: true
29
+ "
30
+ `;
31
+
32
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 2`] = `
33
+ "---
34
+ metadata:
35
+ - name: generator
36
+ content: Diplodoc Platform vDIPLODOC-VERSION
37
+ description: Full reference of the public HTTP endpoints.
38
+ vcsPath: api.md
39
+ ---
40
+
41
+ # API Reference
42
+
43
+ ## GET /things
44
+
45
+ Returns the list of things.
46
+ "
47
+ `;
48
+
49
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 3`] = `
50
+ "---
51
+ metadata:
52
+ - name: generator
53
+ content: Diplodoc Platform vDIPLODOC-VERSION
54
+ title: Overview
55
+ description: What this product is and how to get started.
56
+ vcsPath: index.md
57
+ ---
58
+
59
+ # Overview
60
+
61
+ Welcome to **My Product** — the documentation home page.
62
+ "
63
+ `;
64
+
65
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 4`] = `
66
+ "# My Product
67
+
68
+ # Overview
69
+
70
+ Welcome to **My Product** — the documentation home page.
71
+
72
+ # Getting Started
73
+
74
+ Run the installer and create your first project.
75
+
76
+ ## Requirements
77
+
78
+ - Node.js 18+
79
+ - 2 GB RAM
80
+
81
+ # API Reference
82
+
83
+ ## GET /things
84
+
85
+ Returns the list of things.
86
+ "
87
+ `;
88
+
89
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 5`] = `
90
+ "# My Product
91
+
92
+ - [Overview](index.md): What this product is and how to get started.
93
+ - [Getting Started](start.md): Install the product and build your first project.
94
+ - [API Reference](api.md): Full reference of the public HTTP endpoints.
95
+ "
96
+ `;
97
+
98
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 6`] = `
99
+ "---
100
+ metadata:
101
+ - name: generator
102
+ content: Diplodoc Platform vDIPLODOC-VERSION
103
+ description: Install the product and build your first project.
104
+ vcsPath: start.md
105
+ ---
106
+
107
+ # Getting Started
108
+
109
+ Run the installer and create your first project.
110
+
111
+ <!-- source: _includes/requirements.md -->
112
+ ## Requirements
113
+
114
+ - Node.js 18+
115
+ - 2 GB RAM
116
+ <!-- endsource: _includes/requirements.md -->
117
+ "
118
+ `;
119
+
120
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 7`] = `
121
+ "title: My Product
122
+ href: index.md
123
+ items:
124
+ - name: Getting Started
125
+ href: start.md
126
+ - name: API Reference
127
+ href: api.md
128
+ path: toc.yaml
129
+ "
130
+ `;
131
+
132
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 8`] = `
133
+ "allowHtml: true
134
+ "
135
+ `;
136
+
137
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 9`] = `
138
+ "<!DOCTYPE html>
139
+ <html lang="ru" dir="ltr">
140
+ <head>
141
+ <meta charset="utf-8">
142
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
143
+ <base href="./" />
144
+ <title>API Reference | My Product</title>
145
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
146
+ <meta name="description" content="Full reference of the public HTTP endpoints.">
147
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
148
+ </head>
149
+ <body class="g-root g-root_theme_light">
150
+ <div id="root"></div>
151
+ <script type="application/json" id="diplodoc-state">
152
+ {"data":{"leading":false,"html":"&lt;h2 id=\\"get-/things\\"&gt;&lt;a href=\\"api.html#get-/things\\" class=\\"yfm-anchor yfm-clipboard-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;GET /things&lt;/span&gt;&lt;/a&gt;GET /things&lt;/h2&gt;/n&lt;p&gt;Returns the list of things.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"description","content":"Full reference of the public HTTP endpoints."}],"description":"Full reference of the public HTTP endpoints.","vcsPath":"api.md"},"headings":[{"title":"GET /things","href":"api.html#get-/things","level":2}],"title":"API Reference"},"router":{"pathname":"api","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
153
+ </script>
154
+ <script type="application/javascript">
155
+ const data = document.querySelector('script#diplodoc-state');
156
+ window.__DATA__ = JSON.parse((function unescape(string) {
157
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
158
+ })(data.innerText));
159
+ window.STATIC_CONTENT = false;
160
+ </script>
161
+ <script type="application/javascript" defer src="toc.js"></script>
162
+ </body>
163
+ </html>"
164
+ `;
165
+
166
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 10`] = `
167
+ "<!DOCTYPE html>
168
+ <html lang="ru" dir="ltr">
169
+ <head>
170
+ <meta charset="utf-8">
171
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
172
+ <base href="./" />
173
+ <title>Overview | My Product</title>
174
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
175
+ <meta name="description" content="What this product is and how to get started.">
176
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
177
+ </head>
178
+ <body class="g-root g-root_theme_light">
179
+ <div id="root"></div>
180
+ <script type="application/json" id="diplodoc-state">
181
+ {"data":{"leading":false,"html":"&lt;p&gt;Welcome to &lt;strong&gt;My Product&lt;/strong&gt; — the documentation home page.&lt;/p&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"description","content":"What this product is and how to get started."}],"title":"Overview","description":"What this product is and how to get started.","vcsPath":"index.md"},"headings":[],"title":"Overview"},"router":{"pathname":"index","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
182
+ </script>
183
+ <script type="application/javascript">
184
+ const data = document.querySelector('script#diplodoc-state');
185
+ window.__DATA__ = JSON.parse((function unescape(string) {
186
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
187
+ })(data.innerText));
188
+ window.STATIC_CONTENT = false;
189
+ </script>
190
+ <script type="application/javascript" defer src="toc.js"></script>
191
+ </body>
192
+ </html>"
193
+ `;
194
+
195
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 11`] = `
196
+ "# My Product
197
+
198
+ # Overview
199
+
200
+ Welcome to **My Product** — the documentation home page.
201
+
202
+ # Getting Started
203
+
204
+ Run the installer and create your first project.
205
+
206
+ ## Requirements
207
+
208
+ - Node.js 18+
209
+ - 2 GB RAM
210
+
211
+ # API Reference
212
+
213
+ ## GET /things
214
+
215
+ Returns the list of things.
216
+ "
217
+ `;
218
+
219
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 12`] = `
220
+ "# My Product
221
+
222
+ - [Overview](index.html): What this product is and how to get started.
223
+ - [Getting Started](start.html): Install the product and build your first project.
224
+ - [API Reference](api.html): Full reference of the public HTTP endpoints.
225
+ "
226
+ `;
227
+
228
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 13`] = `
229
+ "<!DOCTYPE html>
230
+ <html lang="ru" dir="ltr">
231
+ <head>
232
+ <meta charset="utf-8">
233
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
234
+ <base href="./" />
235
+ <title>Getting Started | My Product</title>
236
+ <meta name="generator" content="Diplodoc Platform vDIPLODOC-VERSION">
237
+ <meta name="description" content="Install the product and build your first project.">
238
+ <style type="text/css">html, body {min-height:100vh; height:100vh;}</style>
239
+ </head>
240
+ <body class="g-root g-root_theme_light">
241
+ <div id="root"></div>
242
+ <script type="application/json" id="diplodoc-state">
243
+ {"data":{"leading":false,"html":"&lt;p&gt;Run the installer and create your first project.&lt;/p&gt;/n&lt;h2 id=\\"requirements\\"&gt;&lt;a href=\\"start.html#requirements\\" class=\\"yfm-anchor yfm-clipboard-anchor\\" aria-hidden=\\"true\\"&gt;&lt;span class=\\"visually-hidden\\" data-no-index=\\"true\\"&gt;Requirements&lt;/span&gt;&lt;/a&gt;Requirements&lt;/h2&gt;/n&lt;ul&gt;/n&lt;li&gt;Node.js 18+&lt;/li&gt;/n&lt;li&gt;2 GB RAM&lt;/li&gt;/n&lt;/ul&gt;/n","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"description","content":"Install the product and build your first project."}],"description":"Install the product and build your first project.","vcsPath":"start.md"},"headings":[{"title":"Requirements","href":"start.html#requirements","level":2}],"title":"Getting Started"},"router":{"pathname":"start","depth":1,"base":"./"},"lang":"ru","langs":["ru"],"viewerInterface":{"toc":true,"search":true,"feedback":true}}
244
+ </script>
245
+ <script type="application/javascript">
246
+ const data = document.querySelector('script#diplodoc-state');
247
+ window.__DATA__ = JSON.parse((function unescape(string) {
248
+ return string.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
249
+ })(data.innerText));
250
+ window.STATIC_CONTENT = false;
251
+ </script>
252
+ <script type="application/javascript" defer src="toc.js"></script>
253
+ </body>
254
+ </html>"
255
+ `;
256
+
257
+ exports[`llms.txt > generates llms.txt and llms-full.txt for md and html 14`] = `"window.__DATA__.data.toc = {"title":"My Product","href":"index.html","items":[{"name":"Getting Started","href":"start.html","id":"UUID"},{"name":"API Reference","href":"api.html","id":"UUID"}],"path":"toc.yaml","id":"UUID"};"`;
@@ -1,4 +1,6 @@
1
- import {describe, it} from 'vitest';
1
+ import {describe, expect, it} from 'vitest';
2
+ import fs from 'node:fs';
3
+ import {join} from 'node:path';
2
4
 
3
5
  import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
6
 
@@ -13,4 +15,17 @@ describe('Assets', () => {
13
15
  });
14
16
  await compareDirectories(outputPath);
15
17
  });
18
+
19
+ it('Assets HTML', async () => {
20
+ const {inputPath, outputPath} = getTestPaths('mocks/assets');
21
+
22
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
23
+ md2md: false,
24
+ md2html: true,
25
+ args: '-j2',
26
+ });
27
+
28
+ expect(fs.existsSync(join(outputPath, '_images/mountain.jpg'))).toBe(true);
29
+ expect(fs.existsSync(join(outputPath, '_images/versions.png'))).toBe(true);
30
+ });
16
31
  });
@@ -22,8 +22,8 @@ describe('Cleanup empty directories with stage filtering', () => {
22
22
  expect(existsSync(resolve(outputPath, 'active/presets.yaml'))).toBe(true);
23
23
  expect(existsSync(resolve(outputPath, 'active/toc.yaml'))).toBe(true);
24
24
 
25
- expect(existsSync(resolve(outputPath, 'empty-section'))).toBe(true);
26
- expect(existsSync(resolve(outputPath, 'empty-section/presets.yaml'))).toBe(true);
25
+ expect(existsSync(resolve(outputPath, 'empty-section'))).toBe(false);
26
+ expect(existsSync(resolve(outputPath, 'empty-section/presets.yaml'))).toBe(false);
27
27
 
28
28
  // Check that root files are present
29
29
  expect(existsSync(resolve(outputPath, 'index.md'))).toBe(true);
@@ -86,13 +86,13 @@ describe('Crawler manifest', () => {
86
86
  const manifest = JSON.parse(manifestContent);
87
87
 
88
88
  expect(manifest.notifications).toEqual({
89
- channels: ['email', 'messenger'],
90
89
  interval: 'daily',
91
- receivers: ['user1', 'user2'],
90
+ emailReceivers: ['user1', 'user2'],
91
+ messengerReceivers: ['user1', 'user2'],
92
92
  });
93
93
  });
94
94
 
95
- test('includes notifications from docs-viewer.crawler config with default channel', async () => {
95
+ test('includes notifications from docs-viewer.crawler config with default interval', async () => {
96
96
  const {inputPath, outputPath} = getTestPaths(
97
97
  'mocks/crawler-manifest/notifications-docs-viewer',
98
98
  );
@@ -106,9 +106,8 @@ describe('Crawler manifest', () => {
106
106
  const manifest = JSON.parse(manifestContent);
107
107
 
108
108
  expect(manifest.notifications).toEqual({
109
- channels: ['email'],
110
109
  interval: 'weekly',
111
- receivers: ['user3'],
110
+ emailReceivers: ['user3'],
112
111
  });
113
112
  });
114
113
 
@@ -0,0 +1,24 @@
1
+ import {describe, test} from 'vitest';
2
+
3
+ import {TestAdapter, compareDirectories, getTestPaths} from '../fixtures';
4
+
5
+ describe('llms.txt', () => {
6
+ // Builds the same fixture in both md and html with `--llms` (variant B):
7
+ // - md output -> `${outputPath}` (llms-full.txt has includes merged)
8
+ // - html output -> `${outputPath}-html` (llms-full.txt keeps include directives)
9
+ // The fixture also has per-page frontmatter descriptions (surfaced in
10
+ // llms.txt) and a `when: showBeta` page that the default version filters
11
+ // out — proving the artifacts stay consistent with the built "version".
12
+ test('generates llms.txt and llms-full.txt for md and html', async () => {
13
+ const {inputPath, outputPath} = getTestPaths('mocks/llms');
14
+
15
+ await TestAdapter.testBuildPass(inputPath, outputPath, {
16
+ md2md: true,
17
+ md2html: true,
18
+ args: '--llms',
19
+ });
20
+
21
+ await compareDirectories(outputPath);
22
+ await compareDirectories(`${outputPath}-html`);
23
+ });
24
+ });
@@ -4,5 +4,5 @@ docs-viewer:
4
4
  crawler:
5
5
  notifications:
6
6
  interval: weekly
7
- receivers:
7
+ emailReceivers:
8
8
  - user3
@@ -3,7 +3,9 @@ crawlerManifest: true
3
3
  crawler:
4
4
  notifications:
5
5
  interval: daily
6
- channels: ['email', 'messenger']
7
- receivers:
6
+ emailReceivers:
7
+ - user1
8
+ - user2
9
+ messengerReceivers:
8
10
  - user1
9
11
  - user2
@@ -0,0 +1 @@
1
+ allowHtml: true
@@ -0,0 +1,4 @@
1
+ ## Requirements
2
+
3
+ - Node.js 18+
4
+ - 2 GB RAM
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Full reference of the public HTTP endpoints.
3
+ ---
4
+
5
+ # API Reference
6
+
7
+ ## GET /things
8
+
9
+ Returns the list of things.
@@ -0,0 +1,4 @@
1
+ # Beta Feature
2
+
3
+ This page is gated behind `when: showBeta` and must NOT appear in the llms
4
+ artifacts for the default (showBeta = false) version.
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Overview
3
+ description: What this product is and how to get started.
4
+ ---
5
+
6
+ # Overview
7
+
8
+ Welcome to **My Product** — the documentation home page.
@@ -0,0 +1,2 @@
1
+ default:
2
+ showBeta: false
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Install the product and build your first project.
3
+ ---
4
+
5
+ # Getting Started
6
+
7
+ Run the installer and create your first project.
8
+
9
+ {% include [Requirements](_includes/requirements.md) %}
@@ -0,0 +1,11 @@
1
+ title: My Product
2
+ href: index.md
3
+
4
+ items:
5
+ - name: Getting Started
6
+ href: start.md
7
+ - name: API Reference
8
+ href: api.md
9
+ - name: Beta Feature
10
+ href: beta.md
11
+ when: showBeta
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diplodoc/cli-tests",
3
- "version": "5.43.2",
3
+ "version": "5.44.0",
4
4
  "bin": {
5
5
  "diplodoc-cli-test": "bin.mjs"
6
6
  },