Skip to content

Commit 4aa45fd

Browse files
fix(utils/open-graph): skip generateOpenGraphImage when in CI
1 parent 91d75f0 commit 4aa45fd

File tree

55 files changed

+22
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+22
-8
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,3 @@ src/graphql/schema.ts
2626

2727
# Contentlayer
2828
.contentlayer
29-
30-
# OG Images
31-
public/**/cover.png
32-
!public/content/cover.png

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"got": "12.6.0",
5353
"graphql": "16.8.1",
5454
"handlebars": "4.7.8",
55+
"is-in-ci": "^0.1.0",
5556
"mdx-bundler": "10.0.1",
5657
"next": "14.2.3",
5758
"next-contentlayer": "0.3.4",

pnpm-lock.yaml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.33 MB

public/content/about/cover.png

1.18 MB
1.23 MB

public/content/about/life/cover.png

1.34 MB
1.24 MB

public/content/about/uses/cover.png

1.28 MB
2.59 MB

public/content/posts/cover.png

1.32 MB

public/content/talks/cover.png

1.17 MB

public/content/talks/radar/cover.png

1.11 MB

public/content/talks/rider/cover.png

1.06 MB

public/sitemap.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<url><loc>https://www.albuquerque.dev/talks</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
99
<url><loc>https://www.albuquerque.dev/talks/radar</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
1010
<url><loc>https://www.albuquerque.dev/talks/rider</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
11+
<url><loc>https://www.albuquerque.dev/about/clients</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
12+
<url><loc>https://www.albuquerque.dev/about/life</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
13+
<url><loc>https://www.albuquerque.dev/about/speaker-rider</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
14+
<url><loc>https://www.albuquerque.dev/about/uses</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
1115
<url><loc>https://www.albuquerque.dev/posts/how-expensive-is-prague</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
1216
<url><loc>https://www.albuquerque.dev/posts/2022-wrapped</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
1317
<url><loc>https://www.albuquerque.dev/posts/jheniffer-was-always-my-favorite-color</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
@@ -16,10 +20,6 @@
1620
<url><loc>https://www.albuquerque.dev/posts/a-whole-day-playing-with-ipfs</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
1721
<url><loc>https://www.albuquerque.dev/posts/swift-in-the-sky-with-types</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
1822
<url><loc>https://www.albuquerque.dev/posts/o-que-ha-de-novo-com-o-angularjs</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
19-
<url><loc>https://www.albuquerque.dev/about/clients</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
20-
<url><loc>https://www.albuquerque.dev/about/life</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
21-
<url><loc>https://www.albuquerque.dev/about/speaker-rider</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
22-
<url><loc>https://www.albuquerque.dev/about/uses</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
2323
<url><loc>https://www.albuquerque.dev/talks/a-decade-reacts-rhapsody-of-life</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
2424
<url><loc>https://www.albuquerque.dev/talks/speed-at-scale-optimizing-the-largest-cx-platform-out-there</loc><changefreq>daily</changefreq><priority>0.7</priority></url>
2525
<url><loc>https://www.albuquerque.dev/talks/hydration-islands-streaming-resumability-oh-my</loc><changefreq>daily</changefreq><priority>0.7</priority></url>

src/utils/open-graph/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { readFileSync } from 'fs';
22
import { outputFile } from 'fs-extra';
33
import { compile } from 'handlebars';
4+
import isInCi from 'is-in-ci';
45
import { join } from 'path';
56
import { launch } from 'puppeteer';
67

@@ -99,6 +100,12 @@ export async function generateOpenGraphImage({
99100
height = DEFAULT_HEIGHT * DEFAULT_MULTIPLIER,
100101
...options
101102
}: ImageOptions) {
103+
if (isInCi) {
104+
console.info('Running in a CI environment');
105+
console.warn('Skipping OG image generation');
106+
return `${siteMetadata.siteUrl}/${options.path}`;
107+
}
108+
102109
const content = compileTemplate({
103110
...options,
104111
width,

0 commit comments

Comments
 (0)