This commit is contained in:
Stijnus 2025-01-30 23:05:04 +01:00
parent 1eae44dd14
commit 2c991e42da
3 changed files with 30 additions and 17 deletions

View File

@ -14,7 +14,7 @@ const FrameworkLink: React.FC<FrameworkLinkProps> = ({ template }) => (
className="items-center justify-center" className="items-center justify-center"
> >
<div <div
className={`inline-flex items-center justify-center ${template.icon} w-8 h-8 text-4xl transition-theme opacity-25 hover:opacity-100 hover:text-purple-500 dark:text-white dark:opacity-50 dark:hover:opacity-100 dark:hover:text-purple-400 transition-all`} className={`inline-block ${template.icon} w-8 h-8 text-4xl transition-theme opacity-25 hover:opacity-100 hover:text-purple-500 dark:text-white dark:opacity-50 dark:hover:opacity-100 dark:hover:text-purple-400 transition-all`}
title={template.label} title={template.label}
/> />
</a> </a>

View File

@ -31,7 +31,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'Lightweight Astro starter template for building fast static websites', description: 'Lightweight Astro starter template for building fast static websites',
githubRepo: 'thecodacus/bolt-astro-basic-template', githubRepo: 'thecodacus/bolt-astro-basic-template',
tags: ['astro', 'blog', 'performance'], tags: ['astro', 'blog', 'performance'],
icon: 'i-bolt-astro', icon: 'i-bolt:astro',
}, },
{ {
name: 'bolt-nextjs-shadcn', name: 'bolt-nextjs-shadcn',
@ -39,7 +39,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'Next.js starter fullstack template integrated with shadcn/ui components and styling system', description: 'Next.js starter fullstack template integrated with shadcn/ui components and styling system',
githubRepo: 'thecodacus/bolt-nextjs-shadcn-template', githubRepo: 'thecodacus/bolt-nextjs-shadcn-template',
tags: ['nextjs', 'react', 'typescript', 'shadcn', 'tailwind'], tags: ['nextjs', 'react', 'typescript', 'shadcn', 'tailwind'],
icon: 'i-bolt-nextjs', icon: 'i-bolt:nextjs',
}, },
{ {
name: 'bolt-qwik-ts', name: 'bolt-qwik-ts',
@ -47,7 +47,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'Qwik framework starter with TypeScript for building resumable applications', description: 'Qwik framework starter with TypeScript for building resumable applications',
githubRepo: 'thecodacus/bolt-qwik-ts-template', githubRepo: 'thecodacus/bolt-qwik-ts-template',
tags: ['qwik', 'typescript', 'performance', 'resumable'], tags: ['qwik', 'typescript', 'performance', 'resumable'],
icon: 'i-bolt-qwik', icon: 'i-bolt:qwik',
}, },
{ {
name: 'bolt-remix-ts', name: 'bolt-remix-ts',
@ -55,7 +55,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'Remix framework starter with TypeScript for full-stack web applications', description: 'Remix framework starter with TypeScript for full-stack web applications',
githubRepo: 'thecodacus/bolt-remix-ts-template', githubRepo: 'thecodacus/bolt-remix-ts-template',
tags: ['remix', 'typescript', 'fullstack', 'react'], tags: ['remix', 'typescript', 'fullstack', 'react'],
icon: 'i-bolt-remix', icon: 'i-bolt:remix',
}, },
{ {
name: 'bolt-slidev', name: 'bolt-slidev',
@ -71,7 +71,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'SvelteKit starter template for building fast, efficient web applications', description: 'SvelteKit starter template for building fast, efficient web applications',
githubRepo: 'bolt-sveltekit-template', githubRepo: 'bolt-sveltekit-template',
tags: ['svelte', 'sveltekit', 'typescript'], tags: ['svelte', 'sveltekit', 'typescript'],
icon: 'i-bolt-svelte', icon: 'i-bolt:svelte',
}, },
{ {
name: 'vanilla-vite', name: 'vanilla-vite',
@ -79,7 +79,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'Minimal Vite starter template for vanilla JavaScript projects', description: 'Minimal Vite starter template for vanilla JavaScript projects',
githubRepo: 'thecodacus/vanilla-vite-template', githubRepo: 'thecodacus/vanilla-vite-template',
tags: ['vite', 'vanilla-js', 'minimal'], tags: ['vite', 'vanilla-js', 'minimal'],
icon: 'i-bolt-vite', icon: 'i-bolt:vite',
}, },
{ {
name: 'bolt-vite-react', name: 'bolt-vite-react',
@ -87,7 +87,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'React starter template powered by Vite for fast development experience', description: 'React starter template powered by Vite for fast development experience',
githubRepo: 'thecodacus/bolt-vite-react-ts-template', githubRepo: 'thecodacus/bolt-vite-react-ts-template',
tags: ['react', 'vite', 'frontend'], tags: ['react', 'vite', 'frontend'],
icon: 'i-bolt-react', icon: 'i-bolt:react',
}, },
{ {
name: 'bolt-vite-ts', name: 'bolt-vite-ts',
@ -95,7 +95,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'Vite starter template with TypeScript configuration for type-safe development', description: 'Vite starter template with TypeScript configuration for type-safe development',
githubRepo: 'thecodacus/bolt-vite-ts-template', githubRepo: 'thecodacus/bolt-vite-ts-template',
tags: ['vite', 'typescript', 'minimal'], tags: ['vite', 'typescript', 'minimal'],
icon: 'i-bolt-typescript', icon: 'i-bolt:typescript',
}, },
{ {
name: 'bolt-vue', name: 'bolt-vue',
@ -103,7 +103,7 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'Vue.js starter template with modern tooling and best practices', description: 'Vue.js starter template with modern tooling and best practices',
githubRepo: 'thecodacus/bolt-vue-template', githubRepo: 'thecodacus/bolt-vue-template',
tags: ['vue', 'typescript', 'frontend'], tags: ['vue', 'typescript', 'frontend'],
icon: 'i-bolt-vue', icon: 'i-bolt:vue',
}, },
{ {
name: 'bolt-angular', name: 'bolt-angular',
@ -111,6 +111,6 @@ export const STARTER_TEMPLATES: Template[] = [
description: 'A modern Angular starter template with TypeScript support and best practices configuration', description: 'A modern Angular starter template with TypeScript support and best practices configuration',
githubRepo: 'thecodacus/bolt-angular-template', githubRepo: 'thecodacus/bolt-angular-template',
tags: ['angular', 'typescript', 'frontend', 'spa'], tags: ['angular', 'typescript', 'frontend', 'spa'],
icon: 'i-bolt-angular', icon: 'i-bolt:angular',
}, },
]; ];

