Skip to content

Commit 493b2a0

Browse files
committed
Final version bump to v2.1.0 for public release
1 parent c22c901 commit 493b2a0

7 files changed

Lines changed: 54 additions & 16 deletions

File tree

CHANGELOG.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
== Changelog ==
2-
= 2.1.0 - 26-06-2026 =
2+
= 2.1.0 - 30-06-2026 =
33
* Enhance - Batch media import to prevent server timeouts,
44
* Dev - Added data validation to prevent PHP warnings during content import.
55
* Dev - Improved widget import to handle missing plugin data.

gulpfile.mjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
import chalk from 'chalk';
22
import { spawn } from 'child_process';
3+
import { rm } from 'fs/promises';
34
import { dest, parallel, series, src } from 'gulp';
45
import _zip from 'gulp-zip';
56
import path from 'path';
67

8+
async function removeDir(dir) {
9+
try {
10+
await rm(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 500 });
11+
console.log(chalk.green(`✓ Removed: ${dir}`));
12+
} catch (err) {
13+
console.warn(chalk.yellow(`⚠ Could not fully remove ${dir}: ${err.message}`));
14+
}
15+
}
16+
717
function exec(command) {
818
console.log(`Executing: ${command}`);
919

@@ -84,7 +94,7 @@ const copy = parallel(...copyTasks);
8494

8595
const release = series(
8696
function clean() {
87-
return exec(`rm -rf release/ build/`);
97+
return Promise.all([removeDir('release'), removeDir('build')]);
8898
},
8999
function build() {
90100
return exec(`pnpm build`);
@@ -104,7 +114,7 @@ const release = series(
104114
.pipe(dest('release'));
105115
},
106116
function cleanBuild() {
107-
return exec(`rm -rf build/`);
117+
return removeDir('build');
108118
},
109119
);
110120
export { release };

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Bugs can be reported either in our support forum or preferably on the [GitHub re
3333
Yes you can! Join in on our [GitHub repository](https://github.com/themegrill/themegrill-demo-importer/) :)
3434

3535
== Changelog ==
36-
= 2.1.0 - 26-06-2026 =
36+
= 2.1.0 - 30-06-2026 =
3737
* Enhance - Batch media import to prevent server timeouts,
3838
* Dev - Added data validation to prevent PHP warnings during content import.
3939
* Dev - Improved widget import to handle missing plugin data.

resources/onboarding/components/features/sites/components/detail/import/Import.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,11 @@ const Import = () => {
259259
)
260260
)}
261261
{pageImport === 'all' ? (
262-
<Content demo={demo} iframeRef={iframeRef} device={device} />
262+
<Content
263+
demo={demo}
264+
iframeRef={iframeRef}
265+
device={device}
266+
/>
263267
) : (
264268
<Pages pages={allPages} setAllPages={setAllPages} demo={demo} />
265269
)}

resources/onboarding/components/features/sites/components/listing/demos/Demo.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const Demo = ({ demo }: DemoProps) => {
1212
const isPremium = demo?.categories?.find((c) => c === 'premium');
1313

1414
const skeletonSrc = require(`../../../../../../assets/images/demo-skeleton.jpg`);
15+
const githubSrc = demo?.githubImage ?? '';
1516

1617
return (
1718
<Link
@@ -27,9 +28,15 @@ const Demo = ({ demo }: DemoProps) => {
2728
alt=""
2829
onError={(e) => {
2930
const img = e.currentTarget;
30-
img.onerror = null;
31-
img.src = skeletonSrc;
32-
img.className = 'w-full h-full rounded-[2px]';
31+
if (img.src !== githubSrc) {
32+
// Primary URL failed — try GitHub raw.
33+
img.src = githubSrc;
34+
} else {
35+
// GitHub also failed — show skeleton.
36+
img.onerror = null;
37+
img.src = skeletonSrc;
38+
img.className = 'w-full h-full rounded-[2px]';
39+
}
3340
}}
3441
className={`w-full h-full rounded-t-md ${
3542
demo?.previewImage.includes('themegrilldemos') ||

resources/onboarding/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export type DemoType = {
3434
slug: string;
3535
theme_slug: string;
3636
previewImage: string;
37+
githubImage?: string;
3738
new: boolean;
3839
};
3940

src/Admin.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public static function get_demo_packages( $force = false ) {
213213
if ( $force ) {
214214
delete_transient( 'themegrill_demo_importer_demos' );
215215
}
216-
$demos = get_transient( 'themegrill_demo_importer_demos', array() );
216+
$demos = get_transient( 'themegrill_demo_importer_demos' );
217217
if ( empty( $demos ) ) {
218218
$need_fetch = true;
219219
}
@@ -250,8 +250,10 @@ function ( $a, $b ) {
250250
set_transient( 'themegrill_demo_importer_demos', $demos, WEEK_IN_SECONDS );
251251

252252
} else {
253-
// Transient was cached before apply_thumbnail_fallbacks existed; patch in-memory.
253+
// Apply any thumbnail URL migrations to cached data and persist so
254+
// subsequent requests don't need to re-apply.
254255
$demos = static::apply_thumbnail_fallbacks( $demos );
256+
set_transient( 'themegrill_demo_importer_demos', $demos, WEEK_IN_SECONDS );
255257
}
256258
$data = static::get_filtered_data( $demos, $template );
257259
return apply_filters(
@@ -418,16 +420,30 @@ public static function apply_thumbnail_fallbacks( $demos ) {
418420
'online-shop-v2' => 'zakra-online-shop',
419421
'restro-v2' => 'zakra-restro',
420422
),
421-
'colormag' => array(),
423+
'colormag' => array(
424+
'colormag' => 'colormag-free',
425+
'colormag-01' => 'colormag-free-01',
426+
'colormag-02' => 'colormag-free-02',
427+
),
422428
);
423429

424430
foreach ( $demos as $demo ) {
425-
if ( ! empty( $demo->previewImage ) ) {
431+
$theme = $demo->theme_slug;
432+
$folder = $overrides[ $theme ][ $demo->slug ] ?? $demo->slug;
433+
$gh_url = $new_base . '/resources/' . $theme . '/' . $folder . '/screenshot.jpg';
434+
435+
// Always expose the correct GitHub URL so the frontend can use it as a fallback.
436+
$demo->githubImage = $gh_url;
437+
438+
if ( empty( $demo->previewImage ) ) {
439+
$demo->previewImage = $gh_url;
440+
} elseif ( false !== strpos( $demo->previewImage, $old_base ) ) {
441+
// Discontinued CloudFront CDN — swap base, keep path.
426442
$demo->previewImage = str_replace( $old_base, $new_base, $demo->previewImage );
427-
} else {
428-
$theme = $demo->theme_slug;
429-
$folder = $overrides[ $theme ][ $demo->slug ] ?? $demo->slug;
430-
$demo->previewImage = $new_base . '/resources/' . $theme . '/' . $folder . '/screenshot.jpg';
443+
} elseif ( false !== strpos( $demo->previewImage, 'themegrilldemos.com' ) ) {
444+
// Use GitHub directly; letting the browser try themegrilldemos.com first
445+
// causes a slow timeout on every image before the fallback kicks in.
446+
$demo->previewImage = $gh_url;
431447
}
432448
}
433449

0 commit comments

Comments
 (0)