Skip to content

Commit

Permalink
Fix(variables-scss): Export in JS barrel file #DS-1503
Browse files Browse the repository at this point in the history
  • Loading branch information
curdaj committed Oct 4, 2024
1 parent 7aac16d commit 3d9eb6e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
27 changes: 14 additions & 13 deletions exporters/variables-scss/generated/exporter.cjs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('fileGenerator', () => {
{ path: './js/global/', fileName: 'index.ts', content: barrelJsFile },
// Root barrel files
{ path: './scss/', fileName: '@global.scss', content: "@forward 'global';\n" },
{ path: './js/', fileName: '@global.ts', content: "export * from './global';\n" },
{ path: './js/', fileName: 'index.ts', content: "export * from './global';\nexport * from './themes';\n" },
// Themes files
{ path: './scss/themes/theme-light/', fileName: '_colors.scss', content: emptyFile },
{ path: './js/themes/theme-light/', fileName: 'colors.ts', content: emptyFile },
Expand All @@ -110,7 +110,7 @@ describe('fileGenerator', () => {
{ path: './js/themes/theme-light-inverted/', fileName: 'index.ts', content: barrelJsColorFile },
// Themes root barrel files
{ path: './scss/', fileName: '@themes.scss', content: mockedRootThemeFile },
{ path: './js/', fileName: '@themes.ts', content: mockedRootThemeJsFile },
{ path: './js/', fileName: 'themes.ts', content: mockedRootThemeJsFile },
]);
});
});
Expand Down
6 changes: 3 additions & 3 deletions exporters/variables-scss/src/generators/fileGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export const generateOutputFilesByThemes = async (
});
outputFiles.push({
path: `./${JS_DIRECTORY}/`,
fileName: '@global.ts',
content: `export * from './${GLOBAL_DIRECTORY}';\n`,
fileName: 'index.ts',
content: `export * from './${GLOBAL_DIRECTORY}';\nexport * from './${THEMES_DIRECTORY}';\n`,
});

// Compute themed tokens for all themes in parallel
Expand Down Expand Up @@ -161,7 +161,7 @@ export const generateOutputFilesByThemes = async (
const rootThemesFileContent = generateThemesRootFile(themes);
const rootTsThemesFileContent = generateThemesRootFile(themes, true);
outputFiles.push({ path: `./${SCSS_DIRECTORY}/`, fileName: '@themes.scss', content: rootThemesFileContent });
outputFiles.push({ path: `./${JS_DIRECTORY}/`, fileName: '@themes.ts', content: rootTsThemesFileContent });
outputFiles.push({ path: `./${JS_DIRECTORY}/`, fileName: 'themes.ts', content: rootTsThemesFileContent });

return outputFiles;
};

0 comments on commit 3d9eb6e

Please sign in to comment.