View File

@ -2,6 +2,7 @@ import { globSync } from 'fast-glob';
import fs from 'node:fs/promises'; import fs from 'node:fs/promises';
import { basename, join } from 'node:path'; import { basename, join } from 'node:path';
import { defineConfig, presetIcons, presetUno, transformerDirectives } from 'unocss'; import { defineConfig, presetIcons, presetUno, transformerDirectives } from 'unocss';
import type { IconifyJSON } from '@iconify/types';
// Debug: Log the current working directory and icon paths // Debug: Log the current working directory and icon paths
console.log('CWD:', process.cwd()); console.log('CWD:', process.cwd());
@ -15,11 +16,13 @@ const customIconCollection = {
[collectionName]: iconPaths.reduce( [collectionName]: iconPaths.reduce(
(acc, iconPath) => { (acc, iconPath) => {
const [iconName] = basename(iconPath).split('.'); const [iconName] = basename(iconPath).split('.');
console.log(`Loading icon: ${iconName} from ${iconPath}`); console.log(`Loading icon: ${iconName} from ${iconPath}`); // Debug log
acc[iconName] = async () => { acc[iconName] = async () => {
try { try {
const content = await fs.readFile(iconPath, 'utf8'); const content = await fs.readFile(iconPath, 'utf8');
// Simplified SVG processing
return content return content
.replace(/fill="[^"]*"/g, 'fill="currentColor"') .replace(/fill="[^"]*"/g, 'fill="currentColor"')
.replace(/fill='[^']*'/g, "fill='currentColor'") .replace(/fill='[^']*'/g, "fill='currentColor'")
@ -120,7 +123,7 @@ export default defineConfig({
safelist: [ safelist: [
// Explicitly safelist all icon combinations // Explicitly safelist all icon combinations
...Object.keys(customIconCollection[collectionName] || {}).map((x) => `i-${collectionName}-${x}`), ...Object.keys(customIconCollection[collectionName] || {}).map((x) => `i-${collectionName}-${x}`),
...Object.keys(customIconCollection[collectionName] || {}).map((x) => `i-${collectionName}-${x.toLowerCase()}`), ...Object.keys(customIconCollection[collectionName] || {}).map((x) => `i-${collectionName}:${x}`),
], ],
shortcuts: { shortcuts: {
'bolt-ease-cubic-bezier': 'ease-[cubic-bezier(0.4,0,0.2,1)]', 'bolt-ease-cubic-bezier': 'ease-[cubic-bezier(0.4,0,0.2,1)]',
@ -263,7 +266,11 @@ export default defineConfig({
presetIcons({ presetIcons({
warn: true, warn: true,
collections: { collections: {
[collectionName]: customIconCollection[collectionName], bolt: customIconCollection.bolt,
ph: async () => {
const icons = await import('@iconify-json/ph/icons.json');
return icons.default as IconifyJSON;
},
}, },
extraProperties: { extraProperties: {
display: 'inline-block', display: 'inline-block',
@ -271,9 +278,15 @@ export default defineConfig({
width: '24px', width: '24px',
height: '24px', height: '24px',
}, },
scale: 1, customizations: {
unit: 'px', customize(props) {
cdn: '', return {
...props,
width: '24px',
height: '24px',
};
},
},
}), }),
], ],
}); });