Skip to content

Commit c8a6c5c

Browse files
committed
Migration
1 parent 6dd4c93 commit c8a6c5c

7 files changed

Lines changed: 29 additions & 40 deletions

File tree

astro.config.mjs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ import { remarkTransformRequire } from './src/plugins/remark-transform-require.m
1212
import { remarkTransformDetails } from './src/plugins/remark-transform-details.mjs';
1313
import { remarkHeadingId } from './src/plugins/remark-heading-id.mjs';
1414
import { remarkTransformLinks } from './src/plugins/remark-transform-links.mjs';
15+
import { remarkStripImports } from './src/plugins/remark-strip-imports.mjs';
1516

1617
// https://astro.build/config
1718
export default defineConfig({
19+
site: 'https://adapty.io',
20+
base: '/docs',
1821
outDir: './build',
19-
image: {
20-
service: {
21-
entrypoint: 'astro/assets/services/sharp',
22-
config: {
23-
limitInputPixels: false,
24-
},
25-
},
26-
},
2722
build: {
23+
assets: '_astro',
2824
inlineStylesheets: 'never',
2925
},
3026
vite: {
@@ -44,7 +40,7 @@ export default defineConfig({
4440
},
4541

4642
markdown: {
47-
remarkPlugins: [remarkHeadingId, remarkDirective, remarkAside, remarkTransformRequire, remarkTransformDetails, remarkTransformLinks],
43+
remarkPlugins: [remarkHeadingId, remarkDirective, remarkAside, remarkStripImports, remarkTransformRequire, remarkTransformDetails, remarkTransformLinks],
4844
shikiConfig: {
4945
theme: 'github-light',
5046
wrap: true,
@@ -73,7 +69,7 @@ export default defineConfig({
7369
integrations: [
7470
react(),
7571
mdx({
76-
remarkPlugins: [remarkHeadingId, remarkDirective, remarkAside, remarkTransformRequire, remarkTransformDetails, remarkTransformLinks],
72+
remarkPlugins: [remarkHeadingId, remarkDirective, remarkAside, remarkStripImports, remarkTransformRequire, remarkTransformDetails, remarkTransformLinks],
7773
shikiConfig: {
7874
theme: 'github-light',
7975
wrap: true,

src/components/Header.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const links = [
1616

1717
<div class="flex items-center gap-12">
1818
<!-- Logo -->
19-
<a href="/" class="flex-shrink-0 block hover:opacity-80 transition-opacity">
20-
<img src="/logo.svg" alt="Adapty" class="h-6 w-auto header-logo" />
19+
<a href={import.meta.env.BASE_URL} class="flex-shrink-0 block hover:opacity-80 transition-opacity">
20+
<img src={`${import.meta.env.BASE_URL}/logo.svg`} alt="Adapty" class="h-6 w-auto header-logo" />
2121
</a>
2222

2323
<!-- Desktop Navigation -->

src/components/MDXImage.astro

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
import { Image } from 'astro:assets';
3-
2+
// MDXImage.astro - custom image resolution
43
interface Props {
54
src: string;
65
alt?: string;
@@ -37,19 +36,19 @@ if (src.startsWith('http') || src.startsWith('/_astro/') || src.startsWith('/@fs
3736
3837
if (id) {
3938
// Priority 1: Article-specific
40-
const articleSpecificPrefix = `/src/assets/${articleName}/`;
39+
const articleSpecificPart = `/assets/${articleName}/`;
4140
for (const [path, module] of Object.entries(allImages)) {
42-
if (path.includes(articleSpecificPrefix) && path.split('/').pop() === id) {
41+
if (path.includes(articleSpecificPart) && path.split('/').pop() === id) {
4342
imageSrc = module.default;
4443
break;
4544
}
4645
}
4746
4847
// Priority 2: Shared
4948
if (!imageSrc) {
50-
const sharedPrefix = `/src/assets/shared/`;
49+
const sharedPart = `/assets/shared/`;
5150
for (const [path, module] of Object.entries(allImages)) {
52-
if (path.includes(sharedPrefix) && path.split('/').pop() === id) {
51+
if (path.includes(sharedPart) && path.split('/').pop() === id) {
5352
imageSrc = module.default;
5453
break;
5554
}
@@ -60,9 +59,9 @@ if (src.startsWith('http') || src.startsWith('/_astro/') || src.startsWith('/@fs
6059
if (!imageSrc) {
6160
const legacyFolders = ['img', 'FF_img', 'img_webhook_flows'];
6261
for (const folder of legacyFolders) {
63-
const legacyPathPart = `/src/content/docs/version-3.0/${folder}/`;
62+
const legacyPart = `/version-3.0/${folder}/`;
6463
for (const [path, module] of Object.entries(allImages)) {
65-
if (path.includes(legacyPathPart) && path.split('/').pop() === id) {
64+
if (path.includes(legacyPart) && path.split('/').pop() === id) {
6665
imageSrc = module.default;
6766
break;
6867
}
@@ -115,8 +114,8 @@ if (width) {
115114
---
116115

117116
{imageSrc ? (
118-
<Image
119-
src={imageSrc}
117+
<img
118+
src={imageSrc.src}
120119
alt={alt || id || ''}
121120
width={finalWidth}
122121
height={finalHeight}

src/components/ZoomImage.astro

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import { Image } from 'astro:assets';
32
import Zoom from './Zoom.astro';
43
54
interface Props {
@@ -38,9 +37,9 @@ let resolvedPath: string | undefined;
3837
*/
3938
4039
// Priority 1: Article-specific images
41-
const articleSpecificPrefix = `/src/assets/${articleName}/`;
40+
const articleSpecificPart = `/assets/${articleName}/`;
4241
for (const [path, module] of Object.entries(allImages)) {
43-
if (path.includes(articleSpecificPrefix) && path.split('/').pop() === normalizedId) {
42+
if (path.includes(articleSpecificPart) && path.split('/').pop() === normalizedId) {
4443
imageSrc = module.default;
4544
resolvedPath = path;
4645
break;
@@ -49,9 +48,9 @@ for (const [path, module] of Object.entries(allImages)) {
4948
5049
// Priority 2: Shared images
5150
if (!imageSrc) {
52-
const sharedPrefix = `/src/assets/shared/`;
51+
const sharedPart = `/assets/shared/`;
5352
for (const [path, module] of Object.entries(allImages)) {
54-
if (path.includes(sharedPrefix) && path.split('/').pop() === normalizedId) {
53+
if (path.includes(sharedPart) && path.split('/').pop() === normalizedId) {
5554
imageSrc = module.default;
5655
resolvedPath = path;
5756
break;
@@ -64,9 +63,9 @@ if (!imageSrc) {
6463
const legacyFolders = ['img', 'FF_img', 'img_webhook_flows'];
6564
6665
for (const folder of legacyFolders) {
67-
const legacyPathPart = `/src/content/docs/version-3.0/${folder}/`;
66+
const legacyPart = `/version-3.0/${folder}/`;
6867
for (const [path, module] of Object.entries(allImages)) {
69-
if (path.includes(legacyPathPart) && path.split('/').pop() === normalizedId) {
68+
if (path.includes(legacyPart) && path.split('/').pop() === normalizedId) {
7069
imageSrc = module.default;
7170
resolvedPath = path;
7271
break;
@@ -110,8 +109,8 @@ if (!imageSrc) {
110109

111110
{imageSrc ? (
112111
<Zoom>
113-
<Image
114-
src={imageSrc}
112+
<img
113+
src={imageSrc.src}
115114
alt={alt || id}
116115
width={parseInt(width.replace('px', '')) || 700}
117116
class:list={[

src/components/reusable/AddAudience.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11

22

3-
import Zoom from 'react-medium-image-zoom';
4-
import 'react-medium-image-zoom/dist/styles.css';
5-
63
:::note
74
To proceed, ensure that you created a paywall, onboarding, or A/B test you want to run and an audience, you'd like to specify.
85
:::
@@ -11,7 +8,7 @@ To proceed, ensure that you created a paywall, onboarding, or A/B test you want
118
2. If you want to use more than one audience in the placement to create personalized paywalls tailored to different user groups, click the **Add audience** button and choose the desired user segment from the list.
129

1310
<Zoom>
14-
<img src="/img/placement-add-audience.webp"
11+
<img src="placement-add-audience.webp"
1512
style={{
1613
border: '1px solid #727272', /* border width and color */
1714
width: '700px', /* image width */

src/components/reusable/ProvideBundleID.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
no_index: true
33
---
4-
import Zoom from 'react-medium-image-zoom';
5-
import 'react-medium-image-zoom/dist/styles.css';
64

75
1. Open [App Store Connect](https://appstoreconnect.apple.com/apps). Select your app and proceed to **General****App Information** section.
86

@@ -11,7 +9,7 @@ import 'react-medium-image-zoom/dist/styles.css';
119

1210

1311
<Zoom>
14-
<img src="/img/afd5012-bundle_id_apple.webp"
12+
<img src="afd5012-bundle_id_apple.webp"
1513
style={{
1614
border: '1px solid #727272', /* border width and color */
1715
width: '700px', /* image width */
@@ -29,7 +27,7 @@ import 'react-medium-image-zoom/dist/styles.css';
2927

3028

3129
<Zoom>
32-
<img src="/img/2d64163-bundle_id.webp"
30+
<img src="2d64163-bundle_id.webp"
3331
style={{
3432
border: '1px solid #727272', /* border width and color */
3533
width: '700px', /* image width */

src/layouts/DocsLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const keywordsString = Array.isArray(keywords) ? keywords.join(', ') : keywords;
3434
<head>
3535
<meta charset="UTF-8" />
3636
<meta name="viewport" content="width=device-width" />
37-
<link rel="icon" type="image/svg+xml" href="/favicon_black.svg" />
37+
<link rel="icon" type="image/svg+xml" href={`${import.meta.env.BASE_URL}/favicon_black.svg`} />
3838
<meta name="generator" content={Astro.generator} />
3939
<title>{derivedTitle}</title>
4040

0 commit comments

Comments
 (0)