@astryxdesign/cli 0.6.3-canary.29be688 → 0.6.3-canary.2bb99ed
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/README.md +2 -0
- package/api/docs/detail/section/section.mjs +9 -15
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/doctor/doctor.mjs +1 -1
- package/api/doctor/doctor.test.mjs +6 -6
- package/api/upgrade/_adapter.d.mts +22 -4
- package/api/upgrade/_adapter.mjs +19 -6
- package/api/upgrade/run/run.mjs +355 -59
- package/api/upgrade/upgrade.doc.mjs +5 -1
- package/api/upgrade/upgrade.type.d.mts +34 -0
- package/api/upgrade/upgrade.type.mjs +15 -0
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +248 -110
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +4 -0
- package/assets/codemods/transforms/next/index.mjs +8 -0
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/docs/cli-integrations.doc.mjs +13 -0
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/authoring/codemod/type.ts +12 -0
- package/authoring/doctypes/_schema.d.mts +71 -141
- package/authoring/doctypes/_schema.mjs +29 -2
- package/authoring/doctypes/load-contract.test.mjs +1 -1
- package/authoring/doctypes/namespace/namespace.doc.mjs +2 -2
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.mjs +3 -2
- package/authoring/doctypes/reference/reference.doc.mjs +5 -3
- package/authoring/doctypes/reference/type.ts +7 -8
- package/authoring/index.d.ts +1 -0
- package/clients/cli/commands/build-theme.mjs +10 -44
- package/clients/cli/commands/docs.mjs +15 -58
- package/clients/cli/commands/docs.test.mjs +11 -14
- package/clients/cli/commands/text-json-parity.test.mjs +718 -0
- package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
- package/clients/cli/commands/upgrade.doc.mjs +2 -1
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +2 -0
- package/clients/cli/formatters/index.test.mjs +6 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +3 -2
- package/foundation/discovery/docs-discovery.mjs +6 -5
- package/foundation/discovery/docs-discovery.test.mjs +7 -10
- package/foundation/discovery/docs-section-key.d.mts +19 -8
- package/foundation/discovery/docs-section-key.mjs +119 -32
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/doc-compiler/compile.mjs +5 -4
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +10 -0
- package/foundation/response/error-codes.mjs +6 -0
- package/foundation/response/error-codes.test.mjs +55 -11
- package/package.json +10 -9
|
@@ -134,32 +134,30 @@ describe('NamespaceDoc', () => {
|
|
|
134
134
|
});
|
|
135
135
|
});
|
|
136
136
|
|
|
137
|
-
describe('semantic blocks
|
|
138
|
-
it('
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
'workflow',
|
|
155
|
-
'collection',
|
|
156
|
-
'reference',
|
|
157
|
-
]);
|
|
137
|
+
describe('semantic graph blocks', () => {
|
|
138
|
+
it('keeps graph-only blocks out of the stable ReferenceDoc section union', () => {
|
|
139
|
+
expect(() =>
|
|
140
|
+
parseReference({
|
|
141
|
+
type: 'generic',
|
|
142
|
+
name: 'publishing',
|
|
143
|
+
title: 'Publishing',
|
|
144
|
+
description: 'Publish an integration.',
|
|
145
|
+
sections: [
|
|
146
|
+
{
|
|
147
|
+
id: 'start',
|
|
148
|
+
title: 'Start',
|
|
149
|
+
content: namespaceDoc.blocks,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
}),
|
|
153
|
+
).toThrow(/Invalid discriminator value/u);
|
|
158
154
|
});
|
|
159
155
|
|
|
160
|
-
it('
|
|
161
|
-
expect(
|
|
162
|
-
|
|
163
|
-
|
|
156
|
+
it('keeps shape-sniffing an unknown stamp for 0.6.x compatibility', () => {
|
|
157
|
+
expect(parseDoc({type: 'choice', name: 'x', props: []})).toMatchObject({
|
|
158
|
+
type: 'choice',
|
|
159
|
+
name: 'x',
|
|
160
|
+
props: [],
|
|
161
|
+
});
|
|
164
162
|
});
|
|
165
163
|
});
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type {AuthoredDocGraphFields, AuthoredDocKind} from '../base/type.js';
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
GraphContentBlock,
|
|
12
|
+
ReferenceContentBlock,
|
|
13
|
+
} from '../reference/type.js';
|
|
11
14
|
|
|
12
15
|
/** Which providers may contribute appearances to a namespace slot. */
|
|
13
16
|
export type NamespaceProviderScope = 'same' | 'configured';
|
|
@@ -67,5 +70,5 @@ export interface NamespaceDoc extends AuthoredDocGraphFields {
|
|
|
67
70
|
/** Optional source-adoption rules for otherwise-unplaced docs. */
|
|
68
71
|
adopts?: NamespaceAdoptionRule[];
|
|
69
72
|
/** Ordered renderer-neutral content and collection blocks. */
|
|
70
|
-
blocks?: ReferenceContentBlock[];
|
|
73
|
+
blocks?: (ReferenceContentBlock | GraphContentBlock)[];
|
|
71
74
|
}
|
|
@@ -67,8 +67,9 @@ export function parseDoc(input, label = 'doc') {
|
|
|
67
67
|
case 'theme':
|
|
68
68
|
return parseTheme(input, label);
|
|
69
69
|
case undefined:
|
|
70
|
-
return parseLegacyDoc(input, label);
|
|
71
70
|
default:
|
|
72
|
-
|
|
71
|
+
// 0.6.x shape-sniffed unknown stamps. Keep accepting them through the
|
|
72
|
+
// patch compatibility window; canonical writers emit a known stamp.
|
|
73
|
+
return parseLegacyDoc(input, label);
|
|
73
74
|
}
|
|
74
75
|
}
|
|
@@ -95,7 +95,7 @@ export const doc = {
|
|
|
95
95
|
name: 'sections[].content',
|
|
96
96
|
type: 'ReferenceContentBlock[]',
|
|
97
97
|
description:
|
|
98
|
-
'Ordered content blocks: prose, heading, code, table, list, and token-ref. workflow, collection, and reference are
|
|
98
|
+
'Ordered content blocks: prose, heading, code, table, list, and token-ref. Graph-only workflow, collection, and reference blocks are available through GraphContentBlock on NamespaceDoc, without widening this stable union.',
|
|
99
99
|
required: true,
|
|
100
100
|
},
|
|
101
101
|
{
|
|
@@ -144,7 +144,7 @@ export const docs = {
|
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
type: 'prose',
|
|
147
|
-
text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock,
|
|
147
|
+
text: 'Each `sections[].content` is an ordered array of ReferenceContentBlock, the stable discriminated union of prose, heading, code, table, list, and token-ref. Docs-graph-only workflow, collection, and reference blocks are exported separately as GraphContentBlock and accepted by NamespaceDoc. choice, callout, and checklist remain invalid. ReferenceContentBlock is also reused by the `notes` field on SchemaDoc and CommandDoc.',
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
type: 'code',
|
|
@@ -156,7 +156,9 @@ export const docs = {
|
|
|
156
156
|
| { type: 'code'; lang: string; code: string; label?: string }
|
|
157
157
|
| { type: 'table'; headers: string[]; rows: string[][] }
|
|
158
158
|
| { type: 'list'; style: 'ordered' | 'unordered' | 'do' | 'dont'; items: string[] }
|
|
159
|
-
| { type: 'token-ref'; topic: string; section: string }
|
|
159
|
+
| { type: 'token-ref'; topic: string; section: string };
|
|
160
|
+
|
|
161
|
+
type GraphContentBlock =
|
|
160
162
|
| { type: 'workflow'; title?: string; steps: WorkflowStep[] }
|
|
161
163
|
| { type: 'collection'; source: {slot: string}; presentation?: 'list' | 'cards' | 'compact'; whenEmpty?: 'show' | 'omit' }
|
|
162
164
|
| { type: 'reference'; target: string; projection?: {fields?: string[]; sections?: string[]} };`,
|
|
@@ -41,8 +41,13 @@ export interface ReferenceDocBlock {
|
|
|
41
41
|
presentation?: 'summary' | 'compact' | 'full';
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/** Graph-only content blocks. These are additive and do not widen the stable
|
|
45
|
+
* {@link ReferenceContentBlock} union consumed by existing exhaustive renderers. */
|
|
46
|
+
export type GraphContentBlock =
|
|
47
|
+
WorkflowDocBlock | CollectionDocBlock | ReferenceDocBlock;
|
|
48
|
+
|
|
44
49
|
/**
|
|
45
|
-
* A content block within a reference doc section
|
|
50
|
+
* A content block within a reference doc section.
|
|
46
51
|
* Ordered arrays of these blocks form renderer-neutral documentation content.
|
|
47
52
|
* A new semantic kind must ship with every renderer or fail visibly at a legacy
|
|
48
53
|
* reader boundary until that renderer is available.
|
|
@@ -55,9 +60,6 @@ export interface ReferenceDocBlock {
|
|
|
55
60
|
* { type: 'table', headers: ['Token', 'Value'], rows: [['--spacing-4', '16px']] }
|
|
56
61
|
* { type: 'list', style: 'do', items: ['Use semantic tokens'] }
|
|
57
62
|
* { type: 'token-ref', topic: 'tokens', section: 'Color Tokens' }
|
|
58
|
-
* { type: 'workflow', steps: [{title: 'Validate', references: ['command:doctor']}] }
|
|
59
|
-
* { type: 'collection', source: {slot: 'guides'}, presentation: 'cards' }
|
|
60
|
-
* { type: 'reference', target: 'schema:integration', projection: {fields: ['docs']} }
|
|
61
63
|
* ```
|
|
62
64
|
*/
|
|
63
65
|
export type ReferenceContentBlock =
|
|
@@ -80,10 +82,7 @@ export type ReferenceContentBlock =
|
|
|
80
82
|
topic: string;
|
|
81
83
|
/** Section title to pull from that topic. e.g. `'Color Tokens'` */
|
|
82
84
|
section: string;
|
|
83
|
-
}
|
|
84
|
-
| WorkflowDocBlock
|
|
85
|
-
| CollectionDocBlock
|
|
86
|
-
| ReferenceDocBlock;
|
|
85
|
+
};
|
|
87
86
|
|
|
88
87
|
/**
|
|
89
88
|
* A reference documentation file (.doc.mjs).
|
package/authoring/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
33
33
|
import {spawn} from 'node:child_process';
|
|
34
34
|
import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
|
|
35
35
|
import {jsonOut} from '../../../foundation/response/json.mjs';
|
|
36
|
-
import {emit, section, text, list, code} from '../formatters/index.mjs';
|
|
36
|
+
import {emit, section, text, list, records, code} from '../formatters/index.mjs';
|
|
37
37
|
import {logger} from '../../../api/logger.mjs';
|
|
38
38
|
import {cliError} from '../lib/cli-error.mjs';
|
|
39
39
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
@@ -229,47 +229,6 @@ function printThemeList(themes) {
|
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
/**
|
|
233
|
-
* Render the targets as one greppable line each, under an aligned header. A
|
|
234
|
-
* `records()` block would be five lines per target — over a thousand for the
|
|
235
|
-
* full surface, which is the view this command exists to make readable.
|
|
236
|
-
* @param {import('../../../api/theme/theme.type.mjs').ThemeTargetEntry[]} targets
|
|
237
|
-
* @returns {string}
|
|
238
|
-
*/
|
|
239
|
-
function formatTargetsTable(targets) {
|
|
240
|
-
const rows = targets.map(t => ({
|
|
241
|
-
key: t.deprecatedFor
|
|
242
|
-
? `${t.key} [deprecated; use ${t.deprecatedFor}]`
|
|
243
|
-
: t.key,
|
|
244
|
-
component: t.component,
|
|
245
|
-
props: t.props.join(', ') || '-',
|
|
246
|
-
states: t.states.join(', ') || '-',
|
|
247
|
-
}));
|
|
248
|
-
const head = {
|
|
249
|
-
key: 'key',
|
|
250
|
-
component: 'component',
|
|
251
|
-
props: 'props',
|
|
252
|
-
states: 'states',
|
|
253
|
-
};
|
|
254
|
-
const width = (/** @type {'key'|'component'|'props'} */ field) =>
|
|
255
|
-
[head, ...rows].reduce((max, r) => Math.max(max, r[field].length), 0);
|
|
256
|
-
const w = {
|
|
257
|
-
key: width('key'),
|
|
258
|
-
component: width('component'),
|
|
259
|
-
props: width('props'),
|
|
260
|
-
};
|
|
261
|
-
const line = (/** @type {typeof head} */ r) =>
|
|
262
|
-
[
|
|
263
|
-
r.key.padEnd(w.key),
|
|
264
|
-
r.component.padEnd(w.component),
|
|
265
|
-
r.props.padEnd(w.props),
|
|
266
|
-
r.states,
|
|
267
|
-
]
|
|
268
|
-
.join(' ')
|
|
269
|
-
.trimEnd();
|
|
270
|
-
return [line(head), ...rows.map(line)].join('\n');
|
|
271
|
-
}
|
|
272
|
-
|
|
273
232
|
/**
|
|
274
233
|
* @param {import('commander').Command} program
|
|
275
234
|
*/
|
|
@@ -811,9 +770,16 @@ export function registerTheme(program) {
|
|
|
811
770
|
emit(
|
|
812
771
|
section(
|
|
813
772
|
'Theming targets',
|
|
814
|
-
`${targets.length} across ${componentCount} component${componentCount === 1 ? '' : 's'}`,
|
|
773
|
+
`${targets.length} across ${componentCount} component${componentCount === 1 ? '' : 's'}\n(key - component - props - states - className - deprecatedFor)`,
|
|
815
774
|
),
|
|
816
|
-
|
|
775
|
+
records(targets, {
|
|
776
|
+
fields: ['key', 'component', 'props', 'states', 'className', 'deprecatedFor'],
|
|
777
|
+
layout: 'inline',
|
|
778
|
+
format: {
|
|
779
|
+
deprecatedFor: (/** @type {string|null} */ v) =>
|
|
780
|
+
v ? `deprecated; use ${v}` : '',
|
|
781
|
+
},
|
|
782
|
+
}),
|
|
817
783
|
text(
|
|
818
784
|
[
|
|
819
785
|
`Each key goes under \`components\` in defineTheme; it paints \`.astryx-<key>\`.`,
|
|
@@ -23,8 +23,6 @@ import {
|
|
|
23
23
|
text,
|
|
24
24
|
code,
|
|
25
25
|
wrapText,
|
|
26
|
-
displayWidth,
|
|
27
|
-
WRAP_WIDTH,
|
|
28
26
|
} from '../formatters/index.mjs';
|
|
29
27
|
import {cliError} from '../lib/cli-error.mjs';
|
|
30
28
|
import {defineCommand} from '../lib/define-command.mjs';
|
|
@@ -52,28 +50,6 @@ function formatTable(headers, rows) {
|
|
|
52
50
|
return `${head}\n${sep}\n${body}`;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
/**
|
|
56
|
-
* A table too wide for {@link WRAP_WIDTH}: one `header: cell` line per cell and
|
|
57
|
-
* a blank line between rows, so nothing runs off the side of a terminal.
|
|
58
|
-
* @param {string[]} headers
|
|
59
|
-
* @param {string[][]} rows
|
|
60
|
-
* @returns {string}
|
|
61
|
-
*/
|
|
62
|
-
function formatTableVertical(headers, rows) {
|
|
63
|
-
const width = Math.max(...headers.map(h => h.length)) + 2;
|
|
64
|
-
return rows
|
|
65
|
-
.map(row =>
|
|
66
|
-
headers
|
|
67
|
-
.map((h, i) =>
|
|
68
|
-
wrapText(`${`${h}:`.padEnd(width)}${row[i] ?? ''}`, {
|
|
69
|
-
indent: ' '.repeat(width),
|
|
70
|
-
}),
|
|
71
|
-
)
|
|
72
|
-
.join('\n'),
|
|
73
|
-
)
|
|
74
|
-
.join('\n\n');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
53
|
/**
|
|
78
54
|
* @param {string[]} headers
|
|
79
55
|
* @param {string[][]} rows
|
|
@@ -91,7 +67,7 @@ function formatTableCompact(headers, rows) {
|
|
|
91
67
|
function formatBlock(block, detail) {
|
|
92
68
|
switch (block.type) {
|
|
93
69
|
case 'prose':
|
|
94
|
-
return
|
|
70
|
+
return block.text;
|
|
95
71
|
|
|
96
72
|
case 'heading':
|
|
97
73
|
return `${'#'.repeat(block.level || 3)} ${block.text}`;
|
|
@@ -110,12 +86,7 @@ function formatBlock(block, detail) {
|
|
|
110
86
|
if (detail === 'compact') {
|
|
111
87
|
return formatTableCompact(block.headers, block.rows);
|
|
112
88
|
}
|
|
113
|
-
|
|
114
|
-
const table = formatTable(block.headers, block.rows);
|
|
115
|
-
return table.split('\n').some(line => displayWidth(line) > WRAP_WIDTH)
|
|
116
|
-
? formatTableVertical(block.headers, block.rows)
|
|
117
|
-
: table;
|
|
118
|
-
}
|
|
89
|
+
return formatTable(block.headers, block.rows);
|
|
119
90
|
|
|
120
91
|
case 'list': {
|
|
121
92
|
const prefix =
|
|
@@ -126,21 +97,9 @@ function formatBlock(block, detail) {
|
|
|
126
97
|
: block.style === 'do'
|
|
127
98
|
? () => '+ '
|
|
128
99
|
: () => '- ';
|
|
129
|
-
return block.items
|
|
130
|
-
.map((item, i) => {
|
|
131
|
-
const head = prefix(i);
|
|
132
|
-
return wrapText(`${head}${item}`, {indent: ' '.repeat(head.length)});
|
|
133
|
-
})
|
|
134
|
-
.join('\n');
|
|
100
|
+
return block.items.map((item, i) => `${prefix(i)}${item}`).join('\n');
|
|
135
101
|
}
|
|
136
102
|
|
|
137
|
-
case 'workflow':
|
|
138
|
-
case 'collection':
|
|
139
|
-
case 'reference':
|
|
140
|
-
throw new Error(
|
|
141
|
-
`Documentation block "${block.type}" requires the compiled graph renderer.`,
|
|
142
|
-
);
|
|
143
|
-
|
|
144
103
|
default:
|
|
145
104
|
return null;
|
|
146
105
|
}
|
|
@@ -173,16 +132,15 @@ function formatSection(section, detail) {
|
|
|
173
132
|
*/
|
|
174
133
|
function formatReferenceFull(docs, detail) {
|
|
175
134
|
if (detail === 'brief') {
|
|
176
|
-
const header =
|
|
135
|
+
const header = `${docs.title}: ${docs.description}`;
|
|
177
136
|
const sections = docs.sections.map(s => formatSection(s, detail));
|
|
178
137
|
return `${header}\n${sections.join('\n')}`;
|
|
179
138
|
}
|
|
180
139
|
|
|
181
|
-
const description = wrapText(docs.description);
|
|
182
140
|
const header =
|
|
183
141
|
detail === 'compact'
|
|
184
|
-
? `# ${docs.title}\n${description}`
|
|
185
|
-
: `# ${docs.title}\n\n${description}`;
|
|
142
|
+
? `# ${docs.title}\n${docs.description}`
|
|
143
|
+
: `# ${docs.title}\n\n${docs.description}`;
|
|
186
144
|
const sections = docs.sections.map(s => formatSection(s, detail));
|
|
187
145
|
const sep = detail === 'compact' ? '\n\n' : '\n\n';
|
|
188
146
|
return `${header}\n\n${sections.join(sep)}`;
|
|
@@ -196,7 +154,10 @@ function formatReferenceFull(docs, detail) {
|
|
|
196
154
|
*/
|
|
197
155
|
function emitIndex(index, run) {
|
|
198
156
|
emit(
|
|
199
|
-
section(
|
|
157
|
+
section(
|
|
158
|
+
index.title,
|
|
159
|
+
index.description ? wrapText(index.description) : undefined,
|
|
160
|
+
),
|
|
200
161
|
records(index.sections, {
|
|
201
162
|
fields: ['id', 'title', 'summary'],
|
|
202
163
|
layout: 'inline',
|
|
@@ -275,19 +236,15 @@ export function registerDocs(program) {
|
|
|
275
236
|
|
|
276
237
|
switch (result.type) {
|
|
277
238
|
case 'docs.list': {
|
|
278
|
-
//
|
|
279
|
-
// description
|
|
239
|
+
// Keep the published 0.6 text projection: stacked topic and
|
|
240
|
+
// description fields, followed by the two original usage lines.
|
|
280
241
|
emit(
|
|
281
242
|
section('Available docs'),
|
|
282
|
-
records(result.data, {
|
|
283
|
-
fields: ['topic', 'description'],
|
|
284
|
-
layout: 'inline',
|
|
285
|
-
}),
|
|
243
|
+
records(result.data, {fields: ['topic', 'description']}),
|
|
286
244
|
text(
|
|
287
245
|
[
|
|
288
|
-
`Usage: ${run} docs <topic
|
|
289
|
-
` ${run} docs <topic>
|
|
290
|
-
` ${run} docs <topic> <section> read one section`,
|
|
246
|
+
`Usage: ${run} docs <topic>`,
|
|
247
|
+
` ${run} docs <topic> <section>`,
|
|
291
248
|
].join('\n'),
|
|
292
249
|
),
|
|
293
250
|
);
|
|
@@ -108,11 +108,11 @@ describe('progressive reads', () => {
|
|
|
108
108
|
/** @param {string} out */
|
|
109
109
|
const widest = out => Math.max(...out.split('\n').map(line => line.length));
|
|
110
110
|
|
|
111
|
-
it('
|
|
111
|
+
it('keeps the 0.6.x stacked topic list', async () => {
|
|
112
112
|
const {status, stdout} = await runCli(['docs']);
|
|
113
113
|
expect(status).toBe(0);
|
|
114
|
-
expect(stdout).toMatch(/^principles
|
|
115
|
-
expect(
|
|
114
|
+
expect(stdout).toMatch(/^topic: +principles$/m);
|
|
115
|
+
expect(stdout).toContain('Usage: pnpm exec astryx docs <topic>');
|
|
116
116
|
}, SLOW);
|
|
117
117
|
|
|
118
118
|
it("prints a topic's section index with the keys to read by", async () => {
|
|
@@ -139,9 +139,6 @@ describe('progressive reads', () => {
|
|
|
139
139
|
expect((await runCli(['--detail', 'full', 'docs', 'theme'])).stdout).toBe(
|
|
140
140
|
full.stdout,
|
|
141
141
|
);
|
|
142
|
-
expect(widest(full.stdout.replace(/```[\s\S]*?```/g, ''))).toBeLessThanOrEqual(
|
|
143
|
-
120,
|
|
144
|
-
);
|
|
145
142
|
}, SLOW);
|
|
146
143
|
|
|
147
144
|
it('returns the matching envelopes as JSON', async () => {
|
|
@@ -176,14 +173,14 @@ describe('text width in every language', () => {
|
|
|
176
173
|
return max;
|
|
177
174
|
};
|
|
178
175
|
|
|
179
|
-
it
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
176
|
+
it('keeps the additive section index within 120 columns', async () => {
|
|
177
|
+
const {status, stdout} = await runCli([
|
|
178
|
+
'docs',
|
|
179
|
+
'theme',
|
|
180
|
+
'--index',
|
|
181
|
+
'--lang',
|
|
182
|
+
'zh',
|
|
183
|
+
]);
|
|
187
184
|
expect(status).toBe(0);
|
|
188
185
|
expect(widest(stdout)).toBeLessThanOrEqual(120);
|
|
189
186
|
}, SLOW);
|