core-maugli 1.0.6 → 1.1.0

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/README.md CHANGED
@@ -1,4 +1,14 @@
1
- # Maugli Blog - Astro & Tailwind CSS Theme by maugli.cfd
1
+ # Maugli Blog - Astro & Tailwind CSS2. **Interface Language** - Choose from:
2
+ - 🇺🇸 English (default)
3
+ - 🇷🇺 Русский
4
+ - 🇪🇸 Español
5
+ - 🇩🇪 Deutsch
6
+ - 🇵🇹 Português
7
+ - 🇫🇷 Français
8
+ - 🇨🇳 中文
9
+ - 🇯🇵 日本語
10
+ 3. **Main Domain** - Do you have a main domain to link this blog to? (e.g., mybrand.com - leave empty if none)
11
+ 4. **Multilingual Support** - Enable/disable multiple languages (disabled by default)maugli.cfd
2
12
 
3
13
  Hi-perfomance, SEO&AI-SEO optimised
4
14
 
@@ -21,7 +31,7 @@ netlify deploy --prod
21
31
 
22
32
  ## Getting started
23
33
 
24
- To start a new project in an empty folder run:
34
+ To start a new project, run the interactive setup:
25
35
 
26
36
  ```bash
27
37
  npx core-maugli init my-blog
@@ -29,8 +39,28 @@ cd my-blog
29
39
  npm run dev
30
40
  ```
31
41
 
42
+ ### Interactive Setup
43
+
44
+ The setup wizard will ask you to configure:
45
+
46
+ 1. **Blog Name** - The display name for your blog (can be changed later in config)
47
+ 2. **Interface Language** - Choose from:
48
+ - 🇺🇸 English (default)
49
+ - 🇸 Español
50
+ - 🇩🇪 Deutsch
51
+ - �� Português
52
+ - �� Français
53
+ - 🇨🇳 中文
54
+ - 🇯🇵 日本語
55
+ 3. **Main Domain** - Your main website URL (leave empty for local blog)
56
+ 4. **Multilingual Support** - Enable/disable multiple languages (disabled by default)
57
+
32
58
  Your blog will be available at `http://localhost:4321/`
33
59
 
60
+ ### Manual Installation
61
+
62
+ If you prefer to install without the interactive setup:
63
+
34
64
  1. **Install dependencies**
35
65
 
36
66
  If you created your project using the provided `init` script, the
@@ -70,9 +100,19 @@ npm test
70
100
 
71
101
  All tests should complete without errors.
72
102
 
73
- If you want to hide the example content included with this theme, set
74
- `showExamples: false` in `src/config/maugli.config.ts`. Example files are
75
- marked with `isExample: true` in their frontmatter.
103
+ ## Configuration
104
+
105
+ ### Initial Setup
106
+ The interactive setup automatically configures your blog based on your choices. All settings can be changed later in `src/config/maugli.config.ts`.
107
+
108
+ ### Customization Options
109
+ - **Blog Name & Description** - Change `brand.name` and `brand.description`
110
+ - **Language Settings** - Modify `defaultLang` and `features.enableMultiLang`
111
+ - **Domain Configuration** - Update `brand.logoHref` for your main site link
112
+ - **Example Content** - Set `showExamples: false` to hide demo content
113
+ - **Theme & Features** - Enable/disable various blog features
114
+
115
+ Example files are marked with `isExample: true` in their frontmatter.
76
116
 
77
117
  ### Useful npm scripts
78
118
 
package/bin/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  const [, , cmd, target] = process.argv;
3
3
 
