1
1
const { join, basename, relative, dirname } = require ( 'path' ) ;
2
- const { outputFileSync, copyFileSync, ensureDirSync, symlinkSync } = require ( 'fs-extra' ) ;
2
+ const { outputFileSync, copyFileSync, ensureDirSync } = require ( 'fs-extra' ) ;
3
3
const { generateClassMaps } = require ( './generateClassMaps' ) ;
4
4
5
5
const writeTsExport = ( file , classMap , outDir ) =>
@@ -22,21 +22,21 @@ function writeClassMaps(classMaps) {
22
22
// write the export map in TS and put it in src, from here TS will compile it to the different module types at build time
23
23
writeTsExport ( relativeFilePath , classMap , packageBase ) ;
24
24
25
- // copy the css file itself over to dist since TS won't do that
25
+ // copy the css file itself over to dist so that they can be easily imported since TS won't do that
26
26
const cssFileName = basename ( file ) ;
27
27
const distDir = join ( packageBase , 'dist' ) ;
28
28
const cssDistDir = join ( distDir , 'css' ) ;
29
29
ensureDirSync ( cssDistDir ) ;
30
30
copyFileSync ( file , join ( cssDistDir , cssFileName ) ) ;
31
31
32
- // create symlinks for each exported module that reference to the single copy of the css files, prevents needing duplicates of the stylesheets
32
+ // create css files for each exported module to reference since TS won't do that either
33
33
const fileDir = dirname ( relativeFilePath ) . replace ( 'src/' , '' ) ;
34
34
const cssDistEsmDir = join ( distDir , 'esm' , fileDir ) ;
35
35
const cssDistCjsDir = join ( distDir , 'js' , fileDir ) ;
36
36
const cssDistDirs = [ cssDistEsmDir , cssDistCjsDir ] ;
37
37
cssDistDirs . forEach ( ( dir ) => {
38
38
ensureDirSync ( dir ) ;
39
- symlinkSync ( join ( cssDistDir , cssFileName ) , join ( dir , cssFileName ) ) ;
39
+ copyFileSync ( file , join ( dir , cssFileName ) ) ;
40
40
} ) ;
41
41
} ) ;
42
42
0 commit comments