Skip to content

Commit

Permalink
chore(build): debug why breaks on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
KatoakDR committed Oct 16, 2023
1 parent ebfb30b commit 1c9356a
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,30 +218,44 @@ function buildThemeConfig() {
)
);

console.log('*** buildThemeConfig', {
__dirname,
__listFiles: fs.readdirSync(__dirname, { encoding: 'utf8' }),
themeGlob: path.join(
__dirname,
'node_modules',
'@elastic',
'eui',
'dist',
'eui_theme_*.min.css'
),
themeFiles,
});

const themeConfig = {
/** @type Array<{ id: string; name: string; publicPath: string; }> */
availableThemes: [],
/** @type Array<{ from: string; to: string; }> */
copyConfig: [],
};

for (const each of themeFiles) {
const basename = path.basename(each, '.min.css');
for (const themeFile of themeFiles) {
const basename = path.basename(themeFile, '.min.css');

const themeId = basename.replace(/^eui_theme_/, '');

const themeName =
themeId[0].toUpperCase() + themeId.slice(1).replace(/_/g, ' ');

const publicPath = `themes/${basename}.${hashFile(each)}.min.css`;
const publicPath = `themes/${basename}.${hashFile(themeFile)}.min.css`;

const toPath = path.join(
__dirname,
'electron',
'renderer',
`public`,
`themes`,
`${basename}.${hashFile(each)}.min.css`
`${basename}.${hashFile(themeFile)}.min.css`
);

themeConfig.availableThemes.push({
Expand All @@ -251,7 +265,7 @@ function buildThemeConfig() {
});

themeConfig.copyConfig.push({
from: each,
from: themeFile,
to: toPath,
});
}
Expand Down

0 comments on commit 1c9356a

Please sign in to comment.