core-maugli 1.2.8 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "core-maugli",
3
3
  "description": "Astro & Tailwind CSS blog theme for Maugli.",
4
4
  "type": "module",
5
- "version": "1.2.8",
5
+ "version": "1.2.10",
6
6
  "license": "GPL-3.0-or-later OR Commercial",
7
7
  "repository": {
8
8
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "typograf": "node typograf-batch.js",
22
22
  "dev": "astro dev",
23
23
  "start": "astro dev",
24
- "build": "node typograf-batch.js && node scripts/generate-previews.js && node scripts/verify-assets.js && astro build",
24
+ "build": "node typograf-batch.js && node scripts/verify-assets.js && node scripts/generate-previews.js && astro build",
25
25
  "test": "node tests/examplesFilter.test.ts",
26
26
  "astro": "astro",
27
27
  "featured:add": "node scripts/featured.js add",
@@ -23,13 +23,18 @@ const userRoot = isInNodeModules
23
23
  ? path.join(__dirname, '../../..') // корень пользовательского проекта
24
24
  : process.env.INIT_CWD || process.cwd(); // для разработки
25
25
 
26
- console.log('🔍 Debug paths:');
27
- console.log(' __dirname:', __dirname);
28
- console.log(' isInNodeModules:', isInNodeModules);
29
- console.log(' isSourceProject:', isSourceProject);
30
- console.log(' packageRoot:', packageRoot);
31
- console.log(' userRoot:', userRoot);
32
- console.log(' packageRoot === userRoot:', packageRoot === userRoot);
26
+ // Debug режим включается через переменную окружения DEBUG=true
27
+ const DEBUG = process.env.DEBUG === 'true';
28
+
29
+ if (DEBUG) {
30
+ console.log('🔍 Debug paths:');
31
+ console.log(' __dirname:', __dirname);
32
+ console.log(' isInNodeModules:', isInNodeModules);
33
+ console.log(' isSourceProject:', isSourceProject);
34
+ console.log(' packageRoot:', packageRoot);
35
+ console.log(' userRoot:', userRoot);
36
+ console.log(' packageRoot === userRoot:', packageRoot === userRoot);
37
+ }
33
38
 
34
39
  // Список папок и файлов для полного обновления (перезаписи)
35
40
  const FORCE_UPDATE_PATHS = [
@@ -94,26 +94,36 @@ const isBrandDate = isToday || isYesterday;
94
94
  function getPreviewImageSrc(imageSrc: string): string {
95
95
  if (!imageSrc) return maugliConfig.defaultRubricImage;
96
96
 
97
- // Проверяем, есть ли превью для этого изображения
97
+ // Если это изображение по умолчанию, возвращаем его превью напрямую
98
+ if (imageSrc === maugliConfig.defaultRubricImage) {
99
+ return '/img/default/previews/rubric_default.webp';
100
+ }
101
+
102
+ // Для кастомных изображений проверяем, есть ли превью
98
103
  const pathParts = imageSrc.split('/');
99
104
  const fileName = pathParts.pop();
100
105
  const directory = pathParts.join('/');
101
106
  const previewPath = `${directory}/previews/${fileName}`;
102
107
 
108
+ // Убеждаемся, что путь абсолютный (начинается с /)
109
+ const absolutePreviewPath = previewPath.startsWith('/') ? previewPath : `/${previewPath}`;
110
+
103
111
  // Возвращаем путь к превью (браузер покажет оригинал, если превью не найдено)
104
- return previewPath;
112
+ return absolutePreviewPath;
105
113
  }
106
114
 
107
115
  const imageSrc = image?.src || maugliConfig.defaultRubricImage;
108
116
  const previewImageSrc = getPreviewImageSrc(imageSrc);
109
117
 
110
- // Debug информация для разработки
111
- console.log('RubricCard Debug:', {
112
- title,
113
- originalImageSrc: imageSrc,
114
- previewImageSrc,
115
- defaultRubricImage: maugliConfig.defaultRubricImage
116
- });
118
+ // Debug информация только в development режиме
119
+ if (import.meta.env.DEV) {
120
+ console.log('RubricCard Debug:', {
121
+ title,
122
+ originalImageSrc: imageSrc,
123
+ previewImageSrc,
124
+ defaultRubricImage: maugliConfig.defaultRubricImage
125
+ });
126
+ }
117
127
  ---
118
128
 
119
129
  <a href={`/tags/${slug}/`} class="block w-full">