Skip to content

Commit

Permalink
Visual test all routes
Browse files Browse the repository at this point in the history
* Upgrade ECMAScript version, for newer string matching functions
  • Loading branch information
john-kurkowski committed Apr 3, 2024
1 parent acda705 commit 2b76677
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lostpixel.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +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('&amp;', '&')
})
}

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: [{ path: '/', name: 'landing' }],
pages: pagePaths().map((path) => ({ path, name: slugify(path) })),
baseUrl: 'http://172.17.0.1:9000',
},
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"baseUrl": "./",
"esModuleInterop": true,
"jsx": "react",
"lib": ["dom", "es2021"],
"noEmit": true,
"skipLibCheck": true,
"strict": true
Expand Down

0 comments on commit 2b76677

Please sign in to comment.