ultimate-jekyll-manager 0.0.94 → 0.0.96

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.
@@ -0,0 +1,331 @@
1
+ // Libraries
2
+ const Manager = new (require('../build.js'));
3
+ const logger = Manager.logger('migrate');
4
+ const { execute } = require('node-powertools');
5
+ const path = require('path');
6
+ const jetpack = require('fs-jetpack');
7
+
8
+ // Load package
9
+ const package = Manager.getPackage('main');
10
+
11
+ module.exports = async function () {
12
+ // Log
13
+ logger.log(`Starting migration to Ultimate Jekyll v${package.version}...`);
14
+ logger.log(`Current working directory: ${process.cwd()}`);
15
+
16
+ try {
17
+ // Run migration tasks
18
+ await migratePosts();
19
+ await migrateAssets();
20
+ await fixPostsLayout();
21
+ await fixPostFilenames();
22
+
23
+ // Log completion
24
+ logger.log(logger.format.green('✓ Migration complete!'));
25
+ } catch (e) {
26
+ logger.error('Migration failed:', e);
27
+ throw e;
28
+ }
29
+ };
30
+
31
+ async function migratePosts() {
32
+ const sourcePath = path.join(process.cwd(), '_posts');
33
+ const targetPath = path.join(process.cwd(), 'src', '_posts');
34
+
35
+ // Check if _posts exists in root
36
+ const sourceExists = jetpack.exists(sourcePath);
37
+
38
+ if (!sourceExists) {
39
+ logger.log('No _posts directory found in root - skipping posts migration');
40
+ return;
41
+ }
42
+
43
+ // Check if target already exists
44
+ const targetExists = jetpack.exists(targetPath);
45
+
46
+ if (targetExists) {
47
+ logger.warn(`Target directory ${targetPath} already exists!`);
48
+ logger.log('Checking for conflicts...');
49
+
50
+ // Get list of files in both directories
51
+ const sourceFiles = jetpack.list(sourcePath) || [];
52
+ const targetFiles = jetpack.list(targetPath) || [];
53
+
54
+ // Find conflicts
55
+ const conflicts = sourceFiles.filter((file) => targetFiles.includes(file));
56
+
57
+ if (conflicts.length > 0) {
58
+ logger.warn(`Found ${conflicts.length} conflicting file(s):`);
59
+ conflicts.forEach((file) => logger.warn(` - ${file}`));
60
+ throw new Error('Cannot migrate _posts: conflicts detected. Please resolve manually.');
61
+ }
62
+ }
63
+
64
+ // Log the migration
65
+ logger.log(`Migrating _posts from root to src/...`);
66
+ logger.log(` Source: ${sourcePath}`);
67
+ logger.log(` Target: ${targetPath}`);
68
+
69
+ // Ensure target directory exists
70
+ jetpack.dir(path.dirname(targetPath));
71
+
72
+ // Move the directory
73
+ jetpack.move(sourcePath, targetPath);
74
+
75
+ // Verify the move
76
+ const moveSuccessful = jetpack.exists(targetPath)
77
+ && !jetpack.exists(sourcePath);
78
+
79
+ if (moveSuccessful) {
80
+ logger.log(logger.format.green('✓ Successfully migrated _posts to src/_posts'));
81
+ } else {
82
+ throw new Error('Failed to migrate _posts directory');
83
+ }
84
+ }
85
+
86
+ async function migrateAssets() {
87
+ const sourcePath = path.join(process.cwd(), 'assets');
88
+ const targetPath = path.join(process.cwd(), 'src', 'assets');
89
+
90
+ // Check if assets exists in root
91
+ const sourceExists = jetpack.exists(sourcePath);
92
+
93
+ if (!sourceExists) {
94
+ logger.log('No assets directory found in root - skipping assets migration');
95
+ return;
96
+ }
97
+
98
+ // Check if target already exists
99
+ const targetExists = jetpack.exists(targetPath);
100
+
101
+ if (targetExists) {
102
+ logger.warn(`Target directory ${targetPath} already exists!`);
103
+ logger.log('Merging assets directories...');
104
+
105
+ // Get list of files in both directories (recursively)
106
+ const sourceFiles = jetpack.find(sourcePath, { matching: '**/*' }) || [];
107
+ const targetFiles = jetpack.find(targetPath, { matching: '**/*' }) || [];
108
+
109
+ // Convert to relative paths for comparison
110
+ const sourceRelative = sourceFiles.map((f) => path.relative(sourcePath, f));
111
+ const targetRelative = targetFiles.map((f) => path.relative(targetPath, f));
112
+
113
+ // Find conflicts
114
+ const conflicts = sourceRelative.filter((file) => targetRelative.includes(file));
115
+
116
+ if (conflicts.length > 0) {
117
+ logger.warn(`Found ${conflicts.length} conflicting file(s):`);
118
+ conflicts.slice(0, 10).forEach((file) => logger.warn(` - ${file}`));
119
+ if (conflicts.length > 10) {
120
+ logger.warn(` ... and ${conflicts.length - 10} more`);
121
+ }
122
+ throw new Error('Cannot migrate assets: conflicts detected. Please resolve manually.');
123
+ }
124
+
125
+ // Move all files from source to target
126
+ logger.log('Moving files...');
127
+ sourceRelative.forEach((file) => {
128
+ const src = path.join(sourcePath, file);
129
+ const dest = path.join(targetPath, file);
130
+
131
+ // Only move files, not directories
132
+ if (jetpack.exists(src) === 'file') {
133
+ jetpack.move(src, dest);
134
+ }
135
+ });
136
+
137
+ // Remove the old assets directory
138
+ jetpack.remove(sourcePath);
139
+
140
+ logger.log(logger.format.green('✓ Successfully merged assets into src/assets'));
141
+ } else {
142
+ // Log the migration
143
+ logger.log(`Migrating assets from root to src/...`);
144
+ logger.log(` Source: ${sourcePath}`);
145
+ logger.log(` Target: ${targetPath}`);
146
+
147
+ // Ensure target directory parent exists
148
+ jetpack.dir(path.dirname(targetPath));
149
+
150
+ // Move the directory
151
+ jetpack.move(sourcePath, targetPath);
152
+
153
+ // Verify the move
154
+ const moveSuccessful = jetpack.exists(targetPath)
155
+ && !jetpack.exists(sourcePath);
156
+
157
+ if (moveSuccessful) {
158
+ logger.log(logger.format.green('✓ Successfully migrated assets to src/assets'));
159
+ } else {
160
+ throw new Error('Failed to migrate assets directory');
161
+ }
162
+ }
163
+ }
164
+
165
+ async function fixPostsLayout() {
166
+ const postsPath = path.join(process.cwd(), 'src', '_posts');
167
+
168
+ // Check if posts directory exists
169
+ const postsExists = jetpack.exists(postsPath);
170
+
171
+ if (!postsExists) {
172
+ logger.log('No src/_posts directory found - skipping layout fix');
173
+ return;
174
+ }
175
+
176
+ // Get all post files
177
+ const postFiles = jetpack.find(postsPath, {
178
+ matching: ['*.md', '*.html', '*.markdown'],
179
+ }) || [];
180
+
181
+ if (postFiles.length === 0) {
182
+ logger.log('No post files found in src/_posts - skipping layout fix');
183
+ return;
184
+ }
185
+
186
+ // Log
187
+ logger.log(`Fixing ${postFiles.length} post file(s)...`);
188
+
189
+ let updatedCount = 0;
190
+
191
+ // Process each post file
192
+ postFiles.forEach((file) => {
193
+ const content = jetpack.read(file);
194
+
195
+ if (!content) {
196
+ return;
197
+ }
198
+
199
+ // Match frontmatter
200
+ const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n---/;
201
+ const match = content.match(frontmatterRegex);
202
+
203
+ if (!match) {
204
+ logger.warn(` Skipping ${path.basename(file)} - no frontmatter found`);
205
+ return;
206
+ }
207
+
208
+ let frontmatter = match[1];
209
+ let restOfContent = content.slice(match[0].length);
210
+ let modified = false;
211
+
212
+ // 1. Fix layout if needed
213
+ if (!frontmatter.includes('layout: blueprint/blog/post')) {
214
+ frontmatter = frontmatter.replace(
215
+ /^layout:\s*.+$/m,
216
+ 'layout: blueprint/blog/post'
217
+ );
218
+ modified = true;
219
+ }
220
+
221
+ // 2. Change excerpt to description
222
+ if (frontmatter.includes('excerpt:')) {
223
+ frontmatter = frontmatter.replace(
224
+ /^excerpt:/m,
225
+ 'description:'
226
+ );
227
+ modified = true;
228
+ }
229
+
230
+ // 3. Remove affiliate-search-term line
231
+ if (frontmatter.includes('affiliate-search-term:')) {
232
+ frontmatter = frontmatter.replace(
233
+ /^affiliate-search-term:.*\r?\n/m,
234
+ ''
235
+ );
236
+ modified = true;
237
+ }
238
+
239
+ // 4. Remove ad unit includes from content
240
+ const adUnitRegex = /{%\s*include\s+\/master\/modules\/adunits\/adsense-in-article\.html\s+index="[^"]*"\s*%}/g;
241
+ const cleanedContent = restOfContent.replace(adUnitRegex, '');
242
+
243
+ if (cleanedContent !== restOfContent) {
244
+ restOfContent = cleanedContent;
245
+ modified = true;
246
+ }
247
+
248
+ // Only write if modifications were made
249
+ if (!modified) {
250
+ return;
251
+ }
252
+
253
+ // Write back to file
254
+ const updatedContent = `---\n${frontmatter}\n---${restOfContent}`;
255
+ jetpack.write(file, updatedContent);
256
+
257
+ updatedCount++;
258
+ logger.log(` ✓ Updated ${path.basename(file)}`);
259
+ });
260
+
261
+ if (updatedCount > 0) {
262
+ logger.log(logger.format.green(`✓ Fixed ${updatedCount} post file(s)`));
263
+ } else {
264
+ logger.log('All posts are already up to date');
265
+ }
266
+ }
267
+
268
+ async function fixPostFilenames() {
269
+ const postsPath = path.join(process.cwd(), 'src', '_posts');
270
+
271
+ // Check if posts directory exists
272
+ const postsExists = jetpack.exists(postsPath);
273
+
274
+ if (!postsExists) {
275
+ logger.log('No src/_posts directory found - skipping filename fix');
276
+ return;
277
+ }
278
+
279
+ // Get all post files
280
+ const postFiles = jetpack.find(postsPath, {
281
+ matching: ['*.md', '*.html', '*.markdown'],
282
+ }) || [];
283
+
284
+ if (postFiles.length === 0) {
285
+ logger.log('No post files found in src/_posts - skipping filename fix');
286
+ return;
287
+ }
288
+
289
+ // Log
290
+ logger.log(`Checking post filenames for trailing and leading dashes...`);
291
+
292
+ let renamedCount = 0;
293
+
294
+ // Process each post file
295
+ postFiles.forEach((file) => {
296
+ const dir = path.dirname(file);
297
+ const basename = path.basename(file);
298
+ const ext = path.extname(basename);
299
+ const nameWithoutExt = basename.slice(0, -ext.length);
300
+
301
+ // Remove leading and trailing dashes only
302
+ const cleanedName = nameWithoutExt.replace(/^-+|-+$/g, '');
303
+
304
+ // Check if name changed
305
+ if (cleanedName === nameWithoutExt) {
306
+ return;
307
+ }
308
+
309
+ // Build new filename
310
+ const newFilename = `${cleanedName}${ext}`;
311
+ const newPath = path.join(dir, newFilename);
312
+
313
+ // Check if target already exists
314
+ if (jetpack.exists(newPath)) {
315
+ logger.warn(` Cannot rename ${basename} - ${newFilename} already exists`);
316
+ return;
317
+ }
318
+
319
+ // Rename the file
320
+ jetpack.move(file, newPath);
321
+
322
+ renamedCount++;
323
+ logger.log(` ✓ Renamed ${basename} → ${newFilename}`);
324
+ });
325
+
326
+ if (renamedCount > 0) {
327
+ logger.log(logger.format.green(`✓ Renamed ${renamedCount} post file(s)`));
328
+ } else {
329
+ logger.log('All post filenames are already clean');
330
+ }
331
+ }
@@ -0,0 +1,29 @@
1
+ ---
2
+ ### ALL PAGES ###
3
+ layout: themes/[ site.theme.id ]/frontend/core/base
4
+ permalink: /test/libraries/error
5
+
6
+ ### REGULAR PAGES ###
7
+ meta:
8
+ title: "Error Test Page"
9
+ description: "Test page for demonstrating error handling"
10
+ breadcrumb: "Error Test"
11
+ ---
12
+
13
+ <div class="container py-5">
14
+ <div class="row">
15
+ <div class="col-lg-8 mx-auto">
16
+ <h1 class="h2 mb-4">Error Test Page</h1>
17
+ <p class="lead mb-5">This page demonstrates different error handling scenarios.</p>
18
+
19
+ <!-- Trigger Auth Signin Error -->
20
+ <button id="trigger-error" class="btn btn-danger">Trigger Auth Signin Error</button>
21
+ <script>
22
+ document.getElementById('trigger-error').addEventListener('click', function() {
23
+ Manager.webManager.auth().signInWithEmailAndPassword('invalid@example.com', 'wrongpassword')
24
+ });
25
+ </script>
26
+
27
+ </div>
28
+ </div>
29
+ </div>
@@ -13,7 +13,7 @@ sitemap:
13
13
  xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
