@@ -112,6 +112,35 @@ function minsvg(data: string): string {
112
112
return result . data
113
113
}
114
114
115
+ /**
116
+ * Return a path with POSIX style separators
117
+ *
118
+ * The default function assumes UNIX system, so it just returns the path.
119
+ *
120
+ * @param p - string path
121
+ * @returns String path
122
+ */
123
+ let assurePosixSep = function ( p : string ) : string {
124
+ return p
125
+ } ;
126
+
127
+ /**
128
+ * Return a path with POSIX style separators
129
+ *
130
+ * The Windows variant of this function replaces the separator with regex.
131
+ *
132
+ * @param p - string path
133
+ * @returns String path
134
+ */
135
+ const winSepRegex = new RegExp ( `\\${ path . win32 . sep } ` , "g" ) ;
136
+ function assurePosixSepWin ( p : string ) : string {
137
+ return p . replace ( winSepRegex , path . posix . sep )
138
+ } ;
139
+
140
+ if ( path . sep === path . win32 . sep ) {
141
+ assurePosixSep = assurePosixSepWin ;
142
+ }
143
+
115
144
/* ----------------------------------------------------------------------------
116
145
* Tasks
117
146
* ------------------------------------------------------------------------- */
@@ -187,7 +216,7 @@ const sources$ = copyAll("**/*.py", {
187
216
const stylesheets$ = resolve ( "**/[!_]*.scss" , { cwd : "src" } )
188
217
. pipe (
189
218
mergeMap ( file => zip (
190
- of ( ext ( file , ".css" ) . replace ( / ( o v e r r i d e s | t e m p l a t e s ) \/ / , "" ) ) ,
219
+ of ( ext ( file , ".css" ) . replace ( new RegExp ( `( overrides|templates)\\ ${ path . sep } ` ) , "" ) ) ,
191
220
transformStyle ( {
192
221
from : `src/${ file } ` ,
193
222
to : ext ( `${ base } /${ file } ` , ".css" )
@@ -199,7 +228,7 @@ const stylesheets$ = resolve("**/[!_]*.scss", { cwd: "src" })
199
228
const javascripts$ = resolve ( "**/{custom,bundle,search}.ts" , { cwd : "src" } )
200
229
. pipe (
201
230
mergeMap ( file => zip (
202
- of ( ext ( file , ".js" ) . replace ( / ( o v e r r i d e s | t e m p l a t e s ) \/ / , "" ) ) ,
231
+ of ( ext ( file , ".js" ) . replace ( new RegExp ( `( overrides|templates)\\ ${ path . sep } ` ) , "" ) ) ,
203
232
transformScript ( {
204
233
from : `src/${ file } ` ,
205
234
to : ext ( `${ base } /${ file } ` , ".js" )
@@ -229,10 +258,10 @@ const manifest$ = merge(
229
258
. pipe (
230
259
scan ( ( prev , mapping ) => (
231
260
mapping . reduce ( ( next , [ key , value ] ) => (
232
- next . set ( key , value . replace (
233
- new RegExp ( `${ base } \\/(overrides|templates)\\/ ` ) ,
261
+ next . set ( assurePosixSep ( key ) , assurePosixSep ( value . replace (
262
+ new RegExp ( `${ base } \\/(overrides|templates)\\${ path . sep } ` ) ,
234
263
""
235
- ) )
264
+ ) ) )
236
265
) , prev )
237
266
) , new Map < string , string > ( ) ) ,
238
267
)
@@ -291,8 +320,8 @@ const icons$ = defer(() => resolve("**/*.svg", {
291
320
} ) )
292
321
. pipe (
293
322
reduce ( ( index , file ) => index . set (
294
- file . replace ( / \. s v g $ / , "" ) . replace ( / \/ / g , "-" ) ,
295
- file
323
+ file . replace ( / \. s v g $ / , "" ) . replace ( new RegExp ( `\\ ${ path . sep } ` , "g" ) , "-" ) ,
324
+ assurePosixSep ( file )
296
325
) , new Map < string , string > ( ) )
297
326
)
298
327
@@ -372,7 +401,7 @@ const schema$ = merge(
372
401
"reference/icons-emojis/#search"
373
402
] . join ( "/" ) ,
374
403
"type" : "string" ,
375
- "enum" : icons . map ( icon => icon . replace ( ".svg" , "" ) )
404
+ "enum" : icons . map ( icon => assurePosixSep ( icon . replace ( ".svg" , "" ) ) )
376
405
} ) ) ,
377
406
switchMap ( data => write (
378
407
"docs/schema/assets/icons.json" ,
0 commit comments