4
- if (cmd === 'init') {
5
- const mod = await import('./init.js');
6
- await mod.default(target);
7
- } else {
8
- await import('../scripts/upgrade-config.js');
4
+ async function main() {
5
+ if (cmd === 'init') {
6
+ const mod = await import('./init.js');
7
+ await mod.default(target);
8
+ } else {
9
+ await import('../scripts/upgrade-config.js');
10
+ }
9
11
  }
12
+
13
+ main().catch(console.error);
package/bin/init.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { execSync } from 'child_process';
4
- import { cpSync, existsSync, writeFileSync } from 'fs';
4
+ import { cpSync, existsSync, writeFileSync, readFileSync } from 'fs';
5
5
  import path from 'path';
6
6
  import { fileURLToPath } from 'url';
7
7
 
@@ -9,22 +9,99 @@ const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = path.dirname(__filename);
10
10
  const templateRoot = path.join(__dirname, '..');
11
11
 
12
- export default function init(targetName) {
12
+ // Доступные языки интерфейса
13
+ const availableLanguages = [
14
+ { title: 'English', value: 'en' },
15
+ { title: 'Русский', value: 'ru' },
16
+ { title: 'Español', value: 'es' },
17
+ { title: 'Deutsch', value: 'de' },
18
+ { title: 'Português', value: 'pt' },
19
+ { title: 'Français', value: 'fr' },
20
+ { title: '中文', value: 'zh' },
21
+ { title: '日本語', value: 'ja' }
22
+ ];
23
+
24
+ export default async function init(targetName) {
25
+ console.log('🐯 Welcome to Maugli Blog Setup!\n');
26
+
27
+ // Настройки по умолчанию
28
+ let settings = {
29
+ blogName: 'My Maugli Blog',
30
+ language: 'en',
31
+ mainDomain: '',
32
+ enableMultiLang: false
33
+ };
34
+
35
+ // Попытка загрузить prompts для интерактивного режима
36
+ try {
37
+ const prompts = await import('prompts').then(m => m.default);
38
+
39
+ // Интерактивные настройки
40
+ const response = await prompts([
41
+ {
42
+ type: 'text',
43
+ name: 'blogName',
44
+ message: 'What would you like to name your blog?',
45
+ initial: settings.blogName
46
+ },
47
+ {
48
+ type: 'select',
49
+ name: 'language',
50
+ message: 'Choose interface language:',
51
+ choices: availableLanguages,
52
+ initial: 0 // English по умолчанию
53
+ },
54
+ {
55
+ type: 'text',
56
+ name: 'mainDomain',
57
+ message: 'Do you have a main domain to link this blog to? (e.g., mybrand.com - leave empty if none):',
58
+ initial: settings.mainDomain
59
+ },
60
+ {
61
+ type: 'confirm',
62
+ name: 'enableMultiLang',
63
+ message: 'Enable multilingual support?',
64
+ initial: settings.enableMultiLang
65
+ }
66
+ ]);
67
+
68
+ // Если пользователь отменил настройку
69
+ if (!response.blogName && response.blogName !== '') {
70
+ console.log('Setup cancelled.');
71
+ return;
72
+ }
73
+
74
+ settings = { ...settings, ...response };
75
+ } catch (error) {
76
+ console.log('⚠️ Interactive mode unavailable, using default settings...\n');
77
+ }
78
+
79
+ createBlog(targetName, settings);
80
+ }
81
+
82
+ function createBlog(targetName, settings) {
13
83
  const targetDir = targetName ? path.resolve(targetName) : process.cwd();
84
+
85
+ // Проверяем, создана ли папка
86
+ if (targetName && !existsSync(targetDir)) {
87
+ console.log(`\n📁 Creating folder: ${targetName}`);
88
+ }
14
89
 
15
90
  function copyItem(item) {
16
91
  const src = path.join(templateRoot, item);
17
92
  const dest = path.join(targetDir, item);
18
93
 
19
94
  if (!existsSync(src)) {
20
- console.log(`Skipped ${item} (not found)`);
95
+ console.log(`⚠️ Skipped ${item} (not found)`);
21
96
  return;
22
97
  }
23
98
 
24
99
  cpSync(src, dest, { recursive: true });
25
- console.log(`Copied ${item}`);
100
+ console.log(`✅ Copied ${item}`);
26
101
  }
27
102
 
103
+ console.log('\n🔧 Copying files...\n');
104
+
28
105
  // Copy package files first so npm install works correctly
29
106
  ['package.json', 'package-lock.json'].forEach(file => {
30
107
  if (existsSync(path.join(templateRoot, file))) {
@@ -46,6 +123,9 @@ export default function init(targetName) {
46
123
  ];
47
124
  items.forEach(copyItem);
48
125
 
126
+ // Создание конфигурационных файлов
127
+ console.log('\n⚙️ Creating configuration files...\n');
128
+
49
129
  // Create essential config files
50
130
  const gitignoreContent = `
51
131
  # Dependencies
@@ -80,12 +160,75 @@ dist/
80
160
  `;
81
161
 
82
162
  writeFileSync(path.join(targetDir, '.gitignore'), gitignoreContent.trim());
83
- console.log('Created .gitignore');
163
+ console.log('Created .gitignore');
84
164
 
85
165
  writeFileSync(path.join(targetDir, '.prettierrc'), prettierrcContent);
86
- console.log('Created .prettierrc');
166
+ console.log('Created .prettierrc');
167
+
168
+ // Обновление maugli.config.ts с пользовательскими настройками
169
+ console.log('\n🎨 Configuring blog settings...\n');
170
+
171
+ const configPath = path.join(targetDir, 'src/config/maugli.config.ts');
172
+ if (existsSync(configPath)) {
173
+ let configContent = readFileSync(configPath, 'utf8');
174
+
175
+ // Обновляем название блога
176
+ configContent = configContent.replace(
177
+ /name: 'Maugli'/,
178
+ `name: '${settings.blogName}'`
179
+ );
180
+
181
+ // Обновляем язык по умолчанию
182
+ configContent = configContent.replace(
183
+ /defaultLang: 'en'/,
184
+ `defaultLang: '${settings.language}'`
185
+ );
186
+
187
+ // Обновляем мультиязычность
188
+ configContent = configContent.replace(
189
+ /enableMultiLang: false/,
190
+ `enableMultiLang: ${settings.enableMultiLang}`
191
+ );
192
+
193
+ // Обновляем домен (если указан)
194
+ if (settings.mainDomain) {
195
+ configContent = configContent.replace(
196
+ /logoHref: 'https:\/\/maugli\.cfd'/,
197
+ `logoHref: '${settings.mainDomain}'`
198
+ );
199
+ } else {
200
+ // Если домена нет, ссылка ведет на главную страницу блога
201
+ configContent = configContent.replace(
202
+ /logoHref: 'https:\/\/maugli\.cfd'/,
203
+ `logoHref: '/'`
204
+ );
205
+ }
206
+
207
+ // Отключаем примеры для нового блога
208
+ configContent = configContent.replace(
209
+ /showExamples: true/,
210
+ `showExamples: false`
211
+ );
212
+
213
+ writeFileSync(configPath, configContent);
214
+ console.log('✅ Updated maugli.config.ts');
215
+ }
87
216
 
217
+ console.log('\n📦 Installing dependencies...\n');
88
218
  execSync('npm install', { cwd: targetDir, stdio: 'inherit' });
219
+
220
+ console.log('\n🎉 Blog successfully created!\n');
221
+ console.log('Settings:');
222
+ console.log(` 📝 Name: ${settings.blogName}`);
223
+ console.log(` 🌐 Language: ${availableLanguages.find(l => l.value === settings.language)?.title || settings.language}`);
224
+ console.log(` 🔗 Domain: ${settings.mainDomain || 'local blog'}`);
225
+ console.log(` 🌍 Multilingual: ${settings.enableMultiLang ? 'enabled' : 'disabled'}`);
226
+ console.log('\nTo start:');
227
+ if (targetName) {
228
+ console.log(` cd ${targetName}`);
229
+ }
230
+ console.log(' npm run dev\n');
231
+ console.log('📚 All settings can be changed in src/config/maugli.config.ts');
89
232
  }
90
233
 
91
234
  // Если скрипт запускается напрямую
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.0.6",
5
+ "version": "1.1.0",
6
6
  "license": "GPL-3.0-or-later OR Commercial",
7
7
  "repository": {
8
8
  "type": "git",
@@ -32,24 +32,21 @@
32
32
  "postinstall": "node scripts/upgrade-config.js"
33
33
  },
34
34
  "dependencies": {
35
- "@astrojs/mdx": "^4.3.0",
36
- "@astrojs/rss": "^4.0.11",
37
- "@astrojs/sitemap": "^3.4.0",
38
- "@fontsource-variable/geologica": "^5.2.6",
39
- "@fontsource-variable/inter": "^5.2.5",
40
- "@fontsource-variable/newsreader": "^5.2.6",
41
- "@tailwindcss/vite": "^4.0.17",
42
- "astro": "^5.5.6",
43
- "i18next": "^25.3.2",
44
- "js-yaml": "^4.1.0",
45
- "marked": "^15.0.7",
46
- "remark-slug": "^7.0.1",
47
- "sharp": "^0.34.2",
48
- "tailwindcss": "^4.0.17",
49
- "ts-node": "^10.9.2",
50
- "tsx": "^4.20.3",
51
- "typescript": "^5.9.2",
52
- "typograf": "^7.4.4"
35
+ "@astrojs/check": "^0.9.3",
36
+ "@astrojs/mdx": "^3.1.7",
37
+ "@astrojs/rss": "^4.0.7",
38
+ "@astrojs/sitemap": "^3.1.6",
39
+ "@astrojs/tailwind": "^5.1.0",
40
+ "@fontsource/inter": "^5.0.20",
41
+ "@tailwindcss/typography": "^0.5.15",
42
+ "astro": "^4.15.4",
43
+ "clsx": "^2.1.1",
44
+ "fuse.js": "^7.0.0",
45
+ "reading-time": "^1.5.0",
46
+ "slugify": "^1.6.6",
47
+ "tailwindcss": "^3.4.10",
48
+ "typescript": "^5.5.4",
49
+ "prompts": "^2.4.2"
53
50
  },
54
51
  "devDependencies": {
55
52
  "@tailwindcss/typography": "^0.5.16",