-
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.
* Upgrade ECMAScript version, for newer string matching functions
- Loading branch information
1 parent
acda705
commit 2b76677
Showing
2 changed files
with
22 additions
and
1 deletion.
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 |
---|---|---|
@@ -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('&', '&') | ||
}) | ||
} | ||
|
||
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', | ||
}, | ||
} |
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