@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.
- package/e2e/__snapshots__/cleanup-empty-dirs.spec.ts.snap +2 -8
- package/e2e/__snapshots__/llms.spec.ts.snap +257 -0
- package/e2e/assets.spec.ts +16 -1
- package/e2e/cleanup-empty-dirs.spec.ts +2 -2
- package/e2e/crawler-manifest.spec.ts +4 -5
- package/e2e/llms.spec.ts +24 -0
- package/mocks/crawler-manifest/notifications-docs-viewer/input/.yfm +1 -1
- package/mocks/crawler-manifest/notifications-root/input/.yfm +4 -2
- package/mocks/llms/input/.yfm +1 -0
- package/mocks/llms/input/_includes/requirements.md +4 -0
- package/mocks/llms/input/api.md +9 -0
- package/mocks/llms/input/beta.md +4 -0
- package/mocks/llms/input/index.md +8 -0
- package/mocks/llms/input/presets.yaml +2 -0
- package/mocks/llms/input/start.md +9 -0
- package/mocks/llms/input/toc.yaml +11 -0
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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":"<h2 id=\\"get-/things\\"><a href=\\"api.html#get-/things\\" class=\\"yfm-anchor yfm-clipboard-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">GET /things</span></a>GET /things</h2>/n<p>Returns the list of things.</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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":"<p>Welcome to <strong>My Product</strong> — the documentation home page.</p>/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(/</g, "<").replace(/>/g, ">").replace(/&/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":"<p>Run the installer and create your first project.</p>/n<h2 id=\\"requirements\\"><a href=\\"start.html#requirements\\" class=\\"yfm-anchor yfm-clipboard-anchor\\" aria-hidden=\\"true\\"><span class=\\"visually-hidden\\" data-no-index=\\"true\\">Requirements</span></a>Requirements</h2>/n<ul>/n<li>Node.js 18+</li>/n<li>2 GB RAM</li>/n</ul>/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(/</g, "<").replace(/>/g, ">").replace(/&/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"};"`;
|
package/e2e/assets.spec.ts
CHANGED
|
@@ -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(
|
|
26
|
-
expect(existsSync(resolve(outputPath, 'empty-section/presets.yaml'))).toBe(
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
110
|
+
emailReceivers: ['user3'],
|
|
112
111
|
});
|
|
113
112
|
});
|
|
114
113
|
|
package/e2e/llms.spec.ts
ADDED
|
@@ -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
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
allowHtml: true
|