|
1 | 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
2 | 2 | // SPDX-License-Identifier: Apache-2.0 |
3 | 3 | const path = require('path'); |
4 | | -const { writeComponentsDocumentation, documentTestUtils } = require('@cloudscape-design/documenter'); |
5 | | -const { writeFile } = require('../utils/files'); |
| 4 | +const { writeComponentsDocumentation, writeTestUtilsDocumentation } = require('@cloudscape-design/documenter'); |
6 | 5 | const workspace = require('../utils/workspace'); |
7 | 6 |
|
8 | 7 | module.exports = function docs() { |
9 | 8 | writeComponentsDocumentation({ |
10 | 9 | outDir: path.join(workspace.apiDocsPath, 'components'), |
| 10 | + |
11 | 11 | tsconfigPath: require.resolve('../../tsconfig.json'), |
12 | 12 | publicFilesGlob: 'src/*/index.tsx', |
13 | 13 | extraExports: { |
14 | 14 | FileDropzone: ['useFilesDragging'], |
15 | 15 | TagEditor: ['getTagsDiff'], |
16 | 16 | }, |
17 | 17 | }); |
18 | | - testUtilDocs(); |
| 18 | + writeTestUtilsDocumentation({ |
| 19 | + outDir: path.join(workspace.apiDocsPath, 'test-utils-doc'), |
| 20 | + tsconfigPath: require.resolve('../../src/test-utils/tsconfig.json'), |
| 21 | + domUtils: { |
| 22 | + root: 'src/test-utils/dom/index.ts', |
| 23 | + extraExports: ['default', 'ElementWrapper'], |
| 24 | + }, |
| 25 | + selectorsUtils: { |
| 26 | + root: 'src/test-utils/selectors/index.ts', |
| 27 | + extraExports: ['default', 'ElementWrapper'], |
| 28 | + }, |
| 29 | + }); |
19 | 30 | return Promise.resolve(); |
20 | 31 | }; |
21 | | - |
22 | | -function testUtilDocs() { |
23 | | - ['dom', 'selectors'].forEach(testUtilType => { |
24 | | - const baseWrapperDefinitions = require(`@cloudscape-design/test-utils-core/test-utils-doc/${testUtilType}`); |
25 | | - const componentWrapperDefinitions = documentTestUtils( |
26 | | - { |
27 | | - tsconfig: require.resolve('../../src/test-utils/tsconfig.json'), |
28 | | - }, |
29 | | - `**/{${testUtilType},types}/**/*` |
30 | | - ); |
31 | | - |
32 | | - const definitions = [...baseWrapperDefinitions.classes, ...componentWrapperDefinitions]; |
33 | | - const indexContent = `module.exports = { |
34 | | - classes: ${JSON.stringify(definitions)} |
35 | | - } |
36 | | - `; |
37 | | - |
38 | | - const outPath = path.join(workspace.apiDocsPath, 'test-utils-doc', `${testUtilType}.js`); |
39 | | - writeFile(outPath, indexContent); |
40 | | - }); |
41 | | -} |
0 commit comments