Skip to content

Commit ba586de

Browse files
authored
Merge pull request #73 from patternfly/fix-stylesheet-copy
fix(build): Actually copy css file during build instead of symlinking
2 parents c668f18 + 4045742 commit ba586de

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/module/scripts/writeClassMaps.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { join, basename, relative, dirname } = require('path');
2-
const { outputFileSync, copyFileSync, ensureDirSync, symlinkSync } = require('fs-extra');
2+
const { outputFileSync, copyFileSync, ensureDirSync } = require('fs-extra');
33
const { generateClassMaps } = require('./generateClassMaps');
44

55
const writeTsExport = (file, classMap, outDir) =>
@@ -22,21 +22,21 @@ function writeClassMaps(classMaps) {
2222
// 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
2323
writeTsExport(relativeFilePath, classMap, packageBase);
2424

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
2626
const cssFileName = basename(file);
2727
const distDir = join(packageBase, 'dist');
2828
const cssDistDir = join(distDir, 'css');
2929
ensureDirSync(cssDistDir);
3030
copyFileSync(file, join(cssDistDir, cssFileName));
3131

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
3333
const fileDir = dirname(relativeFilePath).replace('src/', '');
3434
const cssDistEsmDir = join(distDir, 'esm', fileDir);
3535
const cssDistCjsDir = join(distDir, 'js', fileDir);
3636
const cssDistDirs = [cssDistEsmDir, cssDistCjsDir];
3737
cssDistDirs.forEach((dir) => {
3838
ensureDirSync(dir);
39-
symlinkSync(join(cssDistDir, cssFileName), join(dir, cssFileName));
39+
copyFileSync(file, join(dir, cssFileName));
4040
});
4141
});
4242

0 commit comments

Comments
 (0)