-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Copy Lost Pixel getting started instructions * Bump actions versions * Test Gatsby production build, instead of development server * Copy npm scripts from newer upstream Gatsby starter * Allow visiting production build via IP * List all routes for testing * Upgrade ECMAScript version, for newer string matching functions
- Loading branch information
1 parent
dc6c6c5
commit 1ca38ec
Showing
5 changed files
with
1,054 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Lost Pixel | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.12.0 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build app | ||
run: npm run build | ||
|
||
- name: Start server (in background) | ||
run: npm run serve & | ||
|
||
- name: Lost Pixel | ||
uses: lost-pixel/lost-pixel@v3.16.0 | ||
env: | ||
LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { CustomProjectConfig } from 'lost-pixel' | ||
import { readFileSync } from 'fs' | ||
import { join } from 'path' | ||
|
||
function pagePaths(): string[] { | ||
const siteUrl = 'https://johnkurkowski.com' | ||
const sitemapXml = readFileSync( | ||
join(__dirname, 'public', 'sitemap-0.xml'), | ||
'utf-8', | ||
) | ||
const urlsRe = new RegExp(`${siteUrl}(/[^<]*)`, 'g') | ||
return Array.from(sitemapXml.matchAll(urlsRe)).map(function ([, url]) { | ||
return url.replaceAll('&', '&') | ||
}) | ||
} | ||
|
||
function slugify(str: string): string { | ||
const replaced = str.replaceAll('/', '-') | ||
const stripped = replaced.replaceAll(/(^-+|-+$)/g, '') | ||
return stripped ? stripped : 'index' | ||
} | ||
|
||
export const config: CustomProjectConfig = { | ||
apiKey: process.env.LOST_PIXEL_API_KEY, | ||
breakpoints: [414, 1280], | ||
lostPixelProjectId: 'clud602ae10romo0e861bvpv2', | ||
pageShots: { | ||
pages: pagePaths().map((path) => ({ path, name: slugify(path) })), | ||
baseUrl: 'http://172.17.0.1:9000', | ||
}, | ||
} |
Oops, something went wrong.