core-maugli 1.2.44 → 1.2.45

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/netlify.toml CHANGED
@@ -1,22 +1,20 @@
1
- # Netlify configuration generated from maugli.config.ts
1
+ # Netlify configuration for Maugli Blog
2
+ # Auto-copied from core-maugli package
2
3
 
3
4
  [build]
4
- command = "npm run build"
5
5
  publish = "dist"
6
+ command = "npm run build"
6
7
 
7
8
  [build.environment]
8
- NODE_VERSION = "18"
9
- NPM_FLAGS = "--legacy-peer-deps"
9
+ NODE_VERSION = "20"
10
10
 
11
- # Netlify plugins
11
+ # Обязательные плагины для Astro
12
12
  [[plugins]]
13
- package = "@netlify/plugin-lighthouse"
13
+ package = "netlify-plugin-astro"
14
14
 
15
+ # Рекомендуемые плагины для оптимизации
15
16
  [[plugins]]
16
- package = "netlify-plugin-submit-sitemap"
17
-
18
- [[plugins]]
19
- package = "netlify-plugin-checklinks"
17
+ package = "@netlify/plugin-lighthouse"
20
18
 
21
19
  [[plugins]]
22
20
  package = "netlify-plugin-image-optim"
@@ -25,10 +23,20 @@
25
23
  package = "netlify-plugin-minify-html"
26
24
 
27
25
  [[plugins]]
28
- package = "netlify-plugin-inline-critical-css"
26
+ package = "netlify-plugin-submit-sitemap"
29
27
 
30
- [[plugins]]
31
- package = "netlify-plugin-hashfiles"
28
+ # Плагины для интеграций (требуют ручной настройки)
29
+ # Раскомментируйте после настройки в Netlify UI:
30
+
31
+ # Bluesky Custom Domain
32
+ # Инструкция: https://app.netlify.com/extensions/bluesky-custom-domain
33
+ # [[plugins]]
34
+ # package = "netlify-plugin-bluesky"
35
+
36
+ # Supabase Integration
37
+ # Инструкция: https://app.netlify.com/extensions/supabase
38
+ # [[plugins]]
39
+ # package = "@supabase/netlify-integration"
32
40
 
33
41
  # Redirects
34
42
  [[redirects]]
@@ -36,23 +44,23 @@
36
44
  to = "/rss.xml"
37
45
  status = 301
38
46
 
39
- # Headers
47
+ # Headers для безопасности
40
48
  [[headers]]
41
49
  for = "/*"
42
50
  [headers.values]
43
- "X-Frame-Options" = "DENY"
44
- [headers.values]
45
- "X-Content-Type-Options" = "nosniff"
46
- [headers.values]
47
- "Referrer-Policy" = "strict-origin-when-cross-origin"
51
+ X-Frame-Options = "DENY"
52
+ X-XSS-Protection = "1; mode=block"
53
+ X-Content-Type-Options = "nosniff"
54
+ Referrer-Policy = "strict-origin-when-cross-origin"
48
55
 
56
+ # Кэширование изображений
49
57
  [[headers]]
50
58
  for = "/img/*"
51
59
  [headers.values]
52
- "Cache-Control" = "public, max-age=31536000, immutable"
60
+ Cache-Control = "public, max-age=31536000, immutable"
53
61
 
54
62
  [[headers]]
55
63
  for = "/*.webp"
56
64
  [headers.values]
57
- "Cache-Control" = "public, max-age=31536000, immutable"
65
+ Cache-Control = "public, max-age=31536000, immutable"
58
66
 
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.44",
5
+ "version": "1.2.45",
6
6
  "license": "GPL-3.0-or-later OR Commercial",
7
7
  "repository": {
8
8
  "type": "git",
@@ -39,8 +39,8 @@
39
39
  "check-version": "node scripts/check-version.js",
40
40
  "auto-update": "node scripts/auto-update.js",
41
41
  "build:ci": "SKIP_VERSION_CHECK=true npm run build",
42
- "generate-netlify": "node scripts/generate-netlify-config.js",
43
- "postinstall": "node scripts/upgrade-config.js && node scripts/setup-user-images.js && node scripts/generate-netlify-config.js",
42
+ "generate-netlify": "node scripts/copy-netlify-config.js",
43
+ "postinstall": "node scripts/upgrade-config.js && node scripts/setup-user-images.js && node scripts/copy-netlify-config.js",
44
44
  "generate-previews": "node scripts/generate-previews.js"
45
45
  },