14
14
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
15
15
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16
- xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
16
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
17
17
  >
18
18
  {% assign pages = site.pages %}
19
19
  {% assign default-time = site.time | date_to_xmlschema %}
@@ -82,6 +82,11 @@ let index = -1;
82
82
  const input = [
83
83
  // Files to include
84
84
  '_site/**/*.html',
85
+
86
+ // Files to exclude
87
+ // Test pages (except translation.html)
88
+ '!_site/**/test/**',
89
+ '_site/test/translation.html',
85
90
  ];
86
91
  const output = '';
87
92
  const delay = 250;
@@ -104,7 +104,11 @@ function getSettings() {
104
104
  ? DEFAULT_WEBPACK_TARGET
105
105
  : (ujmConfig?.webpack?.target || DEFAULT_WEBPACK_TARGET)
106
106
  ],
107
- devtool: Manager.actLikeProduction() ? 'source-map' : 'eval-source-map',
107
+ // devtool: Manager.actLikeProduction() ? 'source-map' : 'eval-source-map',
108
+ // Production: nosources-source-map, hidden-source-map
109
+ devtool: Manager.actLikeProduction() ? false : 'eval-source-map',
110
+ // devtool: 'nosources-source-map',
111
+ // devtool: 'source-map',
108
112
  // devtool: false,
