-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy path.figmaexportrc.example.components.local.js
43 lines (38 loc) · 1.2 KB
/
.figmaexportrc.example.components.local.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// @ts-check
/**
* If you want to try this configuration you can just run:
* $ yarn
* $ yarn build
* $ node ./packages/cli/bin/run.js use-config .figmaexportrc.example.components.local.js
*/
import path from 'node:path';
import { inspect } from 'node:util';
import outputComponentsAsSvg from './packages/output-components-as-svg/dist/index.js';
/** @type {import('./packages/types').ComponentsCommandOptions} */
const componentOptions = {
fileId: 'WnaqeyvNBhSbnBs0t1Fgvm',
filterComponent: () => true,
includeTypes: ['COMPONENT', 'INSTANCE'],
outputters: [
async (pages) => {
console.log(
'\n components:',
pages[0].components.length,
inspect(pages[0].components, { depth: null, colors: true }),
);
},
outputComponentsAsSvg({
output: './output/components/svg',
getDirname: (options) => {
const pathToComponent = options.pathToComponent
.map((p) => p.name)
.join(path.sep);
return `${options.pageName}${path.sep}${options.dirname}${path.sep}${pathToComponent}`;
},
}),
],
};
/** @type {import('./packages/types').FigmaExportRC} */
export default {
commands: [['components', componentOptions]],
};