Skip to content

Commit

Permalink
fix: tests to use new config
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Aug 26, 2024
1 parent 8f7eafb commit f63f768
Showing 1 changed file with 2 additions and 44 deletions.
46 changes: 2 additions & 44 deletions e2e/uno.config.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,5 @@
import fs from 'node:fs/promises';
import { basename, dirname, join } from 'node:path';
import { globSync, convertPathToPattern } from 'fast-glob';
import { defineConfig, presetIcons, presetUno, transformerDirectives } from 'unocss';
import { rules, shortcuts, theme } from '@tutorialkit/theme';

const iconPaths = globSync('./icons/languages/*.svg');

const customIconCollection = iconPaths.reduce(
(acc, iconPath) => {
const collectionName = basename(dirname(iconPath));
const [iconName] = basename(iconPath).split('.');

acc[collectionName] ??= {};
acc[collectionName][iconName] = async () => fs.readFile(iconPath, 'utf8');

return acc;
},
{} as Record<string, Record<string, () => Promise<string>>>,
);
import { defineConfig } from '@tutorialkit/theme';

export default defineConfig({
rules,
shortcuts,
theme,
content: {
inline: globSync([
`${convertPathToPattern(join(require.resolve('@tutorialkit/components-react'), '..')).replace('\\@', '/@')}/**/*.js`,
`${convertPathToPattern(join(require.resolve('@tutorialkit/astro'), '..')).replace('\\@', '/@')}/default/**/*.astro`,
]).map((filePath) => {
return () => fs.readFile(filePath, { encoding: 'utf8' });
}),
},
transformers: [transformerDirectives()],
presets: [
presetUno({
dark: {
dark: '[data-theme="dark"]',
},
}),
presetIcons({
collections: {
...customIconCollection,
},
}),
],
// add your UnoCSS config here: https://unocss.dev/guide/config-file
});

0 comments on commit f63f768

Please sign in to comment.