109
113
  plugins: [
110
114
  new StripDevBlocksPlugin(),
@@ -213,7 +217,8 @@ function getSettings() {
213
217
  use: {
214
218
  loader: 'babel-loader',
215
219
  options: {
216
- sourceMaps: true,
220
+ // sourceMaps: false,
221
+ sourceMaps: !Manager.actLikeProduction(),
217
222
  presets: [
218
223
  [require.resolve('@babel/preset-env', {
219
224
  paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
@@ -319,7 +324,8 @@ function webpack(complete) {
319
324
  use: {
320
325
  loader: 'babel-loader',
321
326
  options: {
322
- sourceMaps: true,
327
+ // sourceMaps: false,
328
+ sourceMaps: !Manager.actLikeProduction(),
323
329
  presets: [
324
330
  [require.resolve('@babel/preset-env', {
325
331
  paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
@@ -62,3 +62,35 @@
62
62
  [debug] [2025-10-22T08:40:01.644Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
63
63
  [debug] [2025-10-22T08:40:01.644Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
64
64
  [debug] [2025-10-22T08:40:01.644Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
65
+ [debug] [2025-10-22T09:43:23.845Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
66
+ [debug] [2025-10-22T09:43:23.848Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
67
+ [debug] [2025-10-22T09:43:23.848Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
68
+ [debug] [2025-10-22T09:43:23.848Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
69
+ [debug] [2025-10-22T09:43:23.847Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
70
+ [debug] [2025-10-22T09:43:23.853Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
71
+ [debug] [2025-10-22T09:43:23.853Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
72
+ [debug] [2025-10-22T09:43:23.854Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
73
+ [debug] [2025-10-22T10:05:29.839Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
74
+ [debug] [2025-10-22T10:05:29.841Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
75
+ [debug] [2025-10-22T10:05:29.841Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
76
+ [debug] [2025-10-22T10:05:29.841Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
77
+ [debug] [2025-10-22T10:05:29.842Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
78
+ [debug] [2025-10-22T10:05:29.844Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
79
+ [debug] [2025-10-22T10:05:29.844Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
80
+ [debug] [2025-10-22T10:05:29.844Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
81
+ [debug] [2025-10-22T10:35:12.194Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
82
+ [debug] [2025-10-22T10:35:12.196Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
83
+ [debug] [2025-10-22T10:35:12.197Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
84
+ [debug] [2025-10-22T10:35:12.197Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
85
+ [debug] [2025-10-22T10:35:12.197Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
86
+ [debug] [2025-10-22T10:35:12.198Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
87
+ [debug] [2025-10-22T10:35:12.198Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
88
+ [debug] [2025-10-22T10:35:12.198Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
89
+ [debug] [2025-10-22T10:58:48.148Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
90
+ [debug] [2025-10-22T10:58:48.148Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
91
+ [debug] [2025-10-22T10:58:48.151Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
92
+ [debug] [2025-10-22T10:58:48.151Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
93
+ [debug] [2025-10-22T10:58:48.151Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
94
+ [debug] [2025-10-22T10:58:48.151Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
95
+ [debug] [2025-10-22T10:58:48.151Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
96
+ [debug] [2025-10-22T10:58:48.152Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-jekyll-manager",
3
- "version": "0.0.94",
3
+ "version": "0.0.96",
4
4
  "description": "Ultimate Jekyll dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {