• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

marcomontalbano / figma-export / 8040637088

25 Feb 2024 08:41PM CUT coverage: 96.473%. Remained the same
8040637088

push

github

web-flow
Merge pull request #162 from marcomontalbano/add-overrides-for-axios

Add `overrides` for axios

236 of 258 branches covered (91.47%)

Branch coverage included in aggregate %.

612 of 621 relevant lines covered (98.55%)

17.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/packages/core/src/lib/export-components.ts
1
import * as FigmaExport from '@figma-export/types';
2

3
import {
1✔
4
    getClient,
5
    enrichPagesWithSvg,
6
    getDocument,
7
    getPagesWithComponents,
8
} from './figma';
9

10
export const components: FigmaExport.ComponentsCommand = async ({
1✔
11
    token,
12
    fileId,
13
    version,
14
    ids = [],
10✔
15
    onlyFromPages = [],
8✔
16
    filterComponent = () => true,
18✔
17
    includeTypes = ['COMPONENT'],
11✔
18
    transformers = [],
5✔
19
    outputters = [],
5✔
20
    concurrency = 30,
11✔
21
    retries = 3,
10✔
22
    log = (msg): void => {
5✔
23
        // eslint-disable-next-line no-console
24
        console.log(msg);
12✔
25
    },
26
}) => {
11✔
27
    const client = getClient(token);
11✔
28

29
    log('fetching document');
11✔
30
    const figmaDocument = await getDocument(
11✔
31
        client,
32
        {
33
            fileId,
34
            version,
35
            ids,
36
            onlyFromPages,
37
        },
38
    );
39

40
    const pages = getPagesWithComponents(figmaDocument, { filterComponent, includeTypes });
8✔
41

42
    log('preparing components');
8✔
43
    const pagesWithSvg = await enrichPagesWithSvg(client, fileId, pages, version, {
8✔
44
        transformers,
45
        concurrency,
46
        retries,
47
        onFetchCompleted: ({ index, total }) => {
48
            log(`fetching components ${index}/${total}`);
16✔
49
        },
50
    });
51

52
    await Promise.all(outputters.map((outputter) => outputter(pagesWithSvg)));
6✔
53

54
    log(`exported components from ${fileId}`);
6✔
55

56
    return pagesWithSvg;
6✔
57
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc