core-maugli 1.2.49 → 1.2.51

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/bin/init.js CHANGED
@@ -93,6 +93,16 @@ function updateConfig(targetDir, lang, repoUrl) {
93
93
  if (repoUrl) {
94
94
  console.log(`Configured repository URL to ${repoUrl}`);
95
95
  }
96
+
97
+ // Create netlify.toml for new blog
98
+ try {
99
+ execSync('npm run init-netlify', {
100
+ cwd: targetDir,
101
+ stdio: 'pipe'
102
+ });
103
+ } catch (error) {
104
+ console.log('Note: netlify.toml will be created on npm install');
105
+ }
96
106
  }
97
107
 
98
108
  export default async function init(targetName, langOption, repoOption) {
package/netlify.toml CHANGED
@@ -31,14 +31,18 @@
31
31
  [[plugins]]
32
32
  package = "netlify-plugin-submit-sitemap"
33
33
 
34
+ # Пользовательский плагин
35
+ [[plugins]]
36
+ package = "netlify-plugin-my-custom-analytics"
37
+
34
38
  # Плагины для интеграций (требуют ручной настройки)
35
39
  # Раскомментируйте после настройки в Netlify UI:
36
40
  # ⚠️ После раскомментирования этот файл не будет автоматически обновляться
37
41
 
38
42
  # Bluesky Custom Domain
39
43
  # Инструкция: https://app.netlify.com/extensions/bluesky-custom-domain
40
- # [[plugins]]
41
- # package = "netlify-plugin-bluesky"
44
+ [[plugins]]
45
+ package = "netlify-plugin-bluesky"
42
46
 
43
47
  # Supabase Integration
44
48
  # Инструкция: https://app.netlify.com/extensions/supabase
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.49",
5
+ "version": "1.2.51",
6
6
  "license": "GPL-3.0-or-later OR Commercial",
7
7
  "repository": {
8
8
  "type": "git",
@@ -27,6 +27,7 @@
27
27
  "build:no-check": "node scripts/flatten-images.cjs && node scripts/optimize-images.cjs && node typograf-batch.js && node scripts/verify-assets.js && node scripts/generate-previews.js && astro build",
28
28
  "optimize": "node scripts/optimize-images.cjs",
29
29
  "optimize:squoosh": "node scripts/squoosh-optimize.js",
30
+ "clean:resized": "node scripts/clean-resized-images.js",
30
31
  "test": "node tests/examplesFilter.test.ts",
31
32
  "astro": "astro",
32
33
  "featured:add": "node scripts/featured.js add",
@@ -39,9 +40,9 @@
39
40
  "check-version": "node scripts/check-version.js",
40
41
  "auto-update": "node scripts/auto-update.js",
41
42
  "build:ci": "SKIP_VERSION_CHECK=true npm run build",
42
- "generate-netlify": "node scripts/copy-netlify-config.js",
43
+ "init-netlify": "node scripts/copy-netlify-config.js",
43
44
  "set-force-update": "node scripts/set-force-update.js",
44
- "postinstall": "node scripts/upgrade-config.js && node scripts/setup-user-images.js && node scripts/copy-netlify-config.js",
45
+ "postinstall": "node scripts/upgrade-config.js && node scripts/setup-user-images.js",
45
46
  "generate-previews": "node scripts/generate-previews.js"
46
47
  },
47
48
  "dependencies": {
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Очищает ресайзеные изображения из git
5
+ * Удаляет уже закоммиченные файлы с суффиксами -400, -800, -1200
6
+ */
7
+
8
+ import { execSync } from 'child_process';
9
+
10
+ function main() {
11
+ try {
12
+ console.log('🧹 Cleaning resized images from git...');
13
+
14
+ // Ищем все ресайзеные изображения в git
15
+ let resizedFiles;
16
+ try {
17
+ resizedFiles = execSync('git ls-files | grep -E ".*-(400|800|1200)\\.webp$"', { encoding: 'utf8' });
18
+ } catch (error) {
19
+ console.log('✅ No resized images found in git - nothing to clean');
20
+ return;
21
+ }
22
+
23
+ if (!resizedFiles.trim()) {
24
+ console.log('✅ No resized images found in git - nothing to clean');
25
+ return;
26
+ }
27
+
28
+ const files = resizedFiles.trim().split('\n');
29
+ console.log(`📋 Found ${files.length} resized images in git:`);
30
+ files.forEach(file => console.log(` 🗑️ ${file}`));
31
+
32
+ // Удаляем файлы из git индекса (но оставляем на диске)
33
+ const filesString = files.join(' ');
34
+ execSync(`git rm --cached ${filesString}`, { encoding: 'utf8' });
35
+
36
+ console.log(`✅ Removed ${files.length} resized images from git`);
37
+ console.log('💡 Files remain on disk but will be ignored by git');
38
+ console.log('');
39
+ console.log('📝 Next steps:');
40
+ console.log(' 1. git add .gitignore');
41
+ console.log(' 2. git commit -m "chore: remove resized images from git"');
42
+ console.log('');
43
+ console.log('🔄 Resized images will be regenerated automatically during build');
44
+
45
+ } catch (error) {
46
+ console.error('❌ Error cleaning resized images:', error.message);
47
+ console.log('💡 You can manually run: git rm --cached public/**/*-{400,800,1200}.webp');
48
+ }
49
+ }
50
+
51
+ main();
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Простое копирование netlify.toml из пакета core-maugli
5
+ */
6
+
7
+ import fs from 'fs';
8
+ import path from 'path';
9
+ import { fileURLToPath } from 'url';
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+
14
+ function main() {
15
+ try {
16
+ const targetPath = path.join(process.cwd(), 'netlify.toml');
17
+
18
+ // Проверяем, есть ли уже netlify.toml с маркером "CUSTOMIZED"
19
+ if (fs.existsSync(targetPath)) {
20
+ const existingContent = fs.readFileSync(targetPath, 'utf8');
21
+
22
+ if (existingContent.includes('# CUSTOMIZED')) {
23
+ console.log('📋 Found "# CUSTOMIZED" marker - preserving entire file');
24
+ return;
25
+ }
26
+
27
+ // Создаем бэкап
28
+ fs.copyFileSync(targetPath, targetPath + '.backup');
29
+ console.log('📦 Created backup: netlify.toml.backup');
30
+ }
31
+
32
+ // Ищем исходный файл в пакете
33
+ let sourcePath;
34
+ const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'core-maugli', 'netlify.toml');
35
+ if (fs.existsSync(nodeModulesPath)) {
36
+ sourcePath = nodeModulesPath;
37
+ } else {
38
+ sourcePath = path.join(__dirname, '..', 'netlify.toml');
39
+ }
40
+
41
+ if (!fs.existsSync(sourcePath)) {
42
+ console.log('⚠️ netlify.toml template not found');
43
+ return;
44
+ }
45
+
46
+ // Просто копируем файл
47
+ fs.copyFileSync(sourcePath, targetPath);
48
+ console.log('✅ netlify.toml copied successfully');
49
+
50
+ console.log('');
51
+ console.log('💡 Add "# CUSTOMIZED" comment to prevent auto-updates');
52
+
53
+ } catch (error) {
54
+ console.error('❌ Error copying netlify.toml:', error.message);
55
+ }
56
+ }
57
+
58
+ main();
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * Копирует netlify.toml из пакета core-maugli в проект
4
+ * Копирует netlify.toml только при инициализации нового блога
5
+ * НЕ ТРОГАЕТ существующие netlify.toml файлы!
5
6
  */
6
7
 
7
8
  import fs from 'fs';
@@ -15,45 +16,19 @@ function main() {
15
16
  try {
16
17
  const targetPath = path.join(process.cwd(), 'netlify.toml');
17
18
 
18
- // Проверяем, есть ли уже netlify.toml
19
+ // Если netlify.toml уже существует - НЕ ТРОГАЕМ!
19
20
  if (fs.existsSync(targetPath)) {
20
- const existingContent = fs.readFileSync(targetPath, 'utf8');
21
-
22
- // Проверяем, кастомизирован ли файл пользователем
23
- const hasBlueskyActive = existingContent.includes('bluesky-custom-domain') &&
24
- !existingContent.includes('# [[plugins]]');
25
- const hasSupabaseActive = existingContent.includes('@supabase/netlify-integration') &&
26
- !existingContent.includes('# [[plugins]]');
27
- const hasCustomComment = existingContent.includes('# CUSTOMIZED');
28
- const hasUserModifications = !existingContent.includes('# Auto-copied from core-maugli package');
29
-
30
- const hasCustomizations = hasBlueskyActive || hasSupabaseActive || hasCustomComment || hasUserModifications;
31
-
32
- if (hasCustomizations) {
33
- console.log('📋 netlify.toml exists with active integrations - preserving user settings');
34
- if (hasBlueskyActive) console.log(' 🔵 Bluesky integration detected');
35
- if (hasSupabaseActive) console.log(' 🟢 Supabase integration detected');
36
- if (hasCustomComment) console.log(' ✏️ Custom modifications marked');
37
- console.log('💡 To force update: delete netlify.toml and reinstall');
38
- return;
39
- } else {
40
- console.log('📋 netlify.toml exists but no active integrations - updating to latest template');
41
- // Создадим бэкап на всякий случай
42
- fs.copyFileSync(targetPath, targetPath + '.backup');
43
- console.log('📦 Created backup: netlify.toml.backup');
44
- }
21
+ console.log('📋 netlify.toml already exists - leaving unchanged');
22
+ console.log('� Configure Netlify plugins manually via Netlify UI');
23
+ return;
45
24
  }
46
25
 
47
26
  // Ищем исходный файл в пакете
48
27
  let sourcePath;
49
-
50
- // Если запускаем из node_modules
51
28
  const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'core-maugli', 'netlify.toml');
52
29
  if (fs.existsSync(nodeModulesPath)) {
53
30
  sourcePath = nodeModulesPath;
54
- }
55
- // Если запускаем из самого пакета (для разработки)
56
- else {
31
+ } else {
57
32
  sourcePath = path.join(__dirname, '..', 'netlify.toml');
58
33
  }
59
34
 
@@ -62,15 +37,14 @@ function main() {
62
37
  return;
63
38
  }
64
39
 
65
- // Копируем файл
40
+ // Копируем файл только для нового блога
66
41
  fs.copyFileSync(sourcePath, targetPath);
67
- console.log('✅ netlify.toml copied successfully');
68
- console.log('');
69
- console.log('📝 Manual setup required for:');
70
- console.log(' • Bluesky: https://app.netlify.com/extensions/bluesky-custom-domain');
71
- console.log(' • Supabase: https://app.netlify.com/extensions/supabase');
42
+ console.log('✅ netlify.toml created for new blog');
72
43
  console.log('');
73
- console.log('💡 Uncomment plugins in netlify.toml after setup');
44
+ console.log('📝 Next steps:');
45
+ console.log(' 1. Deploy to Netlify');
46
+ console.log(' 2. Configure plugins via Netlify UI');
47
+ console.log(' 3. Add "# CUSTOMIZED" comment to prevent overwrites');
74
48
 
75
49
  } catch (error) {
76
50
  console.error('❌ Error copying netlify.toml:', error.message);
@@ -56,10 +56,8 @@ const REQUIRED_SCRIPTS = [
56
56
  'scripts/update-with-backup.js',
57
57
  'scripts/check-version.js',
58
58
  'scripts/auto-update.js',
59
- 'scripts/copy-netlify-config.js',
60
59
  'scripts/set-force-update.js',
61
- '.gitignore',
62
- 'netlify.toml'
60
+ '.gitignore'
63
61
  ];
64
62
 
65
63
  function log(message, type = 'info') {
@@ -155,23 +153,7 @@ function updateBlogProject(projectPath) {
155
153
  process.chdir(absolutePath);
156
154
  execSync('npm update core-maugli', { stdio: 'pipe' });
157
155
 
158
- // 8. Копируем netlify.toml
159
- log('Copying netlify.toml configuration...', 'info');
160
- const copyNetlifyScript = path.join(process.cwd(), 'scripts/copy-netlify-config.js');
161
- if (fs.existsSync(copyNetlifyScript)) {
162
- try {
163
- const { execSync } = require('child_process');
164
- execSync(`node "${copyNetlifyScript}"`, {
165
- stdio: 'pipe',
166
- cwd: absolutePath
167
- });
168
- log(' ✅ netlify.toml copied', 'success');
169
- } catch (error) {
170
- log(` ⚠️ netlify.toml copy failed: ${error.message}`, 'warn');
171
- }
172
- }
173
-
174
- // 9. Результат
156
+ // 8. Результат
175
157
  log(`Project updated successfully!`, 'success');
176
158
  log(` Version: ${oldVersion} → ${CURRENT_VERSION}`, 'info');
177
159
  log(` Scripts updated: ${scriptsUpdated ? 'Yes' : 'No'}`, 'info');