46
46
  "dependencies": {
@@ -8,6 +8,15 @@ import { fileURLToPath } from 'url';
8
8
  const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = path.dirname(__filename);
10
10
 
11
+ // Handle CLI arguments and environment variables first
12
+ const args = process.argv.slice(2);
13
+ if (args.includes('--skip-check') ||
14
+ process.env.SKIP_VERSION_CHECK === 'true' ||
15
+ process.env.DISABLE_AUTO_UPDATE === 'true') {
16
+ console.log(colorize('⏭️ Version check skipped', 'yellow'));
17
+ process.exit(0);
18
+ }
19
+
11
20
  // Colors for console output
12
21
  const colors = {
13
22
  red: '\x1b[31m',
@@ -228,13 +237,8 @@ async function main() {
228
237
  console.log(colorize('\n✅ Proceeding with build...\n', 'green'));
229
238
  }
230
239
 
231
- // Handle CLI arguments
232
- const args = process.argv.slice(2);
233
- if (args.includes('--skip-check') ||
234
- process.env.SKIP_VERSION_CHECK === 'true' ||
235
- process.env.DISABLE_AUTO_UPDATE === 'true') {
236
- console.log(colorize('⏭️ Version check skipped', 'yellow'));
237
- process.exit(0);
240
+ function colorize(text, color) {
241
+ return `${colors[color]}${text}${colors.reset}`;
238
242
  }
239
243
 
240
244
  main().catch(error => {
@@ -0,0 +1,57 @@
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
19
+ if (fs.existsSync(targetPath)) {
20
+ console.log('📋 netlify.toml already exists - skipping copy');
21
+ return;
22
+ }
23
+
24
+ // Ищем исходный файл в пакете
25
+ let sourcePath;
26
+
27
+ // Если запускаем из node_modules
28
+ const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'core-maugli', 'netlify.toml');
29
+ if (fs.existsSync(nodeModulesPath)) {
30
+ sourcePath = nodeModulesPath;
31
+ }
32
+ // Если запускаем из самого пакета (для разработки)
33
+ else {
34
+ sourcePath = path.join(__dirname, '..', 'netlify.toml');
35
+ }
36
+
37
+ if (!fs.existsSync(sourcePath)) {
38
+ console.log('⚠️ netlify.toml template not found');
39
+ return;
40
+ }
41
+
42
+ // Копируем файл
43
+ fs.copyFileSync(sourcePath, targetPath);
44
+ console.log('✅ netlify.toml copied successfully');
45
+ console.log('');
46
+ console.log('📝 Manual setup required for:');
47
+ console.log(' • Bluesky: https://app.netlify.com/extensions/bluesky-custom-domain');
48
+ console.log(' • Supabase: https://app.netlify.com/extensions/supabase');
49
+ console.log('');
50
+ console.log('💡 Uncomment plugins in netlify.toml after setup');
51
+
52
+ } catch (error) {
53
+ console.error('❌ Error copying netlify.toml:', error.message);
54
+ }
55
+ }
56
+
57
+ main();
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env nconst CURRENT_VERSION = '1.2.45';de
2
2
 
3
3
  /**
4
4
  * Скрипт для централизованного обновления всех блогов до последней версии core-maugli
@@ -57,7 +57,7 @@ const REQUIRED_SCRIPTS = [
57
57
  'scripts/update-with-backup.js',
58
58
  'scripts/check-version.js',
59
59
  'scripts/auto-update.js',
60
- 'scripts/generate-netlify-config.js',
60
+ 'scripts/copy-netlify-config.js',
61
61
  '.gitignore',
62
62
  'netlify.toml'
63
63
  ];
@@ -155,19 +155,19 @@ function updateBlogProject(projectPath) {
155
155
  process.chdir(absolutePath);
156
156
  execSync('npm update core-maugli', { stdio: 'pipe' });
157
157
 
158
- // 8. Генерируем netlify.toml
159
- log('Generating netlify.toml configuration...', 'info');
160
- const generateNetlifyScript = path.join(process.cwd(), 'scripts/generate-netlify-config.js');
161
- if (fs.existsSync(generateNetlifyScript)) {
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
162
  try {
163
163
  const { execSync } = require('child_process');
164
- execSync(`node "${generateNetlifyScript}"`, {
164
+ execSync(`node "${copyNetlifyScript}"`, {
165
165
  stdio: 'pipe',
166
166
  cwd: absolutePath
167
167
  });
168
- log(' ✅ netlify.toml generated', 'success');
168
+ log(' ✅ netlify.toml copied', 'success');
169
169
  } catch (error) {
170
- log(` ⚠️ netlify.toml generation failed: ${error.message}`, 'warn');
170
+ log(` ⚠️ netlify.toml copy failed: ${error.message}`, 'warn');
171
171
  }
172
172
  }
173
173
 
@@ -211,7 +211,7 @@ function main() {
211
211
  log(' ✅ Correct core-maugli version', 'success');
212
212
  log(' ✅ Up-to-date build scripts', 'success');
213
213
  log(' ✅ Working image optimization', 'success');
214
- log(' ✅ Auto-generated netlify.toml', 'success');
214
+ log(' ✅ Auto-copied netlify.toml', 'success');
215
215
  }
216
216
  }
217
217
 
@@ -1,176 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Generate netlify.toml from maugli.config.ts
5
- * This script creates a Netlify configuration file based on the Maugli configuration
6
- */
7
-
8
- import fs from 'fs';
9
- import os from 'os';
10
- import path from 'path';
11
- import ts from 'typescript';
12
- import { fileURLToPath, pathToFileURL } from 'url';
13
-
14
- const __filename = fileURLToPath(import.meta.url);
15
- const __dirname = path.dirname(__filename);
16
-
17
- async function loadTsModule(filePath) {
18
- const code = await fs.promises.readFile(filePath, 'utf8');
19
- const js = ts.transpileModule(code, {
20
- compilerOptions: { module: ts.ModuleKind.ESNext, target: ts.ScriptTarget.ES2020 }
21
- }).outputText;
22
- const tmp = path.join(os.tmpdir(), `netlify-gen-${Date.now()}.mjs`);
23
- await fs.promises.writeFile(tmp, js, 'utf8');
24
- const mod = await import(pathToFileURL(tmp).href);
25
- await fs.promises.unlink(tmp);
26
- return mod;
27
- }
28
-
29
- async function loadMaugliConfig() {
30
- try {
31
- // Try to load from user project first
32
- const userConfigPath = path.join(process.cwd(), 'src/config/maugli.config.ts');
33
- if (fs.existsSync(userConfigPath)) {
34
- const mod = await loadTsModule(userConfigPath);
35
- return mod.maugliConfig;
36
- }
37
-
38
- // Fallback to default config
39
- const defaultConfigPath = path.join(__dirname, '../src/config/maugli.config.ts');
40
- const mod = await loadTsModule(defaultConfigPath);
41
- return mod.maugliConfig;
42
- } catch (error) {
43
- console.warn('Could not load maugli.config.ts:', error.message);
44
- return null;
45
- }
46
- }
47
-
48
- function generateNetlifyToml(config) {
49
- const netlifyConfig = config.netlify || {};
50
-
51
- let toml = `# Netlify configuration generated from maugli.config.ts\n\n`;
52
-
53
- // Build settings
54
- toml += `[build]\n`;
55
- toml += ` command = "${netlifyConfig.buildCommand || 'npm run build'}"\n`;
56
- toml += ` publish = "${netlifyConfig.publishDir || 'dist'}"\n\n`;
57
-
58
- // Environment variables
59
- if (netlifyConfig.environment) {
60
- toml += `[build.environment]\n`;
61
-
62
- // Add auto-update control
63
- if (netlifyConfig.autoUpdate === false) {
64
- toml += ` DISABLE_AUTO_UPDATE = "true"\n`;
65
- }
66
-
67
- for (const [key, value] of Object.entries(netlifyConfig.environment)) {
68
- toml += ` ${key} = "${value}"\n`;
69
- }
70
- toml += `\n`;
71
- } else if (netlifyConfig.autoUpdate === false) {
72
- toml += `[build.environment]\n`;
73
- toml += ` DISABLE_AUTO_UPDATE = "true"\n\n`;
74
- }
75
-
76
- // Plugins
77
- if (netlifyConfig.plugins && netlifyConfig.plugins.length > 0) {
78
- toml += `# Netlify plugins\n`;
79
- netlifyConfig.plugins.forEach(plugin => {
80
- toml += `[[plugins]]\n`;
81
- toml += ` package = "${plugin}"\n\n`;
82
- });
83
- }
84
-
85
- // Redirects
86
- if (netlifyConfig.redirects && netlifyConfig.redirects.length > 0) {
87
- toml += `# Redirects\n`;
88
- netlifyConfig.redirects.forEach(redirect => {
89
- toml += `[[redirects]]\n`;
90
- toml += ` from = "${redirect.from}"\n`;
91
- toml += ` to = "${redirect.to}"\n`;
92
- toml += ` status = ${redirect.status || 301}\n`;
93
- if (redirect.force) {
94
- toml += ` force = true\n`;
95
- }
96
- toml += `\n`;
97
- });
98
- }
99
-
100
- // Headers
101
- if (netlifyConfig.headers && netlifyConfig.headers.length > 0) {
102
- toml += `# Headers\n`;
103
- netlifyConfig.headers.forEach(header => {
104
- toml += `[[headers]]\n`;
105
- toml += ` for = "${header.for}"\n`;
106
- for (const [key, value] of Object.entries(header.values)) {
107
- toml += ` [headers.values]\n`;
108
- toml += ` "${key}" = "${value}"\n`;
109
- }
110
- toml += `\n`;
111
- });
112
- }
113
-
114
- return toml;
115
- }
116
-
117
- async function main() {
118
- console.log('🔧 Generating netlify.toml from maugli.config.ts...');
119
-
120
- const config = await loadMaugliConfig();
121
- if (!config) {
122
- console.warn('⚠️ Could not load maugli configuration, skipping netlify.toml generation');
123
- return;
124
- }
125
-
126
- const tomlContent = generateNetlifyToml(config);
127
- const outputPath = path.join(process.cwd(), 'netlify.toml');
128
-
129
- // Check if netlify.toml already exists
130
- if (fs.existsSync(outputPath)) {
131
- // Read existing content to check if it's auto-generated
132
- const existingContent = fs.readFileSync(outputPath, 'utf8');
133
- if (existingContent.includes('# Netlify configuration generated from maugli.config.ts')) {
134
- console.log('🔄 Updating auto-generated netlify.toml...');
135
- } else {
136
- console.log('⚠️ Custom netlify.toml detected. Creating backup...');
137
- fs.copyFileSync(outputPath, `${outputPath}.backup`);
138
- }
139
- }
140
-
141
- fs.writeFileSync(outputPath, tomlContent, 'utf8');
142
- console.log('✅ netlify.toml generated successfully!');
143
-
144
- if (config.netlify?.autoUpdate === false) {
145
- console.log('🚫 Auto-update disabled in Netlify configuration');
146
- } else {
147
- console.log('🔄 Auto-update enabled for Netlify builds');
148
- }
149
-
150
- // List installed plugins
151
- if (config.netlify?.plugins && config.netlify.plugins.length > 0) {
152
- console.log('🔌 Netlify plugins configured:');
153
-
154
- const manualSetupPlugins = [
155
- 'netlify-plugin-bluesky-custom-domain',
156
- 'netlify-plugin-supabase'
157
- ];
158
-
159
- config.netlify.plugins.forEach(plugin => {
160
- const needsManualSetup = manualSetupPlugins.includes(plugin);
161
- const indicator = needsManualSetup ? '⚙️ ' : '✅ ';
162
- console.log(` ${indicator}${plugin}`);
163
- });
164
-
165
- console.log('\n📋 Manual setup required for:');
166
- console.log(' 🌐 Bluesky: https://app.netlify.com/extensions/bluesky-custom-domain');
167
- console.log(' 🗄️ Supabase: https://app.netlify.com/extensions/supabase');
168
- }
169
-
170
- console.log('📁 File location:', outputPath);
171
- }
172
-
173
- main().catch(error => {
174
- console.error('❌ Failed to generate netlify.toml:', error.message);
175
- process.exit(1);
176
- });