core-maugli 1.0.6 → 1.1.1

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,16 @@
1
- # Maugli Blog - Astro & Tailwind CSS Theme by maugli.cfd
1
+ # Maugli Blog - Astro & Tailwind CSS2. **Interface Language** - Choose from:
2
+
3
+ - 🇺🇸 English (default)
4
+ - 🇷🇺 Русский
5
+ - 🇪🇸 Español
6
+ - 🇩🇪 Deutsch
7
+ - 🇵🇹 Português
8
+ - 🇫🇷 Français
9
+ - 🇨🇳 中文
10
+ - 🇯🇵 日本語
11
+
12
+ 3. **Main Domain** - Do you have a main domain to link this blog to? (e.g., mybrand.com - leave empty if none)
13
+ 4. **Multilingual Support** - Enable/disable multiple languages (disabled by default)maugli.cfd
2
14
 
3
15
  Hi-perfomance, SEO&AI-SEO optimised
4
16
 
@@ -21,7 +33,7 @@ netlify deploy --prod
21
33
 
22
34
  ## Getting started
23
35
 
24
- To start a new project in an empty folder run:
36
+ To start a new project, run the interactive setup:
25
37
 
26
38
  ```bash
27
39
  npx core-maugli init my-blog
@@ -29,8 +41,28 @@ cd my-blog
29
41
  npm run dev
30
42
  ```
31
43
 
44
+ ### Interactive Setup
45
+
46
+ The setup wizard will ask you to configure:
47
+
48
+ 1. **Blog Name** - The display name for your blog (can be changed later in config)
49
+ 2. **Interface Language** - Choose from:
50
+ - 🇺🇸 English (default)
51
+ - 🇸 Español
52
+ - 🇩🇪 Deutsch
53
+ - �� Português
54
+ - �� Français
55
+ - 🇨🇳 中文
56
+ - 🇯🇵 日本語
57
+ 3. **Main Domain** - Your main website URL (leave empty for local blog)
58
+ 4. **Multilingual Support** - Enable/disable multiple languages (disabled by default)
59
+
32
60
  Your blog will be available at `http://localhost:4321/`
33
61
 
62
+ ### Manual Installation
63
+
64
+ If you prefer to install without the interactive setup:
65
+
34
66
  1. **Install dependencies**
35
67
 
36
68
  If you created your project using the provided `init` script, the
@@ -70,9 +102,29 @@ npm test
70
102
 
71
103
  All tests should complete without errors.
72
104
 
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.
105
+ ## Configuration
106
+
107
+ ### Initial Setup
108
+
109
+ The interactive setup automatically configures your blog based on your choices. All settings can be changed later in `src/config/maugli.config.ts`.
110
+
111
+ ### Customization Options
112
+
113
+ - **Blog Name & Description** - Change `brand.name` and `brand.description`
114
+ - **Language Settings** - Modify `defaultLang` and `features.enableMultiLang`
115
+ - **Domain Configuration** - Update `brand.logoHref` for your main site link
116
+ - **Example Content** - Set `showExamples: false` to hide demo content
117
+ - **Theme & Features** - Enable/disable various blog features
118
+
119
+ Example files are marked with `isExample: true` in their frontmatter.
120
+
121
+ ### CLI Commands
122
+
123
+ | Command | Description |
124
+ | ----------------------------- | ---------------------------------------- |
125
+ | `npx core-maugli init <name>` | Create a new blog with interactive setup |
126
+ | `npx core-maugli version` | Show package version |
127
+ | `npx core-maugli update` | Update config to latest version |
76
128
 
77
129
  ### Useful npm scripts
78
130
 
package/bin/index.js CHANGED
@@ -1,9 +1,23 @@
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 if (cmd === '--version' || cmd === '-v' || cmd === 'version') {
9
+ await import('./version.js');
10
+ } else if (cmd === 'update' || cmd === 'upgrade') {
11
+ await import('../scripts/upgrade-config.js');
12
+ } else {
13
+ console.log('Usage:');
14
+ console.log(' core-maugli init <project-name> Create a new blog');
15
+ console.log(' core-maugli version Show version');
16
+ console.log(' core-maugli update Update config to latest');
17
+ console.log('');
18
+ console.log('Example:');
19
+ console.log(' npx core-maugli init my-blog');
20
+ }
9
21
  }
22
+
23
+ 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/bin/version.js ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { readFileSync } from 'fs';
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
+ const packagePath = path.join(__dirname, '../package.json');
11
+ const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
12
+
13
+ console.log(`core-maugli v${packageJson.version}`);
14
+ console.log(`Astro & Tailwind CSS blog theme for Maugli`);
15
+ console.log(`Repository: ${packageJson.repository.url}`);
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.1",
6
6
  "license": "GPL-3.0-or-later OR Commercial",
7
7
  "repository": {
8
8
  "type": "git",
@@ -22,7 +22,7 @@
22
22
  "dev": "astro dev",
23
23
  "start": "astro dev",
24
24
  "build": "node typograf-batch.js && node scripts/verify-assets.js && astro build",
25
- "test": "node tests/examplesFilter.test.ts",
25
+ "test": "node tests/examplesFilter.demo.mjs",
26
26
  "astro": "astro",
27
27
  "featured:add": "node scripts/featured.js add",
28
28
  "featured:remove": "node scripts/featured.js remove",
@@ -32,24 +32,23 @@
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",
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
+ "prompts": "^2.4.2",
46
+ "reading-time": "^1.5.0",
46
47
  "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"
48
+ "slugify": "^1.6.6",
49
+ "tailwindcss": "^3.4.10",
50
+ "typograf": "^7.4.4",
51
+ "typescript": "^5.5.4"
53
52
  },
54
53
  "devDependencies": {
55
54
  "@tailwindcss/typography": "^0.5.16",