@@ -51,16 +51,22 @@ function copyBackgroundsForFileSystem() {
51
51
const filteredFileContentsArray = fileContentsArray . filter (
52
52
( { theme : fileTheme } ) => fileTheme === theme ,
53
53
) ;
54
- config . themes [ index ] . backgrounds = filteredFileContentsArray ;
54
+ config . themes [ index ] [ "backgrounds" ] = filteredFileContentsArray . map (
55
+ ( { src, fontColor } ) => ( fontColor ? { src, fontColor } : { src } ) ,
56
+ ) ;
55
57
} ) ;
56
58
57
- const configJsonPath = path . join ( dir , "app .config.json" ) ;
59
+ const configJsonPath = path . join ( dir , "output .config.json" ) ;
58
60
fs . writeFileSync ( configJsonPath , JSON . stringify ( config , null , 2 ) ) ;
59
61
60
62
return copy ( {
61
63
targets : [ { src : sourceDirectory , dest : targetDirectory } ] ,
62
64
hook : "writeBundle" ,
63
65
} ) ;
66
+ } else {
67
+ const dir = path . resolve ( ) ;
68
+ const configJsonPath = path . join ( dir , "output.config.json" ) ;
69
+ fs . writeFileSync ( configJsonPath , JSON . stringify ( config , null , 2 ) ) ;
64
70
}
65
71
}
66
72
@@ -76,18 +82,22 @@ function readFilesRecursively(dir) {
76
82
77
83
sortedFiles . forEach ( ( file ) => {
78
84
const filePath = path . join ( dir , file ) ;
85
+ const theme = dir . replace (
86
+ path . join ( config . backgroundsUri . path , path . sep ) ,
87
+ "" ,
88
+ ) ;
79
89
80
90
if ( fs . statSync ( filePath ) . isDirectory ( ) ) {
81
91
readFiles ( filePath ) ;
82
92
} else if ( isImageFile ( filePath ) ) {
83
93
const item = file . split ( "." ) ?. [ 2 ]
84
94
? {
85
- theme : dir . replace ( ` ${ config . backgroundsUri . path } /` , "" ) ,
95
+ theme,
86
96
src : filePath ,
87
97
fontColor : file . split ( "." ) [ 1 ] ,
88
98
}
89
99
: {
90
- theme : dir . replace ( ` ${ config . backgroundsUri . path } /` , "" ) ,
100
+ theme,
91
101
src : filePath ,
92
102
} ;
93
103
fileContentsArray . push ( item ) ;
0 commit comments