-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SLB-188: Decap integration #117
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
86c39ca
refactor(SLB-188): simplify source typing for easer zod schemas
pmelab fcd6aad
refactor(SLB-188): simplify test data and structure
pmelab 594602f
feat(SLB-188): generic preview function
pmelab 295e3fb
refactor(SLB-188): clean up page collection code
pmelab fcf24fe
refactor(SLB-188): fix broken test data
pmelab 3fb4753
feat(SLB-188): expose getPages function
pmelab 8be7624
fix: lock graphql version
pmelab 8c81cac
chore(SLB-188): merge content changes to release
pmelab 623c4ab
feat(SLB-188): separate decap pages from drupal pages
pmelab 5f487cb
feat(SLB-188): source and render decap pages
pmelab 049576a
feat(SLB-188): serve decap ui in /admin subfolder
pmelab 3370e10
ci: clear the drupal cache when schema changes
pmelab eb7a781
chore(SLB-188): adapt schema test cases to changes
pmelab 05449f3
test(SLB-188): add e2e test case for decap pages
pmelab a7b9c51
refactor(SLB-188): remove leftover debug log
pmelab c06a8cf
refactor(SLB-188): fix naming of decap page template
pmelab 18a995f
refactor(SLB-188): separate drupal and decap previews
pmelab 2fcdfa8
fix: upgrade @amazeelabs/gatsby-silverback-cloudinary
pmelab 1a430ae
fix(SLB-188): add missing 'originalSrc' to decap images
pmelab 6f4891b
fix: add missing output declarations for autoloader files
pmelab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,12 @@ | ||
import { dirname, resolve } from 'path'; | ||
import { expect, test } from 'vitest'; | ||
|
||
import { getPages } from '..'; | ||
|
||
test('getPages', () => { | ||
const dir = resolve( | ||
dirname(new URL(import.meta.url).pathname), | ||
'../../data/page', | ||
); | ||
expect(() => getPages(dir)).not.toThrow(); | ||
}); |
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
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
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,42 +1 @@ | ||
import { PageSource } from '@custom/schema/source'; | ||
import fs from 'fs'; | ||
import { dirname, resolve } from 'path'; | ||
import yaml from 'yaml'; | ||
|
||
import { pageSchema } from './collections/page'; | ||
|
||
export function getPages() { | ||
const dir = resolve(dirname(new URL(import.meta.url).pathname), '../data'); | ||
const settings = yaml.parse(fs.readFileSync(`${dir}/site.yml`, 'utf-8')) as { | ||
homePage: string; | ||
notFoundPage: string; | ||
}; | ||
const pages: Array<PageSource> = []; | ||
fs.readdirSync(`${dir}/page`) | ||
.filter((file) => file.endsWith('.yml')) | ||
.forEach((file) => { | ||
const content = yaml.parse( | ||
fs.readFileSync(`${dir}/page/${file}`, 'utf-8'), | ||
); | ||
Object.keys(content).forEach((lang) => { | ||
const input = { | ||
...content[lang], | ||
locale: lang, | ||
path: | ||
content[lang].path === settings.homePage | ||
? '/' | ||
: content[lang].path === settings.notFoundPage | ||
? '/404' | ||
: content[lang].path, | ||
}; | ||
const page = pageSchema.safeParse(input); | ||
if (page.success) { | ||
pages.push(page.data); | ||
} else { | ||
console.warn(`Error parsing ${file} (${lang}):`); | ||
console.warn(page.error.message); | ||
} | ||
}); | ||
}); | ||
return pages; | ||
} | ||
export { getPages } from './collections/page.js'; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had many issues updating these in silverback-mono. Just complaining 😅