@astryxdesign/cli 0.7.2-canary.6a3ff0f → 0.7.2-canary.6c792d8
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 +62 -62
- package/api/component/_adapter.d.mts +31 -0
- package/api/component/_adapter.mjs +116 -0
- package/api/component/component.mjs +60 -10
- package/api/component/doc-links.test.mjs +386 -0
- package/api/discover/_adapter.d.mts +119 -12
- package/api/discover/_adapter.mjs +449 -10
- package/api/discover/_adapter.test.mjs +599 -17
- package/api/discover/_catalog-view.d.mts +16 -5
- package/api/discover/_catalog-view.mjs +32 -8
- package/api/discover/detail/doc/doc.mjs +9 -1
- package/api/discover/discover.d.mts +11 -0
- package/api/discover/discover.doc.mjs +7 -6
- package/api/discover/discover.mjs +107 -19
- package/api/discover/discover.type.d.mts +18 -7
- package/api/discover/discover.type.mjs +15 -7
- package/api/discover/list/list.d.mts +4 -3
- package/api/discover/list/list.mjs +17 -10
- package/api/docs/_adapter.d.mts +63 -0
- package/api/docs/_adapter.mjs +309 -16
- package/api/docs/integration-tree.test.mjs +22 -0
- package/api/docs/list/list.mjs +12 -2
- package/api/doctor/theme-checks.test.mjs +136 -0
- package/api/integration/_adapter.d.mts +33 -0
- package/api/integration/_adapter.mjs +58 -0
- package/api/integration/authoring-checks.mjs +98 -3
- package/api/integration/authoring-checks.test.mjs +769 -0
- package/api/integration/authoring-checks.type.d.mts +134 -0
- package/api/integration/authoring-checks.type.mjs +60 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +3 -1
- package/api/integration/integrationDocConflicts.doc.mjs +22 -5
- package/api/integration/pack-check.mjs +296 -7
- package/api/integration/pack-check.test.mjs +367 -0
- package/api/integration/validate-integration-fixes.test.mjs +67 -0
- package/api/integration/validate-integration.mjs +28 -3
- package/api/integration/validate-integration.test.mjs +77 -8
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/search.mjs +2 -1
- package/assets/discover/official-packages.json +367 -0
- package/assets/docs/author-a-theme.doc.mjs +2 -2
- package/assets/docs/browser-support.doc.mjs +1 -1
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +3 -3
- package/assets/docs/tree/check-the-props.doc.mjs +7 -2
- package/assets/docs/tree/check-your-docs.doc.mjs +15 -3
- package/assets/docs/tree/checks.doc.mjs +5 -5
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +7 -7
- package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
- package/assets/docs/tree/layout.doc.mjs +6 -6
- package/assets/docs/tree/migration-setup.doc.mjs +2 -2
- package/assets/docs/tree/publishing.doc.mjs +3 -3
- package/assets/docs/tree/quick-start.doc.mjs +2 -2
- package/assets/docs/tree/sections-and-placement.doc.mjs +2 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/troubleshooting.doc.mjs +5 -5
- package/assets/docs/tree/upgrading.doc.mjs +1 -1
- package/authoring/discover/discover.doc.mjs +1 -1
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -0
- package/authoring/doctypes/hook/type.ts +4 -0
- package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/discover.mjs +144 -93
- package/clients/cli/commands/discover.no-source.test.mjs +447 -33
- package/clients/cli/commands/discover.sources.test.mjs +20 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +3 -2
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +19 -5
- package/clients/cli/commands/doctor-integration.test.mjs +48 -1
- package/clients/cli/commands/doctor.mjs +91 -5
- package/clients/cli/commands/integration-authoring.test.mjs +46 -0
- package/clients/cli/commands/integration-check.test.mjs +127 -0
- package/clients/cli/commands/integration.mjs +10 -4
- package/clients/cli/commands/json-contract.test.mjs +5 -1
- package/foundation/discovery/copied-passages.d.mts +216 -0
- package/foundation/discovery/copied-passages.mjs +720 -0
- package/foundation/discovery/copied-passages.test.mjs +124 -0
- package/foundation/discovery/doc-consistency.d.mts +34 -0
- package/foundation/discovery/doc-consistency.mjs +513 -0
- package/foundation/discovery/doc-consistency.test.mjs +347 -0
- package/foundation/discovery/doc-fluff.d.mts +112 -0
- package/foundation/discovery/doc-fluff.mjs +328 -0
- package/foundation/discovery/doc-fluff.test.mjs +142 -0
- package/foundation/discovery/doc-types.mjs +12 -5
- package/foundation/discovery/doc-types.test.mjs +46 -2
- package/foundation/discovery/docs-discovery.d.mts +7 -0
- package/foundation/discovery/docs-discovery.mjs +26 -2
- package/foundation/discovery/prop-drift.d.mts +25 -6
- package/foundation/discovery/prop-drift.mjs +171 -6
- package/foundation/discovery/prop-drift.test.mjs +65 -0
- package/foundation/discovery/stray-pointers.d.mts +52 -0
- package/foundation/discovery/stray-pointers.mjs +293 -0
- package/foundation/discovery/stray-pointers.test.mjs +86 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +16 -0
- package/foundation/doc-compiler/links.d.mts +32 -0
- package/foundation/doc-compiler/links.mjs +163 -26
- package/foundation/doc-compiler/links.test.mjs +97 -4
- package/foundation/doc-compiler/tree.mjs +30 -1
- package/foundation/doc-compiler/tree.test.mjs +7 -0
- package/foundation/fs/module-loader.d.mts +2 -1
- package/foundation/fs/module-loader.mjs +60 -4
- package/foundation/fs/module-loader.test.mjs +194 -0
- package/foundation/integrations/contribution-inventory.d.mts +11 -0
- package/foundation/integrations/contribution-inventory.mjs +50 -2
- package/foundation/integrations/issue.ts +6 -0
- package/foundation/integrations/validate-contributions.mjs +30 -1
- package/foundation/response/response-types.doc.mjs +5 -5
- package/package.json +11 -11
|
@@ -340,6 +340,142 @@ describe('app-theme doctor checks', () => {
|
|
|
340
340
|
expect(result.message).not.toMatch(/\n\s+at /u);
|
|
341
341
|
});
|
|
342
342
|
|
|
343
|
+
it('passes theme-owners when a built module imports its stylesheet', async () => {
|
|
344
|
+
const {dir, packageDir} = await fixture();
|
|
345
|
+
write(
|
|
346
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
347
|
+
"import './ocean.css';\nimport '@acme/themes/themes/ocean.css';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
const checks = await checkAppThemes(dir);
|
|
351
|
+
|
|
352
|
+
expect(checks.map(item => item.status)).toEqual(Array(10).fill('pass'));
|
|
353
|
+
expect(check(checks, 'theme-owners').message).toContain(
|
|
354
|
+
'every built module loads',
|
|
355
|
+
);
|
|
356
|
+
const cli = runDoctor(dir);
|
|
357
|
+
expect(cli.status).toBe(0);
|
|
358
|
+
expect(cli.stdout).not.toContain('could not load its built module');
|
|
359
|
+
}, 30_000);
|
|
360
|
+
|
|
361
|
+
it('passes every check for an entry that loads its fonts and stylesheet and re-exports the built module', async () => {
|
|
362
|
+
const {dir, packageDir} = await fixture([
|
|
363
|
+
{
|
|
364
|
+
slug: 'ocean',
|
|
365
|
+
fontFamily: 'Ocean Sans',
|
|
366
|
+
fontCss:
|
|
367
|
+
"@font-face { font-family: 'Ocean Sans'; src: local('Ocean Sans'); }\n",
|
|
368
|
+
},
|
|
369
|
+
]);
|
|
370
|
+
write(
|
|
371
|
+
path.join(packageDir, 'dist/ocean.built.js'),
|
|
372
|
+
"export const oceanTheme = {name: 'ocean', tokens: {}, fontFamily: 'Ocean Sans'};\n",
|
|
373
|
+
);
|
|
374
|
+
write(
|
|
375
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
376
|
+
"import './ocean.fonts.css';\nimport '@acme/themes/themes/ocean.css';\nexport {oceanTheme} from './ocean.built.js';\n",
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
const checks = await checkAppThemes(dir);
|
|
380
|
+
|
|
381
|
+
expect(checks.map(item => [item.id, item.status])).toEqual(
|
|
382
|
+
checks.map(item => [item.id, 'pass']),
|
|
383
|
+
);
|
|
384
|
+
expect(checks).toHaveLength(10);
|
|
385
|
+
const cli = runDoctor(dir);
|
|
386
|
+
expect(cli.status).toBe(0);
|
|
387
|
+
expect(cli.stdout).not.toContain('could not load its built module');
|
|
388
|
+
}, 30_000);
|
|
389
|
+
|
|
390
|
+
it('passes every check for an entry that re-exports a theme whose own name differs from its slug', async () => {
|
|
391
|
+
const {dir, packageDir} = await fixture([
|
|
392
|
+
{
|
|
393
|
+
slug: 'ocean',
|
|
394
|
+
css: '[data-astryx-theme="deep-sea"] { --color-text: black; }\n',
|
|
395
|
+
fontFamily: 'Ocean Sans',
|
|
396
|
+
fontCss:
|
|
397
|
+
"@font-face { font-family: 'Ocean Sans'; src: local('Ocean Sans'); }\n",
|
|
398
|
+
},
|
|
399
|
+
]);
|
|
400
|
+
write(
|
|
401
|
+
path.join(packageDir, 'dist/deep-sea.js'),
|
|
402
|
+
"export const deepSeaTheme = {name: 'deep-sea', tokens: {}, fontFamily: 'Ocean Sans'};\n",
|
|
403
|
+
);
|
|
404
|
+
write(
|
|
405
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
406
|
+
"import './ocean.fonts.css';\nimport './ocean.css';\nexport {deepSeaTheme as oceanTheme} from './deep-sea.js';\n",
|
|
407
|
+
);
|
|
408
|
+
|
|
409
|
+
const checks = await checkAppThemes(dir);
|
|
410
|
+
|
|
411
|
+
expect(checks.map(item => [item.id, item.status])).toEqual(
|
|
412
|
+
checks.map(item => [item.id, 'pass']),
|
|
413
|
+
);
|
|
414
|
+
expect(checks).toHaveLength(10);
|
|
415
|
+
}, 30_000);
|
|
416
|
+
|
|
417
|
+
it.each([
|
|
418
|
+
[
|
|
419
|
+
'a missing dependency',
|
|
420
|
+
"import '@acme/definitely-missing-dep';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
421
|
+
'@acme/definitely-missing-dep',
|
|
422
|
+
],
|
|
423
|
+
[
|
|
424
|
+
'a throwing module',
|
|
425
|
+
"throw new Error('broken theme module');\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
426
|
+
'broken theme module',
|
|
427
|
+
],
|
|
428
|
+
])(
|
|
429
|
+
'still fails theme-owners when a built module imports its stylesheet and has %s',
|
|
430
|
+
async (_label, rest, detail) => {
|
|
431
|
+
const {dir, packageDir} = await fixture();
|
|
432
|
+
write(
|
|
433
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
434
|
+
`import './ocean.css';\n${rest}`,
|
|
435
|
+
);
|
|
436
|
+
|
|
437
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
438
|
+
|
|
439
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
440
|
+
expect(result.message).toContain(
|
|
441
|
+
'Theme "ocean" from @acme/themes could not load its built module',
|
|
442
|
+
);
|
|
443
|
+
expect(result.message).toContain(detail);
|
|
444
|
+
},
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
it("still fails theme-owners when the theme's stylesheet export is missing", async () => {
|
|
448
|
+
const {dir, packageDir} = await fixture();
|
|
449
|
+
write(
|
|
450
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
451
|
+
"import './ocean.css';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
452
|
+
);
|
|
453
|
+
fs.rmSync(path.join(packageDir, 'dist/ocean.css'));
|
|
454
|
+
|
|
455
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
456
|
+
|
|
457
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
458
|
+
expect(result.message).toContain(
|
|
459
|
+
'Missing stylesheet export @acme/themes/themes/ocean.css',
|
|
460
|
+
);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
it('still fails theme-owners when another stylesheet the built module imports is missing', async () => {
|
|
464
|
+
const {dir, packageDir} = await fixture();
|
|
465
|
+
write(
|
|
466
|
+
path.join(packageDir, 'dist/ocean.js'),
|
|
467
|
+
"import './ocean.css';\nimport './fonts.css';\nexport const oceanTheme = {name: 'ocean', tokens: {}};\n",
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
const result = check(await checkAppThemes(dir), 'theme-owners');
|
|
471
|
+
|
|
472
|
+
expect(result).toMatchObject({id: 'theme-owners', status: 'fail'});
|
|
473
|
+
expect(result.message).toContain(
|
|
474
|
+
'Theme "ocean" from @acme/themes could not load its built module',
|
|
475
|
+
);
|
|
476
|
+
expect(result.message).toContain('fonts.css');
|
|
477
|
+
});
|
|
478
|
+
|
|
343
479
|
it('fails theme-owners for an ambiguous multi-theme record', async () => {
|
|
344
480
|
const {dir, packageDir} = await fixture([{slug: 'ocean'}, {slug: 'reef'}]);
|
|
345
481
|
const packageFile = path.join(packageDir, 'package.json');
|
|
@@ -10,3 +10,36 @@
|
|
|
10
10
|
* @returns {Promise<import('../../foundation/discovery/prop-drift.mjs').PropDriftReport>}
|
|
11
11
|
*/
|
|
12
12
|
export function integrationPropDrift(integration: any, cwd: string): Promise<import("../../foundation/discovery/prop-drift.mjs").PropDriftReport>;
|
|
13
|
+
/**
|
|
14
|
+
* The passages two of a package's topics, or one of them and a Core topic,
|
|
15
|
+
* repeat word for word (architecture:cli-surface DEC-8). Reads the package's
|
|
16
|
+
* topics and Core's guides.
|
|
17
|
+
*
|
|
18
|
+
* @param {Parameters<typeof findCopiedPassages>[0]} discovered the package's
|
|
19
|
+
* docs, as discoverIntegrationDocs returns them
|
|
20
|
+
*/
|
|
21
|
+
export function integrationCopiedPassages(discovered: Parameters<typeof findCopiedPassages>[0]): Promise<import("./authoring-checks.type.mjs").CopiedPassage[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Padding phrases and low-density topics in a package's prose
|
|
24
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, and Core's
|
|
25
|
+
* guides for the density median a finding names.
|
|
26
|
+
*
|
|
27
|
+
* @param {Parameters<typeof findFluff>[0]} discovered the package's docs, as
|
|
28
|
+
* discoverIntegrationDocs returns them
|
|
29
|
+
*/
|
|
30
|
+
export function integrationFluff(discovered: Parameters<typeof findFluff>[0]): Promise<import("./authoring-checks.type.mjs").DocFluff[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Code spans in a package's prose that write `astryx docs <name>` for a doc
|
|
33
|
+
* that exists, where `{@link generic:<name>}` would be checked
|
|
34
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, its own
|
|
35
|
+
* component docs, and the names of Core's docs.
|
|
36
|
+
*
|
|
37
|
+
* @param {Parameters<typeof findStrayPointers>[0]} discovered the package's
|
|
38
|
+
* docs, as discoverIntegrationDocs returns them
|
|
39
|
+
* @param {any} [integration] the loaded integration, whose component docs are
|
|
40
|
+
* read too
|
|
41
|
+
*/
|
|
42
|
+
export function integrationStrayPointers(discovered: Parameters<typeof findStrayPointers>[0], integration?: any): Promise<import("./authoring-checks.type.mjs").StrayPointer[]>;
|
|
43
|
+
import { findCopiedPassages } from '../../foundation/discovery/copied-passages.mjs';
|
|
44
|
+
import { findFluff } from '../../foundation/discovery/doc-fluff.mjs';
|
|
45
|
+
import { findStrayPointers } from '../../foundation/discovery/stray-pointers.mjs';
|
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
integrationSourceForDoc,
|
|
16
16
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
17
17
|
import {comparePropDocs} from '../../foundation/discovery/prop-drift.mjs';
|
|
18
|
+
import {findCopiedPassages} from '../../foundation/discovery/copied-passages.mjs';
|
|
19
|
+
import {findFluff} from '../../foundation/discovery/doc-fluff.mjs';
|
|
20
|
+
import {findStrayPointers} from '../../foundation/discovery/stray-pointers.mjs';
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Each component doc's props compared with the component's TypeScript props,
|
|
@@ -52,3 +55,58 @@ export async function integrationPropDrift(integration, cwd) {
|
|
|
52
55
|
resolveFrom: [cwd, packageDir],
|
|
53
56
|
});
|
|
54
57
|
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The passages two of a package's topics, or one of them and a Core topic,
|
|
61
|
+
* repeat word for word (architecture:cli-surface DEC-8). Reads the package's
|
|
62
|
+
* topics and Core's guides.
|
|
63
|
+
*
|
|
64
|
+
* @param {Parameters<typeof findCopiedPassages>[0]} discovered the package's
|
|
65
|
+
* docs, as discoverIntegrationDocs returns them
|
|
66
|
+
*/
|
|
67
|
+
export function integrationCopiedPassages(discovered) {
|
|
68
|
+
return findCopiedPassages(discovered);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Padding phrases and low-density topics in a package's prose
|
|
73
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, and Core's
|
|
74
|
+
* guides for the density median a finding names.
|
|
75
|
+
*
|
|
76
|
+
* @param {Parameters<typeof findFluff>[0]} discovered the package's docs, as
|
|
77
|
+
* discoverIntegrationDocs returns them
|
|
78
|
+
*/
|
|
79
|
+
export function integrationFluff(discovered) {
|
|
80
|
+
return findFluff(discovered);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Code spans in a package's prose that write `astryx docs <name>` for a doc
|
|
85
|
+
* that exists, where `{@link generic:<name>}` would be checked
|
|
86
|
+
* (architecture:cli-surface DEC-8). Reads the package's topics, its own
|
|
87
|
+
* component docs, and the names of Core's docs.
|
|
88
|
+
*
|
|
89
|
+
* @param {Parameters<typeof findStrayPointers>[0]} discovered the package's
|
|
90
|
+
* docs, as discoverIntegrationDocs returns them
|
|
91
|
+
* @param {any} [integration] the loaded integration, whose component docs are
|
|
92
|
+
* read too
|
|
93
|
+
*/
|
|
94
|
+
export async function integrationStrayPointers(discovered, integration) {
|
|
95
|
+
/** @type {{name: string, file: string}[]} */
|
|
96
|
+
const components = [];
|
|
97
|
+
if (integration?.components) {
|
|
98
|
+
const seen = new Set();
|
|
99
|
+
try {
|
|
100
|
+
const {components: records} =
|
|
101
|
+
await discoverValidIntegrationComponents(integration);
|
|
102
|
+
for (const record of records) {
|
|
103
|
+
if (!record.docPath || seen.has(record.docPath)) continue;
|
|
104
|
+
seen.add(record.docPath);
|
|
105
|
+
components.push({name: record.name, file: record.docPath});
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
// `validate` reports component docs that do not load.
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return findStrayPointers({...discovered, components});
|
|
112
|
+
}
|
|
@@ -18,8 +18,10 @@
|
|
|
18
18
|
* @position Public integration-authoring API over private discovery adapters.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
import path from 'node:path';
|
|
21
22
|
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
22
23
|
import {
|
|
24
|
+
packageComponentLinkProblems,
|
|
23
25
|
packageDocsProblems,
|
|
24
26
|
packageReferenceProblems,
|
|
25
27
|
} from '../docs/_adapter.mjs';
|
|
@@ -29,7 +31,12 @@ import {
|
|
|
29
31
|
discoverOwnedComponents,
|
|
30
32
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
31
33
|
import {loadComponentReplacements} from '../component/_adapter.mjs';
|
|
32
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
integrationCopiedPassages,
|
|
36
|
+
integrationFluff,
|
|
37
|
+
integrationPropDrift,
|
|
38
|
+
integrationStrayPointers,
|
|
39
|
+
} from './_adapter.mjs';
|
|
33
40
|
import {
|
|
34
41
|
discoverBuiltinTopics,
|
|
35
42
|
discoverIntegrationDocs,
|
|
@@ -251,6 +258,19 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
251
258
|
// the project's own compiler; without one the report says it was skipped.
|
|
252
259
|
const propDrift = await integrationPropDrift(resolved.integration, cwd);
|
|
253
260
|
|
|
261
|
+
// A link in a component doc's text reads as the command that opens its doc,
|
|
262
|
+
// as one in a topic does; one that names no doc prints as written, so it is
|
|
263
|
+
// a warning (spec:AST-047 FR9). The package's own topics are linkable.
|
|
264
|
+
const ownDocs = resolved.integration.docs
|
|
265
|
+
? await discoverIntegrationDocs(resolved.integration)
|
|
266
|
+
: null;
|
|
267
|
+
for (const {severity, message} of await packageComponentLinkProblems(
|
|
268
|
+
resolved.integration,
|
|
269
|
+
ownDocs,
|
|
270
|
+
)) {
|
|
271
|
+
issues.push({code: 'invalid_doc_graph', severity, message});
|
|
272
|
+
}
|
|
273
|
+
|
|
254
274
|
const coreDir = findCoreDir(cwd);
|
|
255
275
|
if (!coreDir) {
|
|
256
276
|
issues.push({
|
|
@@ -323,10 +343,47 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
323
343
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
324
344
|
const issues = [...resolved.issues];
|
|
325
345
|
|
|
346
|
+
/** @type {import('./authoring-checks.type.mjs').CopiedPassage[]} */
|
|
347
|
+
const copiedPassages = [];
|
|
348
|
+
/** @type {import('./authoring-checks.type.mjs').DocFluff[]} */
|
|
349
|
+
const fluff = [];
|
|
350
|
+
/** @type {import('./authoring-checks.type.mjs').StrayPointer[]} */
|
|
351
|
+
const strayPointers = [];
|
|
352
|
+
// Like the other findings' `doc`, a fluff or stray-pointer `file` is
|
|
353
|
+
// relative to the package root.
|
|
354
|
+
const packageDir = /** @type {any} */ (resolved.integration)?.__packageDir;
|
|
355
|
+
const fromPackage = (/** @type {string} */ file) =>
|
|
356
|
+
typeof packageDir === 'string'
|
|
357
|
+
? path.relative(packageDir, file).split(path.sep).join('/')
|
|
358
|
+
: file;
|
|
326
359
|
if (!resolved.integration?.docs || name == null) {
|
|
360
|
+
// A package that ships components and no topics still has component docs
|
|
361
|
+
// a written pointer can sit in.
|
|
362
|
+
if (name != null && resolved.integration?.components) {
|
|
363
|
+
strayPointers.push(
|
|
364
|
+
...(
|
|
365
|
+
await integrationStrayPointers(
|
|
366
|
+
{records: [], guides: []},
|
|
367
|
+
resolved.integration,
|
|
368
|
+
)
|
|
369
|
+
).map(each => ({...each, file: fromPackage(each.file)})),
|
|
370
|
+
);
|
|
371
|
+
for (const {message} of strayPointers) {
|
|
372
|
+
issues.push({code: 'stray_doc_pointer', severity: 'warning', message});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
327
375
|
return {
|
|
328
376
|
type: 'integration.doc-conflicts',
|
|
329
|
-
data: {
|
|
377
|
+
data: {
|
|
378
|
+
validated,
|
|
379
|
+
name,
|
|
380
|
+
version,
|
|
381
|
+
findings: [],
|
|
382
|
+
copiedPassages,
|
|
383
|
+
fluff,
|
|
384
|
+
strayPointers,
|
|
385
|
+
issues,
|
|
386
|
+
},
|
|
330
387
|
};
|
|
331
388
|
}
|
|
332
389
|
|
|
@@ -416,10 +473,48 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
416
473
|
)) {
|
|
417
474
|
issues.push({code: 'invalid_doc_reference', severity: 'error', message});
|
|
418
475
|
}
|
|
476
|
+
|
|
477
|
+
// One fact has one owner: a passage two topics repeat goes stale in one
|
|
478
|
+
// of them. Each is listed and is a warning (architecture:cli-surface
|
|
479
|
+
// DEC-8), so `integration check --strict` fails until it is fixed;
|
|
480
|
+
// `doctor integration docs` keeps its exit code, as it fails on errors.
|
|
481
|
+
copiedPassages.push(...(await integrationCopiedPassages(discovered)));
|
|
482
|
+
for (const {message} of copiedPassages) {
|
|
483
|
+
issues.push({code: 'copied_passage', severity: 'warning', message});
|
|
484
|
+
}
|
|
485
|
+
// Docs should be dense: padding phrases and mostly-glue topics, listed
|
|
486
|
+
// and warned about the same way (DEC-8).
|
|
487
|
+
fluff.push(
|
|
488
|
+
...(await integrationFluff(discovered)).map(each => ({
|
|
489
|
+
...each,
|
|
490
|
+
file: fromPackage(each.file),
|
|
491
|
+
})),
|
|
492
|
+
);
|
|
493
|
+
for (const {message} of fluff) {
|
|
494
|
+
issues.push({code: 'doc_fluff', severity: 'warning', message});
|
|
495
|
+
}
|
|
496
|
+
// A pointer to a doc is a link, so doctor checks it (DEC-8).
|
|
497
|
+
strayPointers.push(
|
|
498
|
+
...(await integrationStrayPointers(discovered, resolved.integration)).map(
|
|
499
|
+
each => ({...each, file: fromPackage(each.file)}),
|
|
500
|
+
),
|
|
501
|
+
);
|
|
502
|
+
for (const {message} of strayPointers) {
|
|
503
|
+
issues.push({code: 'stray_doc_pointer', severity: 'warning', message});
|
|
504
|
+
}
|
|
419
505
|
}
|
|
420
506
|
|
|
421
507
|
return {
|
|
422
508
|
type: 'integration.doc-conflicts',
|
|
423
|
-
data: {
|
|
509
|
+
data: {
|
|
510
|
+
validated,
|
|
511
|
+
name,
|
|
512
|
+
version,
|
|
513
|
+
findings,
|
|
514
|
+
copiedPassages,
|
|
515
|
+
fluff,
|
|
516
|
+
strayPointers,
|
|
517
|
+
issues,
|
|
518
|
+
},
|
|
424
519
|
};
|
|
425
520
|
}
|