@@ -29,6 +29,8 @@ export default class Sync extends Command {
29
29
static flags = {
30
30
fileId : Flags . string ( { description : 'Figma fileId or create env.FIGMA_FILE_ID' , env : 'FIGMA_FILE_ID' , requiredOrDefaulted : false } ) ,
31
31
nameExportType : Flags . string ( { description : 'Name enum .ts or .php' , requiredOrDefaulted : false } ) ,
32
+ pathFileTypeTS : Flags . string ( { description : 'Name enum .ts' , requiredOrDefaulted : false } ) ,
33
+ pathFileTypePHP : Flags . string ( { description : 'Name enum .php' , requiredOrDefaulted : false } ) ,
32
34
page : Flags . string ( { description : '...' , env : 'FIGMA_PAGE' , requiredOrDefaulted : false } ) ,
33
35
pathFileSprite : Flags . string ( { description : 'Represents the path to a sprite svg file.' , requiredOrDefaulted : false } ) ,
34
36
pathFileType : Flags . string ( { description : 'Represents the file type of a given path.' , requiredOrDefaulted : false } ) ,
@@ -42,6 +44,8 @@ export default class Sync extends Command {
42
44
private conf : IFigmaDefaultConf ;
43
45
private fileId : string ;
44
46
private nameExportType : string ;
47
+ private pathFileTypeTS : string ;
48
+ private pathFileTypePHP : string ;
45
49
private page : string ;
46
50
private pathFileSprite : string ;
47
51
/**
@@ -54,16 +58,32 @@ export default class Sync extends Command {
54
58
private silent : boolean ;
55
59
56
60
private taskCreatingTypingFile = async ( ctx : TakeSvgCtxTask ) => {
57
- const buildVersion = getBuildVersion ( this . config . pjson . version ) ;
58
-
59
- await createSvgTypes ( {
60
- buildVersion,
61
+ const p = {
62
+ pathFileType : null ,
63
+ buildVersion : getBuildVersion ( this . config . pjson . version ) ,
61
64
nameExportType : this . nameExportType ,
62
65
names : ctx . typeIcons . map ( v => v . typeName ) . sort ( ) ,
63
- pathFileType : this . pathFileType ,
64
66
phpNamespace : this . phpNamespace ,
65
- phpUse : this . phpUse
66
- } ) ;
67
+ phpUse : this . phpUse ,
68
+ }
69
+ if ( this . pathFileType ) {
70
+ await createSvgTypes ( {
71
+ ...p ,
72
+ pathFileType : this . pathFileType ,
73
+ } ) ;
74
+ }
75
+ if ( this . pathFileTypeTS ) {
76
+ await createSvgTypes ( {
77
+ ...p ,
78
+ pathFileType : this . pathFileTypeTS ,
79
+ } ) ;
80
+ }
81
+ if ( this . pathFileTypePHP ) {
82
+ await createSvgTypes ( {
83
+ ...p ,
84
+ pathFileType : this . pathFileTypePHP ,
85
+ } ) ;
86
+ }
67
87
}
68
88
69
89
private taskDownloadAllSvg = async ( ctx : TakeSvgCtxTask ) => {
@@ -124,7 +144,7 @@ export default class Sync extends Command {
124
144
title : 'Download all svg'
125
145
} ,
126
146
{
127
- skip : ( ctx ) => ! ctx ?. typeIcons || ! this . pathFileType ,
147
+ skip : ( ctx ) => ! ctx ?. typeIcons || ( ! this . pathFileType && ! this . pathFileTypeTS && ! this . pathFileTypePHP ) ,
128
148
task : this . taskCreatingTypingFile ,
129
149
title : 'Creating a typing file'
130
150
} ,
@@ -213,6 +233,14 @@ export default class Sync extends Command {
213
233
if ( this . pathFileType ) {
214
234
this . pathFileType = path . join ( process . cwd ( ) , this . pathFileType ) ;
215
235
}
236
+ this . pathFileTypeTS = flags ?. pathFileTypeTS ?? this . conf . pathFileTypeTS ;
237
+ if ( this . pathFileTypeTS ) {
238
+ this . pathFileTypeTS = path . join ( process . cwd ( ) , this . pathFileTypeTS ) ;
239
+ }
240
+ this . pathFileTypePHP = flags ?. pathFileTypePHP ?? this . conf . pathFileTypePHP ;
241
+ if ( this . pathFileTypeTS ) {
242
+ this . pathFileTypePHP = path . join ( process . cwd ( ) , this . pathFileTypePHP ) ;
243
+ }
216
244
217
245
this . pathFileSprite = flags ?. pathFileSprite ?? this . conf . pathFileSprite ;
218
246
if ( this . pathFileSprite ) {
0 commit comments