core-maugli 1.2.6 → 1.2.8
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 +1 -1
- package/public/img/default/previews/autor_default.webp +0 -0
- package/public/img/default/previews/blog_default.webp +0 -0
- package/public/img/default/previews/default.webp +0 -0
- package/public/img/default/previews/product_default.webp +0 -0
- package/public/img/default/previews/project_default.webp +0 -0
- package/public/img/default/previews/rubric_default.webp +0 -0
- package/public/img/default/previews/test.webp +0 -0
- package/public/img/default/previews/test2.webp +0 -0
- package/scripts/generate-previews.js +30 -2
- package/scripts/test-package-update.js +64 -0
- package/scripts/update-components.js +13 -1
- package/src/components/RubricCard.astro +27 -7
- package/public/tr-about-1200.webp +0 -0
- package/public/tr-about-400.webp +0 -0
- package/public/tr-about-800.webp +0 -0
- package/public/tr-about.webp +0 -0
- package/public/tr-post-1-1200.webp +0 -0
- package/public/tr-post-1-400.webp +0 -0
- package/public/tr-post-1-800.webp +0 -0
- package/public/tr-post0-1200.webp +0 -0
- package/public/tr-post0-400.webp +0 -0
- package/public/tr-post0-800.webp +0 -0
- package/public/tr-post0.webp +0 -0
- package/public/tr-prewiew.webp +0 -0
package/package.json
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -11,8 +11,11 @@ const rootDir = __dirname.includes('node_modules')
|
|
11
11
|
? path.join(__dirname, '../../..')
|
12
12
|
: path.join(__dirname, '..');
|
13
13
|
|
14
|
-
|
15
|
-
const
|
14
|
+
// Размеры для разных типов контента
|
15
|
+
const blogPreviewWidth = 400;
|
16
|
+
const blogPreviewHeight = 210;
|
17
|
+
const rubricPreviewWidth = 210; // Увеличенный размер для качества на retina дисплеях (105px * 2)
|
18
|
+
const rubricPreviewHeight = 214; // Увеличенный размер для качества на retina дисплеях (107px * 2)
|
16
19
|
|
17
20
|
// Функция для извлечения путей изображений из markdown файлов
|
18
21
|
function extractImagePaths() {
|
@@ -94,6 +97,17 @@ function extractImagePaths() {
|
|
94
97
|
addExampleImages(examplesDir);
|
95
98
|
}
|
96
99
|
|
100
|
+
// Добавляем дефолтные изображения (включая изображения рубрик)
|
101
|
+
const defaultDir = path.join(rootDir, 'public/img/default');
|
102
|
+
if (fs.existsSync(defaultDir)) {
|
103
|
+
const items = fs.readdirSync(defaultDir);
|
104
|
+
for (const item of items) {
|
105
|
+
if (item.match(/\.(webp|jpg|jpeg|png)$/i)) {
|
106
|
+
imagePaths.add(`/img/default/${item}`);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
97
111
|
return Array.from(imagePaths);
|
98
112
|
}
|
99
113
|
|
@@ -138,6 +152,20 @@ async function createPreview(imagePath) {
|
|
138
152
|
const name = path.basename(fullImagePath, ext);
|
139
153
|
const previewPath = path.join(dir, 'previews', `${name}${ext}`);
|
140
154
|
|
155
|
+
// Определяем размер превью в зависимости от типа изображения
|
156
|
+
let previewWidth, previewHeight;
|
157
|
+
if (imagePath.includes('/img/default/') && (name.includes('rubric') || name.includes('tag'))) {
|
158
|
+
// Для изображений рубрик используем меньший размер
|
159
|
+
previewWidth = rubricPreviewWidth;
|
160
|
+
previewHeight = rubricPreviewHeight;
|
161
|
+
console.log(`Creating rubric preview (${previewWidth}x${previewHeight}): ${name}`);
|
162
|
+
} else {
|
163
|
+
// Для блог-постов и других изображений используем стандартный размер
|
164
|
+
previewWidth = blogPreviewWidth;
|
165
|
+
previewHeight = blogPreviewHeight;
|
166
|
+
console.log(`Creating blog preview (${previewWidth}x${previewHeight}): ${name}`);
|
167
|
+
}
|
168
|
+
|
141
169
|
// Создаем папку previews если её нет
|
142
170
|
const previewDir = path.dirname(previewPath);
|
143
171
|
if (!fs.existsSync(previewDir)) {
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
import fs from 'fs/promises';
|
4
|
+
import path from 'path';
|
5
|
+
import { fileURLToPath } from 'url';
|
6
|
+
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
8
|
+
const __dirname = path.dirname(__filename);
|
9
|
+
|
10
|
+
async function testPackageJsonUpdate() {
|
11
|
+
console.log('🧪 Testing package.json version update...');
|
12
|
+
|
13
|
+
// Создаем тестовый package.json
|
14
|
+
const testPackageJson = {
|
15
|
+
"name": "test-blog",
|
16
|
+
"version": "1.0.0",
|
17
|
+
"dependencies": {
|
18
|
+
"core-maugli": "^1.2.3",
|
19
|
+
"astro": "^5.5.6"
|
20
|
+
}
|
21
|
+
};
|
22
|
+
|
23
|
+
const testPath = path.join(__dirname, 'test-package.json');
|
24
|
+
await fs.writeFile(testPath, JSON.stringify(testPackageJson, null, 2), 'utf-8');
|
25
|
+
|
26
|
+
try {
|
27
|
+
// Получаем текущую версию из основного package.json
|
28
|
+
const packageJsonPath = path.join(__dirname, '../package.json');
|
29
|
+
const packageJsonContent = await fs.readFile(packageJsonPath, 'utf-8');
|
30
|
+
const packageData = JSON.parse(packageJsonContent);
|
31
|
+
const newVersion = packageData.version;
|
32
|
+
|
33
|
+
// Читаем тестовый package.json
|
34
|
+
const testPackageContent = await fs.readFile(testPath, 'utf-8');
|
35
|
+
const testPackageData = JSON.parse(testPackageContent);
|
36
|
+
|
37
|
+
console.log(`📦 Current test dependency: core-maugli@${testPackageData.dependencies['core-maugli']}`);
|
38
|
+
console.log(`📦 New version: ${newVersion}`);
|
39
|
+
|
40
|
+
// Обновляем версию
|
41
|
+
if (testPackageData.dependencies && testPackageData.dependencies['core-maugli']) {
|
42
|
+
const currentVersion = testPackageData.dependencies['core-maugli'];
|
43
|
+
if (currentVersion !== `^${newVersion}`) {
|
44
|
+
testPackageData.dependencies['core-maugli'] = `^${newVersion}`;
|
45
|
+
|
46
|
+
await fs.writeFile(testPath, JSON.stringify(testPackageData, null, 2) + '\n', 'utf-8');
|
47
|
+
console.log(`✅ Updated dependency: ${currentVersion} → ^${newVersion}`);
|
48
|
+
} else {
|
49
|
+
console.log(`✅ Dependency already up to date: ^${newVersion}`);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
// Показываем результат
|
54
|
+
const updatedContent = await fs.readFile(testPath, 'utf-8');
|
55
|
+
console.log('\n📋 Updated test package.json:');
|
56
|
+
console.log(updatedContent);
|
57
|
+
|
58
|
+
} finally {
|
59
|
+
// Удаляем тестовый файл
|
60
|
+
await fs.unlink(testPath);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
testPackageJsonUpdate();
|
@@ -9,7 +9,11 @@ const __dirname = path.dirname(__filename);
|
|
9
9
|
|
10
10
|
// Определяем корневые папки
|
11
11
|
const isInNodeModules = __dirname.includes('node_modules');
|
12
|
-
const isSourceProject = !isInNodeModules && (
|
12
|
+
const isSourceProject = !isInNodeModules && (
|
13
|
+
__dirname.includes('core-maugli-blog') ||
|
14
|
+
process.cwd().includes('core-maugli-blog') ||
|
15
|
+
__dirname.includes('core-maugli')
|
16
|
+
);
|
13
17
|
|
14
18
|
const packageRoot = isInNodeModules
|
15
19
|
? path.join(__dirname, '../../..', 'node_modules', 'core-maugli') // из node_modules
|
@@ -19,6 +23,14 @@ const userRoot = isInNodeModules
|
|
19
23
|
? path.join(__dirname, '../../..') // корень пользовательского проекта
|
20
24
|
: process.env.INIT_CWD || process.cwd(); // для разработки
|
21
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);
|
33
|
+
|
22
34
|
// Список папок и файлов для полного обновления (перезаписи)
|
23
35
|
const FORCE_UPDATE_PATHS = [
|
24
36
|
'src/components',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
import { getFilteredCollection } from '../utils/content-loader';
|
3
2
|
import { maugliConfig } from '../config/maugli.config';
|
4
3
|
import { slugify } from '../utils/common-utils';
|
4
|
+
import { getFilteredCollection } from '../utils/content-loader';
|
5
5
|
import { getPostsByTag } from '../utils/data-utils';
|
6
6
|
import CountBadge from './CountBadge.astro';
|
7
7
|
|
@@ -89,6 +89,31 @@ const yesterday = new Date(now);
|
|
89
89
|
yesterday.setDate(now.getDate() - 1);
|
90
90
|
const isYesterday = dateObj && dateObj.toDateString() === yesterday.toDateString();
|
91
91
|
const isBrandDate = isToday || isYesterday;
|
92
|
+
|
93
|
+
// Функция для получения пути к превью изображения
|
94
|
+
function getPreviewImageSrc(imageSrc: string): string {
|
95
|
+
if (!imageSrc) return maugliConfig.defaultRubricImage;
|
96
|
+
|
97
|
+
// Проверяем, есть ли превью для этого изображения
|
98
|
+
const pathParts = imageSrc.split('/');
|
99
|
+
const fileName = pathParts.pop();
|
100
|
+
const directory = pathParts.join('/');
|
101
|
+
const previewPath = `${directory}/previews/${fileName}`;
|
102
|
+
|
103
|
+
// Возвращаем путь к превью (браузер покажет оригинал, если превью не найдено)
|
104
|
+
return previewPath;
|
105
|
+
}
|
106
|
+
|
107
|
+
const imageSrc = image?.src || maugliConfig.defaultRubricImage;
|
108
|
+
const previewImageSrc = getPreviewImageSrc(imageSrc);
|
109
|
+
|
110
|
+
// Debug информация для разработки
|
111
|
+
console.log('RubricCard Debug:', {
|
112
|
+
title,
|
113
|
+
originalImageSrc: imageSrc,
|
114
|
+
previewImageSrc,
|
115
|
+
defaultRubricImage: maugliConfig.defaultRubricImage
|
116
|
+
});
|
92
117
|
---
|
93
118
|
|
94
119
|
<a href={`/tags/${slug}/`} class="block w-full">
|
@@ -97,12 +122,7 @@ const isBrandDate = isToday || isYesterday;
|
|
97
122
|
>
|
98
123
|
<!-- Левая часть: картинка и дата -->
|
99
124
|
<div class="flex flex-col items-end gap-2 w-[105px] h-[147px]">
|
100
|
-
<img
|
101
|
-
src={image?.src ? image.src : maugliConfig.defaultRubricImage}
|
102
|
-
alt={image?.alt || title}
|
103
|
-
class="w-[105px] h-[107px] object-cover rounded-custom"
|
104
|
-
loading="lazy"
|
105
|
-
/>
|
125
|
+
<img src={previewImageSrc} alt={image?.alt || title} class="w-[105px] h-[107px] object-cover rounded-custom" loading="lazy" />
|
106
126
|
<div class="flex flex-col items-end gap-1 w-[74px] h-[32px]">
|
107
127
|
<span class={`flex items-center gap-1 text-[12px] text-right ${isBrandDate ? 'text-[var(--brand-color)]' : 'text-[var(--text-muted)]'}`}>
|
108
128
|
<svg
|
Binary file
|
package/public/tr-about-400.webp
DELETED
Binary file
|
package/public/tr-about-800.webp
DELETED
Binary file
|
package/public/tr-about.webp
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/public/tr-post0-400.webp
DELETED
Binary file
|
package/public/tr-post0-800.webp
DELETED
Binary file
|
package/public/tr-post0.webp
DELETED
Binary file
|
package/public/tr-prewiew.webp
DELETED
Binary file
|